activate = FALSE;
ob_debug_type(OB_DEBUG_FOCUS,
"Not focusing the window because the user is "
- "working in another window\n");
+ "working in another window");
}
- /* If its a transient (and its parents aren't focused) */
+ /* If it's a transient (and its parents aren't focused) */
else if (client_has_parent(self)) {
activate = FALSE;
ob_debug_type(OB_DEBUG_FOCUS,
if (!activate) {
ob_debug_type(OB_DEBUG_FOCUS,
"Focus stealing prevention activated for %s at "
- "time %u (last user interactioon time %u)",
- "time %u (last user interaction time %u)\n",
++ "time %u (last user interaction time %u)",
self->title, map_time, event_last_user_time);
/* if the client isn't focused, then hilite it so the user
knows it is there */
static void client_get_shaped(ObClient *self)
{
self->shaped = FALSE;
- #ifdef SHAPE
+ #ifdef SHAPE
- if (extensions_shape) {
+ if (obt_display_extension_shape) {
gint foo;
guint ufoo;
gint s;
- XShapeSelectInput(ob_display, self->window, ShapeNotifyMask);
+ XShapeSelectInput(obt_display, self->window, ShapeNotifyMask);
- XShapeQueryExtents(ob_display, self->window, &s, &foo,
+ XShapeQueryExtents(obt_display, self->window, &s, &foo,
&foo, &ufoo, &ufoo, &foo, &foo, &foo, &ufoo,
&ufoo);
- self->shaped = (s != 0);
+ self->shaped = !!s;
}
#endif
}
ObClient *target = NULL;
gboolean trangroup = FALSE;
- if (XGetTransientForHint(ob_display, self->window, &t)) {
+ if (XGetTransientForHint(obt_display, self->window, &t)) {
- if (t != self->window) { /* cant be transient to itself! */
+ if (t != self->window) { /* can't be transient to itself! */
- target = g_hash_table_lookup(window_map, &t);
+ ObWindow *tw = window_find(t);
- /* if this happens then we need to check for it*/
+ /* if this happens then we need to check for it */
- g_assert(target != self);
- if (target && !WINDOW_IS_CLIENT(target)) {
+ g_assert(tw != CLIENT_AS_WINDOW(self));
+ if (tw && WINDOW_IS_CLIENT(tw)) {
/* watch out for windows with a parent that is something
different, like a dockapp for example */
- target = NULL;
+ target = WINDOW_AS_CLIENT(tw);
}
}
{
XWMHints *hints;
- /* assume a window takes input if it doesnt specify */
+ /* assume a window takes input if it doesn't specify */
self->can_focus = TRUE;
- if ((hints = XGetWMHints(ob_display, self->window)) != NULL) {
+ if ((hints = XGetWMHints(obt_display, self->window)) != NULL) {
gboolean ur;
if (hints->flags & InputHint)
GSList *it;
gboolean changed = FALSE;
-
if (self->iconic != iconic) {
- ob_debug("%sconifying window: 0x%lx\n", (iconic ? "I" : "Uni"),
+ ob_debug("%sconifying window: 0x%lx", (iconic ? "I" : "Uni"),
self->window);
if (iconic) {
go moving on us */
event_halt_focus_delay();
- /* if there is a grab going on, then we need to cancel it. if we move
- focus during the grab, applications will get NotifyWhileGrabbed events
- and ignore them !
-
- actions should not rely on being able to move focus during an
- interactive grab.
- */
event_cancel_all_key_grabs();
- xerror_set_ignore(TRUE);
- xerror_occured = FALSE;
+ obt_display_ignore_errors(TRUE);
if (self->can_focus) {
/* This can cause a BadMatch error with CurrentTime, or if an app
}
}
- while (XCheckTypedWindowEvent(ob_display, window, e->type, ce)) {
+ static gboolean *context_to_button(ObFrame *f, ObFrameContext con, gboolean press)
+ {
+ if (press) {
+ switch (con) {
+ case OB_FRAME_CONTEXT_MAXIMIZE:
+ return &f->max_press;
+ case OB_FRAME_CONTEXT_CLOSE:
+ return &f->close_press;
+ case OB_FRAME_CONTEXT_ICONIFY:
+ return &f->iconify_press;
+ case OB_FRAME_CONTEXT_ALLDESKTOPS:
+ return &f->desk_press;
+ case OB_FRAME_CONTEXT_SHADE:
+ return &f->shade_press;
+ default:
+ return NULL;
+ }
+ } else {
+ switch (con) {
+ case OB_FRAME_CONTEXT_MAXIMIZE:
+ return &f->max_hover;
+ case OB_FRAME_CONTEXT_CLOSE:
+ return &f->close_hover;
+ case OB_FRAME_CONTEXT_ICONIFY:
+ return &f->iconify_hover;
+ case OB_FRAME_CONTEXT_ALLDESKTOPS:
+ return &f->desk_hover;
+ case OB_FRAME_CONTEXT_SHADE:
+ return &f->shade_hover;
+ default:
+ return NULL;
+ }
+ }
+ }
+
+ static void compress_client_message_event(XEvent *e, XEvent *ce, Window window,
+ Atom msgtype)
+ {
+ /* compress changes into a single change */
- XPutBackEvent(ob_display, ce);
++ while (XCheckTypedWindowEvent(obt_display, window, e->type, ce)) {
+ /* XXX: it would be nice to compress ALL messages of a
+ type, not just messages in a row without other
+ message types between. */
+ if (ce->xclient.message_type != msgtype) {
++ XPutBackEvent(obt_display, ce);
+ break;
+ }
+ e->xclient = ce->xclient;
+ }
+ }
+
static void event_handle_client(ObClient *client, XEvent *e)
{
XEvent ce;
RECT_TO_DIMS(client->area, x, y, w, h);
ob_debug("ConfigureRequest for \"%s\" desktop %d wmstate %d "
- "visibile %d",
- "visible %d\n"
- " x %d y %d w %d h %d b %d\n",
++ "visible %d",
client->title,
- screen_desktop, client->wmstate, client->frame->visible,
+ screen_desktop, client->wmstate, client->frame->visible);
+ ob_debug(" x %d y %d w %d h %d b %d",
x, y, w, h, client->border_width);
if (e->xconfigurerequest.value_mask & CWBorderWidth)
if (e->xclient.format != 32) return;
msgtype = e->xclient.message_type;
- if (msgtype == prop_atoms.wm_change_state) {
+ if (msgtype == OBT_PROP_ATOM(WM_CHANGE_STATE)) {
- /* compress changes into a single change */
- while (XCheckTypedWindowEvent(obt_display, client->window,
- e->type, &ce)) {
- /* XXX: it would be nice to compress ALL messages of a
- type, not just messages in a row without other
- message types between. */
- if (ce.xclient.message_type != msgtype) {
- XPutBackEvent(obt_display, &ce);
- break;
- }
- e->xclient = ce.xclient;
- }
+ compress_client_message_event(e, &ce, client->window, msgtype);
client_set_wm_state(client, e->xclient.data.l[0]);
- } else if (msgtype == prop_atoms.net_wm_desktop) {
+ } else if (msgtype == OBT_PROP_ATOM(NET_WM_DESKTOP)) {
- /* compress changes into a single change */
- while (XCheckTypedWindowEvent(obt_display, client->window,
- e->type, &ce)) {
- /* XXX: it would be nice to compress ALL messages of a
- type, not just messages in a row without other
- message types between. */
- if (ce.xclient.message_type != msgtype) {
- XPutBackEvent(obt_display, &ce);
- break;
- }
- e->xclient = ce.xclient;
- }
+ compress_client_message_event(e, &ce, client->window, msgtype);
if ((unsigned)e->xclient.data.l[0] < screen_num_desktops ||
(unsigned)e->xclient.data.l[0] == DESKTOP_ALL)
client_set_desktop(client, (unsigned)e->xclient.data.l[0],
client_update_protocols(client);
client_setup_decor_and_functions(client, TRUE);
}
- else if (msgtype == OBT_PROP_ATOM(NET_WM_STRUT)) {
- client_update_strut(client);
- }
- else if (msgtype == OBT_PROP_ATOM(NET_WM_STRUT_PARTIAL)) {
- else if (msgtype == prop_atoms.net_wm_strut ||
- msgtype == prop_atoms.net_wm_strut_partial) {
++ else if (msgtype == OBT_PROP_ATOM(NET_WM_STRUT) ||
++ msgtype == OBT_PROP_ATOM(NET_WM_STRUT_PARTIAL)) {
client_update_strut(client);
}
- else if (msgtype == prop_atoms.net_wm_icon) {
+ else if (msgtype == OBT_PROP_ATOM(NET_WM_ICON)) {
client_update_icons(client);
}
- else if (msgtype == prop_atoms.net_wm_icon_geometry) {
+ else if (msgtype == OBT_PROP_ATOM(NET_WM_ICON_GEOMETRY)) {
client_update_icon_geometry(client);
}
- else if (msgtype == prop_atoms.net_wm_user_time) {
+ else if (msgtype == OBT_PROP_ATOM(NET_WM_USER_TIME)) {
guint32 t;
if (client == focus_client &&
- PROP_GET32(client->window, net_wm_user_time, cardinal, &t) &&
- t && !event_time_after(t, e->xproperty.time) &&
+ OBT_PROP_GET32(client->window, NET_WM_USER_TIME, CARDINAL, &t)
+ && t && !event_time_after(t, e->xproperty.time) &&
(!event_last_user_time ||
event_time_after(t, event_last_user_time)))
{
app->ignore_unmaps--;
break;
}
- dock_remove(app, TRUE);
+ dock_unmanage(app, TRUE);
break;
case DestroyNotify:
- dock_unmanage(app, FALSE);
- break;
case ReparentNotify:
- dock_remove(app, FALSE);
+ dock_unmanage(app, FALSE);
break;
case ConfigureNotify:
dock_app_configure(app, e->xconfigure.width, e->xconfigure.height);
void event_enter_client(struct _ObClient *client);
/*! Make mouse focus not move at all from the stuff that happens between these
- two function calls. */
+ two function calls. */
-gulong event_start_ignore_all_enters();
+gulong event_start_ignore_all_enters(void);
void event_end_ignore_all_enters(gulong start);
- /*! End *all* active and passive grabs on the keyboard */
+ /*! End *all* active and passive grabs on the keyboard
+ This is called in situations where if there is a grab going on, then
+ we need to cancel it. If we move focus during the grab, applications
+ will get NotifyWhileGrabbed events and ignore them!
+
+ Actions should not rely on being able to move focus during an
+ interactive grab. */
-void event_cancel_all_key_grabs();
+void event_cancel_all_key_grabs(void);
/* Halts any focus delay in progress, use this when the user is selecting a
window for focus */
-void event_halt_focus_delay();
+void event_halt_focus_delay(void);
/*! Compare t1 and t2, taking into account wraparound. True if t1
- comes at the same time or later than t2. */
+ comes at the same time or later than t2. */
gboolean event_time_after(Time t1, Time t2);
-Time event_get_server_time();
+Time event_get_server_time(void);
#endif