Time event_lasttime = 0;
/*! The value of the mask for the NumLock modifier */
-unsigned int NumLockMask;
+guint NumLockMask;
/*! The value of the mask for the ScrollLock modifier */
-unsigned int ScrollLockMask;
+guint ScrollLockMask;
/*! The key codes for the modifier keys */
static XModifierKeymap *modmap;
/*! Table of the constant modifier masks */
-static const int mask_table[] = {
+static const gint mask_table[] = {
ShiftMask, LockMask, ControlMask, Mod1Mask,
Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask
};
-static int mask_table_size;
+static gint mask_table_size;
static guint ignore_enter_focus = 0;
static ObClient *focus_in, *focus_out;
#ifdef USE_SM
-static void ice_handler(int fd, gpointer conn)
+static void ice_handler(gint fd, gpointer conn)
{
Bool b;
IceProcessMessages(conn, NULL, &b);
static void event_hack_mods(XEvent *e)
{
KeyCode *kp;
- int i, k;
+ gint i, k;
switch (e->type) {
case ButtonPress:
focus_in = NULL;
if (client == focus_out)
focus_out = NULL;
+ if (client == focus_hilite)
+ focus_hilite = NULL;
}
static void event_done(gpointer data)
frame_adjust_focus(focus_in->frame, TRUE);
client_calc_layer(focus_in);
}
+
+ focus_hilite = focus_in;
}
if (focus_out) {
if (focus_out == focus_client)
focus_set_client(NULL);
frame_adjust_focus(focus_out->frame, FALSE);
client_calc_layer(focus_out);
- }
- focus_hilite = focus_in;
+ if (!focus_in)
+ focus_hilite = NULL;
+ }
if (focus_client != last) {
- if (!focus_client)
- focus_fallback(OB_FOCUS_FALLBACK_NOFOCUS);
+ if (!focus_client) {
+ Window w;
+ gint r;
+
+ /* is focus anywhere valid? */
+ XGetInputFocus(ob_display, &w, &r);
+
+#ifdef DEBUG_FOCUS
+ ob_debug("Focus was found on 0x%x revert %d\n", w, r);
+#endif
+
+ if (!w || w == PointerRoot)
+ focus_fallback(OB_FOCUS_FALLBACK_NOFOCUS);
+ }
last = focus_client;
}
e->type == MotionNotify)
mouse_event(client, e);
else if (e->type == KeyPress)
- keyboard_event((focus_hilite ?
- focus_hilite : client), e);
+ keyboard_event((focus_cycle_target ? focus_cycle_target :
+ (focus_hilite ? focus_hilite : client)),
+ e);
}
}
}
msgtype = e->xclient.message_type;
if (msgtype == prop_atoms.net_current_desktop) {
- unsigned int d = e->xclient.data.l[0];
+ guint d = e->xclient.data.l[0];
if (d < screen_num_desktops)
screen_set_desktop(d);
} else if (msgtype == prop_atoms.net_number_of_desktops) {
- unsigned int d = e->xclient.data.l[0];
+ guint d = e->xclient.data.l[0];
if (d > 0)
screen_set_num_desktops(d);
} else if (msgtype == prop_atoms.net_showing_desktop) {
{
XEvent ce;
Atom msgtype;
- int i=0;
+ gint i=0;
ObFrameContext con;
switch (e->type) {
e->xfocus.window, client->window,
e->xfocus.mode, e->xfocus.detail);
#endif
- focus_out = client;
+ if (focus_hilite == client || focus_client == client)
+ focus_out = client;
if (focus_in == client)
focus_in = NULL;
break;
if (e->xconfigurerequest.value_mask & (CWWidth | CWHeight |
CWX | CWY |
CWBorderWidth)) {
- int x, y, w, h;
+ gint x, y, w, h;
ObCorner corner;
if (e->xconfigurerequest.value_mask & CWBorderWidth)
e->xconfigurerequest.height : client->area.height;
{
- int newx = x;
- int newy = y;
- int fw = w +
- client->frame->size.left + client->frame->size.right;
- int fh = h +
- client->frame->size.top + client->frame->size.bottom;
+ gint newx = x;
+ gint newy = y;
+ gint fw = w +
+ client->frame->size.left + client->frame->size.right;
+ gint fh = h +
+ client->frame->size.top + client->frame->size.bottom;
client_find_onscreen(client, &newx, &newy, fw, fh,
client_normal(client));
if (e->xconfigurerequest.value_mask & CWX)
case MapRequest:
ob_debug("MapRequest for 0x%lx\n", client->window);
if (!client->iconic) break; /* this normally doesn't happen, but if it
- does, we don't want it! */
+ does, we don't want it!
+ it can happen now when the window is on
+ another desktop, but we still don't
+ want it! */
client_activate(client, FALSE);
break;
case ClientMessage:
e->xclient.data.l[2]);
}
} else if (msgtype == prop_atoms.net_moveresize_window) {
- int oldg = client->gravity;
- int tmpg, x, y, w, h;
+ gint oldg = client->gravity;
+ gint tmpg, x, y, w, h;
if (e->xclient.data.l[0] & 0xff)
tmpg = e->xclient.data.l[0] & 0xff;
client->gravity = tmpg;
{
- int newx = x;
- int newy = y;
- int fw = w +
- client->frame->size.left + client->frame->size.right;
- int fh = h +
- client->frame->size.top + client->frame->size.bottom;
+ gint newx = x;
+ gint newy = y;
+ gint fw = w +
+ client->frame->size.left + client->frame->size.right;
+ gint fh = h +
+ client->frame->size.top + client->frame->size.bottom;
client_find_onscreen(client, &newx, &newy, fw, fh,
client_normal(client));
if (e->xclient.data.l[0] & 1 << 8)