diff options
Diffstat (limited to 'openbox')
| -rw-r--r-- | openbox/action.c | 26 | ||||
| -rw-r--r-- | openbox/client.c | 44 | ||||
| -rw-r--r-- | openbox/client.h | 4 | ||||
| -rw-r--r-- | openbox/client_list_combined_menu.h | 4 | ||||
| -rw-r--r-- | openbox/config.c | 6 | ||||
| -rw-r--r-- | openbox/config.h | 2 | ||||
| -rw-r--r-- | openbox/dock.c | 4 | ||||
| -rw-r--r-- | openbox/event.c | 28 | ||||
| -rw-r--r-- | openbox/event.h | 2 | ||||
| -rw-r--r-- | openbox/focus.c | 13 | ||||
| -rw-r--r-- | openbox/grab.c | 12 | ||||
| -rw-r--r-- | openbox/mainloop.c | 3 | ||||
| -rw-r--r-- | openbox/menuframe.c | 2 | ||||
| -rw-r--r-- | openbox/mouse.c | 2 | ||||
| -rw-r--r-- | openbox/place.c | 5 |
15 files changed, 105 insertions, 52 deletions
diff --git a/openbox/action.c b/openbox/action.c index 9350c3ce..8ad60931 100644 --- a/openbox/action.c +++ b/openbox/action.c @@ -1034,7 +1034,7 @@ void action_run_list(GSList *acts, ObClient *c, ObFrameContext context, it won't work right unless we XUngrabKeyboard first, even though we grabbed the key/button Asychronously. e.g. "gnome-panel-control --main-menu" */ - XUngrabKeyboard(ob_display, event_lasttime); + XUngrabKeyboard(ob_display, event_curtime); } for (it = acts; it; it = g_slist_next(it)) { @@ -1111,16 +1111,30 @@ void action_execute(union ActionData *data) void action_activate(union ActionData *data) { - client_activate(data->activate.any.c, data->activate.here); + /* similar to the openbox dock for dockapps, don't let user actions give + focus to 3rd-party docks (panels) either (unless they ask for it + themselves). */ + if (data->client.any.c->type != OB_CLIENT_TYPE_DOCK) { + /* if using focus_delay, stop the timer now so that focus doesn't go + moving on us */ + event_halt_focus_delay(); + + client_activate(data->activate.any.c, data->activate.here, TRUE); + } } void action_focus(union ActionData *data) { - /* if using focus_delay, stop the timer now so that focus doesn't go moving - on us */ - event_halt_focus_delay(); + /* similar to the openbox dock for dockapps, don't let user actions give + focus to 3rd-party docks (panels) either (unless they ask for it + themselves). */ + if (data->client.any.c->type != OB_CLIENT_TYPE_DOCK) { + /* if using focus_delay, stop the timer now so that focus doesn't go + moving on us */ + event_halt_focus_delay(); - client_focus(data->client.any.c); + client_focus(data->client.any.c); + } } void action_unfocus (union ActionData *data) diff --git a/openbox/client.c b/openbox/client.c index 88eecf14..efd5dbc9 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -371,8 +371,9 @@ void client_manage(Window window) /* focus the new window? */ if (ob_state() != OB_STATE_STARTING && - (config_focus_new || client_search_focus_parent(self)) || - (settings && settings->focus == TRUE) && + ((settings && settings->focus == TRUE) || + (!settings && (config_focus_new || + client_search_focus_parent(self)))) && /* note the check against Type_Normal/Dialog, not client_normal(self), which would also include other types. in this case we want more strict rules for focus */ @@ -810,20 +811,22 @@ static void client_toggle_border(ObClient *self, gboolean show) static void client_get_all(ObClient *self) { client_get_area(self); - client_update_transient_for(self); - client_update_wmhints(self); - client_get_startup_id(self); - client_get_desktop(self); - client_get_shaped(self); - client_get_mwm_hints(self); - client_get_type(self);/* this can change the mwmhints for special cases */ /* The transient hint is used to pick a type, but the type can also affect - transiency (dialogs are always made transients). This is Havoc's idea, - but it is needed to make some apps work right (eg tsclient). */ + transiency (dialogs are always made transients of their group if they + have one). This is Havoc's idea, but it is needed to make some apps + work right (eg tsclient). */ + client_update_transient_for(self); + client_get_type(self);/* this can change the mwmhints for special cases */ client_update_transient_for(self); + client_update_wmhints(self); + client_get_startup_id(self); + client_get_desktop(self);/* uses transient data/group/startup id if a + desktop is not specified */ + client_get_shaped(self); + client_get_state(self); { @@ -1303,6 +1306,7 @@ void client_setup_decor_and_functions(ObClient *self) if (! (self->mwmhints.decorations & OB_MWM_DECOR_ALL)) { if (! ((self->mwmhints.decorations & OB_MWM_DECOR_HANDLE) || (self->mwmhints.decorations & OB_MWM_DECOR_TITLE))) + { /* if the mwm hints request no handle or title, then all decorations are disabled, but keep the border if that's specified */ @@ -1310,6 +1314,7 @@ void client_setup_decor_and_functions(ObClient *self) self->decorations = OB_FRAME_DECOR_BORDER; else self->decorations = 0; + } } } @@ -2497,7 +2502,7 @@ void client_close(ObClient *self) ce.xclient.window = self->window; ce.xclient.format = 32; ce.xclient.data.l[0] = prop_atoms.wm_delete_window; - ce.xclient.data.l[1] = event_lasttime; + ce.xclient.data.l[1] = event_curtime; ce.xclient.data.l[2] = 0l; ce.xclient.data.l[3] = 0l; ce.xclient.data.l[4] = 0l; @@ -2818,7 +2823,7 @@ gboolean client_focus(ObClient *self) #799. So now it is RevertToNone again. */ XSetInputFocus(ob_display, self->window, RevertToNone, - event_lasttime); + event_curtime); } if (self->focus_notify) { @@ -2829,7 +2834,7 @@ gboolean client_focus(ObClient *self) ce.xclient.window = self->window; ce.xclient.format = 32; ce.xclient.data.l[0] = prop_atoms.wm_take_focus; - ce.xclient.data.l[1] = event_lasttime; + ce.xclient.data.l[1] = event_curtime; ce.xclient.data.l[2] = 0l; ce.xclient.data.l[3] = 0l; ce.xclient.data.l[4] = 0l; @@ -2839,7 +2844,7 @@ gboolean client_focus(ObClient *self) #ifdef DEBUG_FOCUS ob_debug("%sively focusing %lx at %d\n", (self->can_focus ? "act" : "pass"), - self->window, (gint) event_lasttime); + self->window, (gint) event_curtime); #endif /* Cause the FocusIn to come back to us. Important for desktop switches, @@ -2861,8 +2866,11 @@ void client_unfocus(ObClient *self) } } -void client_activate(ObClient *self, gboolean here) +void client_activate(ObClient *self, gboolean here, gboolean user) { + /* XXX do some stuff here if user is false to determine if we really want + to activate it or not (a parent or group member is currently active) */ + if (client_normal(self) && screen_showing_desktop) screen_show_desktop(FALSE); if (self->iconic) @@ -2997,8 +3005,8 @@ ObClient *client_find_directional(ObClient *c, ObDirection dir) continue; if(cur->iconic) continue; - if(client_focus_target(cur) == cur && - !(cur->can_focus || cur->focus_notify)) + if(!(client_focus_target(cur) == cur && + client_can_focus(cur))) continue; /* find the centre coords of this window, from the diff --git a/openbox/client.h b/openbox/client.h index 9702bb19..d8382d2a 100644 --- a/openbox/client.h +++ b/openbox/client.h @@ -477,8 +477,10 @@ void client_unfocus(ObClient *self); when the user deliberately selects a window for use. @param here If true, then the client is brought to the current desktop; otherwise, the desktop is changed to where the client lives. + @param user If true, then a user action is what requested the activation; + otherwise, it means an application requested it on its own */ -void client_activate(ObClient *self, gboolean here); +void client_activate(ObClient *self, gboolean here, gboolean user); /*! Calculates the stacking layer for the client window */ void client_calc_layer(ObClient *self); diff --git a/openbox/client_list_combined_menu.h b/openbox/client_list_combined_menu.h index d48ee09b..91ebfc47 100644 --- a/openbox/client_list_combined_menu.h +++ b/openbox/client_list_combined_menu.h @@ -20,7 +20,7 @@ #ifndef ob__client_list_combined_menu_h #define ob__client_list_combined_menu_h -void client_list_menu_combined_startup(gboolean reconfig); -void client_list_menu_combined_shutdown(gboolean reconfig); +void client_list_combined_menu_startup(gboolean reconfig); +void client_list_combined_menu_shutdown(gboolean reconfig); #endif diff --git a/openbox/config.c b/openbox/config.c index 774eddad..9cf07a37 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -44,7 +44,7 @@ gboolean config_title_number; gint config_desktops_num; GSList *config_desktops_names; -gint config_screen_firstdesk; +guint config_screen_firstdesk; gboolean config_resize_redraw; gboolean config_resize_four_corners; @@ -455,7 +455,7 @@ static void parse_desktops(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, if ((n = parse_find_node("firstdesk", node))) { gint d = parse_int(doc, n); if (d > 0) - config_screen_firstdesk = d; + config_screen_firstdesk = (unsigned) d; } if ((n = parse_find_node("names", node))) { GSList *it; @@ -718,7 +718,7 @@ static void bind_default_mouse() uact = OB_USER_ACTION_MOUSE_DOUBLE_CLICK; break; case OB_MOUSE_ACTION_MOTION: uact = OB_USER_ACTION_MOUSE_MOTION; break; - case OB_NUM_MOUSE_ACTIONS: + default: g_assert_not_reached(); } mouse_bind(it->button, it->context, it->mact, diff --git a/openbox/config.h b/openbox/config.h index 849d5a22..fc300d6c 100644 --- a/openbox/config.h +++ b/openbox/config.h @@ -96,7 +96,7 @@ extern gboolean config_title_number; /*! The number of desktops */ extern gint config_desktops_num; /*! Desktop to start on, put 5 to start in the center of a 3x3 grid */ -extern gint config_screen_firstdesk; +extern guint config_screen_firstdesk; /*! Names for the desktops */ extern GSList *config_desktops_names; diff --git a/openbox/dock.c b/openbox/dock.c index 7b92ff58..eceb3b99 100644 --- a/openbox/dock.c +++ b/openbox/dock.c @@ -313,6 +313,8 @@ void dock_configure() dock->y = a->height; gravity = SouthEastGravity; break; + default: + g_assert_not_reached(); } } @@ -578,6 +580,8 @@ void dock_app_drag(ObDockApp *app, XMotionEvent *e) case OB_ORIENTATION_VERT: after = (y > over->h / 2); break; + default: + g_assert_not_reached(); } /* remove before doing the it->next! */ diff --git a/openbox/event.c b/openbox/event.c index 21185be9..c74e15ae 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -86,7 +86,12 @@ static gboolean menu_hide_delay_func(gpointer data); (e)->xfocus.detail == NotifyAncestor || \ (e)->xfocus.detail > NotifyNonlinearVirtual) -Time event_lasttime = 0; +/* The most recent time at which an event with a timestamp occured. */ +static Time event_lasttime = 0; +/* The time for the current event being processed + (it's the event_lasttime for events without times, if this is a bug then + use CurrentTime instead, but it seems ok) */ +Time event_curtime = CurrentTime; /*! The value of the mask for the NumLock modifier */ guint NumLockMask; @@ -251,8 +256,14 @@ static void event_set_lasttime(XEvent *e) break; } - if (t > event_lasttime) + if (t > event_lasttime) { event_lasttime = t; + event_curtime = event_lasttime; + } else if (t == 0) { + event_curtime = event_lasttime; + } else { + event_curtime = t; + } } #define STRIP_MODS(s) \ @@ -919,7 +930,7 @@ static void event_handle_client(ObClient *client, XEvent *e) it can happen now when the window is on another desktop, but we still don't want it! */ - client_activate(client, FALSE); + client_activate(client, FALSE, TRUE); break; case ClientMessage: /* validate cuz we query stuff off the client here */ @@ -973,8 +984,15 @@ static void event_handle_client(ObClient *client, XEvent *e) ob_debug("net_close_window for 0x%lx\n", client->window); client_close(client); } else if (msgtype == prop_atoms.net_active_window) { - ob_debug("net_active_window for 0x%lx\n", client->window); - client_activate(client, FALSE); + ob_debug("net_active_window for 0x%lx source=%s\n", + client->window, + (e->xclient.data.l[0] == 0 ? "unknown" : + (e->xclient.data.l[0] == 1 ? "application" : + (e->xclient.data.l[0] == 2 ? "user" : "INVALID")))); + /* XXX make use of data.l[1] and [2] ! */ + client_activate(client, FALSE, + (e->xclient.data.l[0] == 0 || + e->xclient.data.l[0] == 2)); } else if (msgtype == prop_atoms.net_wm_moveresize) { ob_debug("net_wm_moveresize for 0x%lx\n", client->window); if ((Atom)e->xclient.data.l[2] == diff --git a/openbox/event.h b/openbox/event.h index 0da09789..44bf54a0 100644 --- a/openbox/event.h +++ b/openbox/event.h @@ -25,7 +25,7 @@ struct _ObClient; /*! Time at which the last event with a timestamp occured. */ -extern Time event_lasttime; +extern Time event_curtime; /*! The value of the mask for the NumLock modifier */ extern guint NumLockMask; diff --git a/openbox/focus.c b/openbox/focus.c index d78591ba..9de0c808 100644 --- a/openbox/focus.c +++ b/openbox/focus.c @@ -144,7 +144,7 @@ void focus_shutdown(gboolean reconfig) g_free(focus_order); /* reset focus to root */ - XSetInputFocus(ob_display, PointerRoot, RevertToNone, event_lasttime); + XSetInputFocus(ob_display, PointerRoot, RevertToNone, CurrentTime); RrColorFree(color_white); @@ -186,7 +186,7 @@ void focus_set_client(ObClient *client) #endif /* when nothing will be focused, send focus to the backup target */ XSetInputFocus(ob_display, screen_support_win, RevertToNone, - event_lasttime); + event_curtime); XSync(ob_display, FALSE); } @@ -318,6 +318,11 @@ ObClient* focus_fallback_target(ObFocusFallbackType type) if (client_normal(it->data) && client_can_focus(it->data)) return it->data; + /* XXX fallback to the "desktop window" if one exists ? + could store it while going through all the windows in the loop right + above this.. + */ + return NULL; } @@ -603,7 +608,7 @@ void focus_cycle(gboolean forward, gboolean linear, gboolean interactive, done_cycle: if (done && focus_cycle_target) - client_activate(focus_cycle_target, FALSE); + client_activate(focus_cycle_target, FALSE, TRUE); t = NULL; first = NULL; @@ -665,7 +670,7 @@ void focus_directional_cycle(ObDirection dir, gboolean interactive, done_cycle: if (done && focus_cycle_target) - client_activate(focus_cycle_target, FALSE); + client_activate(focus_cycle_target, FALSE, TRUE); first = NULL; focus_cycle_target = NULL; diff --git a/openbox/grab.c b/openbox/grab.c index b4c192b0..36a0d124 100644 --- a/openbox/grab.c +++ b/openbox/grab.c @@ -54,14 +54,14 @@ gboolean grab_keyboard(gboolean grab) if (kgrabs++ == 0) { ret = XGrabKeyboard(ob_display, RootWindow(ob_display, ob_screen), FALSE, GrabModeAsync, GrabModeAsync, - event_lasttime) == Success; + event_curtime) == Success; if (!ret) --kgrabs; } else ret = TRUE; } else if (kgrabs > 0) { if (--kgrabs == 0) - XUngrabKeyboard(ob_display, event_lasttime); + XUngrabKeyboard(ob_display, event_curtime); ret = TRUE; } @@ -77,14 +77,14 @@ gboolean grab_pointer(gboolean grab, ObCursor cur) ret = XGrabPointer(ob_display, screen_support_win, False, GRAB_PTR_MASK, GrabModeAsync, GrabModeAsync, None, - ob_cursor(cur), event_lasttime) == Success; + ob_cursor(cur), event_curtime) == Success; if (!ret) --pgrabs; } else ret = TRUE; } else if (pgrabs > 0) { if (--pgrabs == 0) { - XUngrabPointer(ob_display, event_lasttime); + XUngrabPointer(ob_display, event_curtime); } ret = TRUE; } @@ -100,14 +100,14 @@ gboolean grab_pointer_window(gboolean grab, ObCursor cur, Window win) ret = XGrabPointer(ob_display, win, False, GRAB_PTR_MASK, GrabModeAsync, GrabModeAsync, None, ob_cursor(cur), - event_lasttime) == Success; + event_curtime) == Success; if (!ret) --pgrabs; } else ret = TRUE; } else if (pgrabs > 0) { if (--pgrabs == 0) { - XUngrabPointer(ob_display, event_lasttime); + XUngrabPointer(ob_display, event_curtime); } ret = TRUE; } diff --git a/openbox/mainloop.c b/openbox/mainloop.c index 61c92705..26ba4f9b 100644 --- a/openbox/mainloop.c +++ b/openbox/mainloop.c @@ -418,7 +418,8 @@ static void sighandler(gint sig) /* XXX special case for signals that default to core dump. but throw some helpful output here... */ - fprintf(stderr, "Fuck yah. Core dump. (Signal=%d)\n", sig); + fprintf(stderr, "How are you gentlemen? All your base are" + " belong to us. (Signal=%d)\n", sig); /* die with a core dump */ abort(); diff --git a/openbox/menuframe.c b/openbox/menuframe.c index 3cda7780..fa0af530 100644 --- a/openbox/menuframe.c +++ b/openbox/menuframe.c @@ -251,6 +251,8 @@ static void menu_entry_frame_render(ObMenuEntryFrame *self) case OB_MENU_ENTRY_TYPE_SEPARATOR: th = SEPARATOR_HEIGHT + 2*PADDING; break; + default: + g_assert_not_reached(); } RECT_SET_SIZE(self->area, self->frame->inner_w, th); XResizeWindow(ob_display, self->window, diff --git a/openbox/mouse.c b/openbox/mouse.c index 8a390d9f..18f35d3c 100644 --- a/openbox/mouse.c +++ b/openbox/mouse.c @@ -200,7 +200,7 @@ void mouse_event(ObClient *client, XEvent *e) if (CLIENT_CONTEXT(context, client)) { /* Replay the event, so it goes to the client*/ - XAllowEvents(ob_display, ReplayPointer, event_lasttime); + XAllowEvents(ob_display, ReplayPointer, event_curtime); /* Fall through to the release case! */ } else break; diff --git a/openbox/place.c b/openbox/place.c index b56998b2..f9da5762 100644 --- a/openbox/place.c +++ b/openbox/place.c @@ -27,7 +27,8 @@ static Rect *pick_head(ObClient *c) { Rect *area = NULL; - gint i, px, py; + guint i; + gint px, py; /* try direct parent first */ if (c->transient_for && c->transient_for != OB_TRAN_GROUP) { @@ -220,7 +221,6 @@ typedef enum static gboolean place_smart(ObClient *client, gint *x, gint *y, ObSmartType type) { - guint i; gboolean ret = FALSE; GSList *spaces = NULL, *sit; GList *it; @@ -320,7 +320,6 @@ static gboolean place_smart(ObClient *client, gint *x, gint *y, static gboolean place_under_mouse(ObClient *client, gint *x, gint *y) { - guint i; gint l, r, t, b; gint px, py; Rect *area; |
