Handle window focus

Fixes #137
This commit is contained in:
Jordan Eldredge 2015-02-08 21:24:58 -08:00
parent 1ba2c4fb61
commit 2dbd35e6ee
3 changed files with 11 additions and 4 deletions

View file

@ -18,9 +18,9 @@
<link rel="shortcut icon" sizes="16x16 32x32" href="favicon.ico">
</head>
<body>
<div id='main-window' class='loading stop'>
<div id='main-window' class='selected loading stop'>
<div id='loading'>Loading...</div>
<div id='title-bar' class='selected'>
<div id='title-bar'>
<div id='option' class='ui'>
<ul id='context-menu'>
<li><a href='https://github.com/captbaritone/winamp2-js' target='_blank'>Winamp2-js...</a></li>
@ -103,7 +103,7 @@
</div>
<a id='about' target='_blank' href='https://github.com/captbaritone/winamp2-js'></a>
</div>
<div id='playlist' class='selected loading stop'>
<div id='playlist' class='loading stop'>
<ul id='tracks'></ul>
<!-- These go first so that they end up below the .top div in the
z axis -->

View file

@ -150,7 +150,7 @@ var SKIN_SPRITES = [
img: "TITLEBAR",
sprites: [
{ selectors: ["#title-bar"], x: 27, y: 15, width: 275, height: 14},
{ selectors: ["#title-bar.selected"], x: 27, y: 0, width: 275, height: 14},
{ selectors: [".selected #title-bar"], x: 27, y: 0, width: 275, height: 14},
{ selectors: [".lllama #title-bar"], x: 27, y: 61, width: 275, height: 14},
{ selectors: [".lllama #title-bar.selected"], x: 27, y: 57, width: 275, height: 14},
{ selectors: ["#title-bar #option"], x: 0, y: 0, width: 9, height: 9},

View file

@ -8,6 +8,13 @@ WindowManager = {
this.windows[name] = body;
body.addEventListener('mousedown',function(e){
for (var name in self.windows) {
self.windows[name].classList.remove('selected');
}
this.classList.add('selected');
});
// Make window dragable
handle.addEventListener('mousedown',function(e){
if(e.target.classList.contains('ui')) {