EWMH: Improve _NET_WM_STATE_FULLSCREEN management

This commit is contained in:
Martin Duquesnoy
2010-04-08 12:33:52 +02:00
parent ffaa243644
commit fbb36877dc
3 changed files with 18 additions and 14 deletions

View File

@@ -301,7 +301,7 @@ ewmh_manage_net_wm_state(long data_l[], Client *c)
/* Manage _NET_WM_STATE_FULLSCREEN */
if(data_l[1] == net_atom[net_wm_state_fullscreen])
{
if(data_l[0] == _NET_WM_STATE_ADD && !(c->flags & FSSFlag))
if(data_l[0] == _NET_WM_STATE_ADD)
{
c->screen = screen_get_with_geo(c->geo.x, c->geo.y);
client_unmap(c);
@@ -318,17 +318,16 @@ ewmh_manage_net_wm_state(long data_l[], Client *c)
c->ogeo = c->geo;
c->flags |= (FSSFlag | MaxFlag);
client_raise(c);
client_focus(c);
}
else if(data_l[0] == _NET_WM_STATE_REMOVE && (c->flags & FSSFlag))
else if(data_l[0] == _NET_WM_STATE_REMOVE)
{
c->flags &= ~(FSSFlag | MaxFlag);
client_map(c);
XReparentWindow(dpy, c->win, c->frame, BORDH, TBARH);
client_moveresize(c, c->tmp_geo, False);
}
XRaiseWindow(dpy, c->win);
client_focus(c);
}
/* Manage _NET_WM_STATE_DEMANDS_ATTENTION */
else if(data_l[1] == net_atom[net_wm_state_demands_attention])

View File

@@ -76,8 +76,12 @@ launcher_execute(Launcher *launcher)
/* First draw of the cursor */
XSetForeground(dpy, gc, getcolor(infobar[selscreen].bar->fg));
XDrawLine(dpy, bw->dr, gc, textw(launcher->prompt) + textw(" "),
2, textw(launcher->prompt) + textw(" "), INFOBARH - 4);
/*XDrawLine(dpy, bw->dr, gc, 1 + textw(launcher->prompt) + textw(" "),
, 1 + textw(launcher->prompt) + textw(" "), INFOBARH - 4);
*/
XDrawLine(dpy, bw->dr, gc,
1 + textw(launcher->prompt) + textw(" ") + textw(buf), 2,
1 + textw(launcher->prompt) + textw(" ") + textw(buf), INFOBARH - 4);
barwin_refresh(bw);
@@ -111,14 +115,14 @@ launcher_execute(Launcher *launcher)
{
if(histpos >= launcher->nhisto)
histpos = 0;
strcpy(buf, launcher->histo[launcher->nhisto - ++histpos]);
strncpy(buf, launcher->histo[launcher->nhisto - ++histpos], sizeof(buf));
pos = strlen(buf);
}
break;
case XK_Down:
if(launcher->nhisto && histpos > 0 && histpos < launcher->nhisto)
{
strcpy(buf, launcher->histo[launcher->nhisto - --histpos]);
strncpy(buf, launcher->histo[launcher->nhisto - --histpos], sizeof(buf));
pos = strlen(buf);
}
break;
@@ -126,15 +130,15 @@ launcher_execute(Launcher *launcher)
case XK_Return:
spawn("%s %s", launcher->command, buf);
/* Histo */
if(launcher->nhisto + 1 > 128)
if(launcher->nhisto + 1 > HISTOLEN)
{
for(i = launcher->nhisto - 1; i > 1; --i)
strcpy(launcher->histo[i], launcher->histo[i - 1]);
strncpy(launcher->histo[i], launcher->histo[i - 1], sizeof(launcher->histo[i]));
launcher->nhisto = 0;
}
/* Store in histo array */
strcpy(launcher->histo[launcher->nhisto++], buf);
strncpy(launcher->histo[launcher->nhisto++], buf, sizeof(buf));
my_guitar_gently_wheeps = 0;
break;
@@ -195,7 +199,7 @@ launcher_execute(Launcher *launcher)
default:
lastwastab = False;
strncat(buf, tmp, sizeof(buf));
strncat(buf, tmp, sizeof(tmp));
++pos;
break;
}

View File

@@ -38,6 +38,7 @@
#define NBUTTON 8
#define MAXTAG 36
#define NUM_OF_LAYOUT 10
#define HISTOLEN 128
/* Clients flags definition */
#define FreeFlag (1 << 1)
@@ -301,7 +302,7 @@ typedef struct
char *name;
char *prompt;
char *command;
char histo[128][512];
char histo[HISTOLEN][512];
uint nhisto;
} Launcher;