From d5a25283dceb4b0eb7f1dcba1ac15674f6422fbe Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Sat, 9 Feb 2008 11:43:26 +0100 Subject: Fix a minor issue with lastdesktop right after startup. --- openbox/screen.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'openbox') diff --git a/openbox/screen.c b/openbox/screen.c index da490778..5201f78a 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -620,10 +620,15 @@ void screen_set_desktop(guint num, gboolean dofocus) /* If screen_desktop_timeout is true, then we've been on this desktop long enough and we can save it as the last desktop. */ - /* save the "last desktop" as the "old desktop" */ - screen_old_desktop = screen_last_desktop; - /* save the desktop we're coming from as the "last desktop" */ - screen_last_desktop = previous; + if (screen_last_desktop == previous) + /* this is the startup state only */ + screen_old_desktop = screen_desktop; + else { + /* save the "last desktop" as the "old desktop" */ + screen_old_desktop = screen_last_desktop; + /* save the desktop we're coming from as the "last desktop" */ + screen_last_desktop = previous; + } } else { /* If screen_desktop_timeout is false, then we just got to this desktop -- cgit v1.2.3 From c907f5af4ad16b1b0ddcf9a17e1a196a079dd09a Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Fri, 8 Feb 2008 14:00:38 +0100 Subject: Wrap the focus action in actions_client_move. When alt-tabbing to iconified audacious and the playlist or eq window pops up under the cursor, they "stole" focus from the main window. --- openbox/actions/focus.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'openbox') diff --git a/openbox/actions/focus.c b/openbox/actions/focus.c index 67c1479f..0ef9d268 100644 --- a/openbox/actions/focus.c +++ b/openbox/actions/focus.c @@ -55,7 +55,9 @@ static gboolean run_func(ObActionsData *data, gpointer options) (data->context != OB_FRAME_CONTEXT_CLIENT && data->context != OB_FRAME_CONTEXT_FRAME)) { + actions_client_move(data, TRUE); client_activate(data->client, o->here, FALSE, FALSE, TRUE); + actions_client_move(data, FALSE); } } else if (data->context == OB_FRAME_CONTEXT_DESKTOP) { /* focus action on the root window. make keybindings work for this -- cgit v1.2.3 From 38bef0a38bf907a54c193ab063b4830788398edc Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sat, 9 Feb 2008 18:48:56 -0500 Subject: Make a pending ReplayPointer happen before moving/showing/hiding a window in an action. Commit c907f5af4ad16b1 broke kdesktop again, so we have to fix it at an even finer level. --- openbox/actions.c | 19 +------------------ openbox/client.c | 12 ++++++++++++ openbox/mouse.c | 30 +++++++++++++++++++++++------- openbox/mouse.h | 5 +++++ 4 files changed, 41 insertions(+), 25 deletions(-) (limited to 'openbox') diff --git a/openbox/actions.c b/openbox/actions.c index b7ba5b44..90a7719b 100644 --- a/openbox/actions.c +++ b/openbox/actions.c @@ -36,7 +36,6 @@ static ObActionsAct* actions_build_act_from_string(const gchar *name); static ObActionsAct *interactive_act = NULL; static guint interactive_initial_state = 0; -static gboolean replay_pointer = FALSE; struct _ObActionsDefinition { guint ref; @@ -224,16 +223,6 @@ static void actions_setup_data(ObActionsData *data, data->client = client; } -void actions_set_need_pointer_replay_before_move(gboolean replay) -{ - replay_pointer = replay; -} - -gboolean actions_get_need_pointer_replay_before_move() -{ - return replay_pointer; -} - void actions_run_acts(GSList *acts, ObUserAction uact, guint state, @@ -346,14 +335,8 @@ gboolean actions_interactive_input_event(XEvent *e) void actions_client_move(ObActionsData *data, gboolean start) { static gulong ignore_start = 0; - if (start) { + if (start) ignore_start = event_start_ignore_all_enters(); - if (replay_pointer) { - /* replay the pointer event before any windows move */ - XAllowEvents(ob_display, ReplayPointer, event_curtime); - replay_pointer = FALSE; - } - } else if (config_focus_follow && data->context != OB_FRAME_CONTEXT_CLIENT) { diff --git a/openbox/client.c b/openbox/client.c index e7290ca5..43a2f551 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -2572,6 +2572,10 @@ gboolean client_show(ObClient *self) gboolean show = FALSE; if (client_should_show(self)) { + /* replay pending pointer event before showing the window, in case it + should be going to something under the window */ + mouse_replay_pointer(); + frame_show(self->frame); show = TRUE; @@ -2613,6 +2617,10 @@ gboolean client_hide(ObClient *self) so trying to ignore them is futile in case 3 anyways */ + /* replay pending pointer event before hiding the window, in case it + should be going to the window */ + mouse_replay_pointer(); + frame_hide(self->frame); hide = TRUE; @@ -3028,6 +3036,10 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h, if (!user) ignore_start = event_start_ignore_all_enters(); + /* replay pending pointer event before move the window, in case it + would change what window gets the event */ + mouse_replay_pointer(); + frame_adjust_area(self->frame, fmoved, fresized, FALSE); if (!user) diff --git a/openbox/mouse.c b/openbox/mouse.c index 711317ec..6d532518 100644 --- a/openbox/mouse.c +++ b/openbox/mouse.c @@ -46,6 +46,9 @@ typedef struct { /* Array of GSList*s of ObMouseBinding*s. */ static GSList *bound_contexts[OB_FRAME_NUM_CONTEXTS]; +/* TRUE when we have a grab on the pointer and need to reply the pointer event + to send it to other applications */ +static gboolean replay_pointer_needed; ObFrameContext mouse_button_frame_context(ObFrameContext context, guint button, @@ -200,6 +203,15 @@ static gboolean fire_binding(ObMouseAction a, ObFrameContext context, return TRUE; } +void mouse_replay_pointer() +{ + if (replay_pointer_needed) { + /* replay the pointer event before any windows move */ + XAllowEvents(ob_display, ReplayPointer, event_curtime); + replay_pointer_needed = FALSE; + } +} + void mouse_event(ObClient *client, XEvent *e) { static Time ltime; @@ -229,12 +241,17 @@ void mouse_event(ObClient *client, XEvent *e) XAllowEvents with ReplayPointer at some point, to send the event through to the client. when this happens though depends. if windows are going to be moved on screen, then the click will end - up going somewhere wrong, so have the action system perform the - ReplayPointer for us if that is the case. */ + up going somewhere wrong, set that we need it, and if nothing + else causes the replay pointer to be run, then we will do it + after all the actions are finished. + + (We do it after all the actions because FocusIn interrupts + dragging for kdesktop, so if we send the button event now, and + then they get a focus event after, it breaks. Instead, wait to send + the button press until after the actions when possible.) + */ if (CLIENT_CONTEXT(context, client)) - actions_set_need_pointer_replay_before_move(TRUE); - else - actions_set_need_pointer_replay_before_move(FALSE); + replay_pointer_needed = TRUE; fire_binding(OB_MOUSE_ACTION_PRESS, context, client, e->xbutton.state, @@ -248,8 +265,7 @@ void mouse_event(ObClient *client, XEvent *e) /* replay the pointer event if it hasn't been replayed yet (i.e. no windows were moved) */ - if (actions_get_need_pointer_replay_before_move()) - XAllowEvents(ob_display, ReplayPointer, event_curtime); + mouse_replay_pointer(); /* in the client context, we won't get a button release because of the way it is grabbed, so just fake one */ diff --git a/openbox/mouse.h b/openbox/mouse.h index 44d563a3..a862fe5b 100644 --- a/openbox/mouse.h +++ b/openbox/mouse.h @@ -40,4 +40,9 @@ void mouse_grab_for_client(struct _ObClient *client, gboolean grab); ObFrameContext mouse_button_frame_context(ObFrameContext context, guint button, guint state); +/*! If a replay pointer is needed, then do it. Call this when windows are + going to be moving/appearing/disappearing, so that you know the mouse click + will go to the right window */ +void mouse_replay_pointer(); + #endif -- cgit v1.2.3 From 83c739df9117cde1982a1fec4487ea1a3eb6ebf0 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Sun, 10 Feb 2008 07:54:21 +0100 Subject: typo in comment --- openbox/mouse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openbox') diff --git a/openbox/mouse.c b/openbox/mouse.c index 6d532518..f2e13cdf 100644 --- a/openbox/mouse.c +++ b/openbox/mouse.c @@ -46,7 +46,7 @@ typedef struct { /* Array of GSList*s of ObMouseBinding*s. */ static GSList *bound_contexts[OB_FRAME_NUM_CONTEXTS]; -/* TRUE when we have a grab on the pointer and need to reply the pointer event +/* TRUE when we have a grab on the pointer and need to replay the pointer event to send it to other applications */ static gboolean replay_pointer_needed; -- cgit v1.2.3 From 91a1b089097cb3ba66f779df80fa7a51490aa785 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 10 Feb 2008 18:30:07 -0500 Subject: force the resize popup to be on-screen (not negative position) --- openbox/config.c | 5 +++++ openbox/geom.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'openbox') diff --git a/openbox/config.c b/openbox/config.c index 673af4bd..e1954a79 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -675,6 +675,11 @@ static void parse_resize(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, if ((n2 = parse_find_node("y", n->children))) config_parse_gravity_coord(doc, n2, &config_resize_popup_fixed.y); + + config_resize_popup_fixed.x.pos = + MAX(config_resize_popup_fixed.x.pos, 0); + config_resize_popup_fixed.y.pos = + MAX(config_resize_popup_fixed.y.pos, 0); } } } diff --git a/openbox/geom.h b/openbox/geom.h index bdcd3c55..7c5ee32e 100644 --- a/openbox/geom.h +++ b/openbox/geom.h @@ -23,7 +23,7 @@ #include typedef struct _GravityCoord { - int pos; + gint pos; gboolean center; gboolean opposite; } GravityCoord; -- cgit v1.2.3 From 8186a81fe0095a46c2a65e252268f19d5798095a Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 11 Feb 2008 22:10:21 -0500 Subject: split menu overlap into x and y components --- openbox/menuframe.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'openbox') diff --git a/openbox/menuframe.c b/openbox/menuframe.c index fb9b6c5b..3bbf1be2 100644 --- a/openbox/menuframe.c +++ b/openbox/menuframe.c @@ -249,23 +249,24 @@ static void menu_frame_place_topmenu(ObMenuFrame *self, gint *x, gint *y) static void menu_frame_place_submenu(ObMenuFrame *self, gint *x, gint *y) { - gint overlap; + gint overlapx, overlapy; gint bwidth; - overlap = ob_rr_theme->menu_overlap; + overlapx = ob_rr_theme->menu_overlap_x; + overlapy = ob_rr_theme->menu_overlap_y; bwidth = ob_rr_theme->mbwidth; if (self->direction_right) *x = self->parent->area.x + self->parent->area.width - - overlap - bwidth; + overlapx - bwidth; else - *x = self->parent->area.x - self->area.width + overlap + bwidth; + *x = self->parent->area.x - self->area.width + overlapx + bwidth; *y = self->parent->area.y + self->parent_entry->area.y; if (config_menu_middle) *y -= (self->area.height - (bwidth * 2) - ITEM_HEIGHT) / 2; else - *y += overlap; + *y += overlapy; } void menu_frame_move_on_screen(ObMenuFrame *self, gint x, gint y, -- cgit v1.2.3 From c0333e9452330c6b7b44aa81bbccc7460fd50e14 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 11 Feb 2008 22:11:46 -0500 Subject: _net_active_window shouldn't change desktop, is the general policy concensus. --- openbox/event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openbox') diff --git a/openbox/event.c b/openbox/event.c index 7e2766f0..1b3c1c23 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1355,7 +1355,7 @@ static void event_handle_client(ObClient *client, XEvent *e) ob_debug_type(OB_DEBUG_APP_BUGS, "_NET_ACTIVE_WINDOW message for window %s is " "missing source indication\n"); - client_activate(client, FALSE, TRUE, TRUE, + client_activate(client, TRUE, TRUE, TRUE, (e->xclient.data.l[0] == 0 || e->xclient.data.l[0] == 2)); } else if (msgtype == prop_atoms.net_wm_moveresize) { -- cgit v1.2.3 From 619fd7e666944aa83c636d14cd2777cbd5dc1094 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Wed, 13 Feb 2008 10:19:52 -0500 Subject: don't force fake enter events while there is a grab on the pointer. this fixes focus switching during a move/resize from mouse-button-bound actions. --- openbox/actions.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'openbox') diff --git a/openbox/actions.c b/openbox/actions.c index 90a7719b..32b3d274 100644 --- a/openbox/actions.c +++ b/openbox/actions.c @@ -347,8 +347,14 @@ void actions_client_move(ObActionsData *data, gboolean start) that moves windows our from under the cursor, the enter event will come as a GrabNotify which is ignored, so this makes a fake enter event + + don't do this if there is a grab on the pointer. enter events + are ignored during a grab, so don't force fake ones when they + should be ignored */ - if ((c = client_under_pointer()) && c != data->client) { + if ((c = client_under_pointer()) && c != data->client && + !grab_on_pointer()) + { ob_debug_type(OB_DEBUG_FOCUS, "Generating fake enter because we did a " "mouse-event action"); -- cgit v1.2.3 From 27177e498b737cc351ce446f0b89010bcf29bfcd Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Wed, 13 Feb 2008 20:53:25 -0500 Subject: let you match per-app settings based on the window type --- openbox/client.c | 6 ++++-- openbox/config.c | 28 +++++++++++++++++++++++++--- openbox/config.h | 2 ++ 3 files changed, 31 insertions(+), 5 deletions(-) (limited to 'openbox') diff --git a/openbox/client.c b/openbox/client.c index 43a2f551..371eb087 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -844,13 +844,15 @@ static ObAppSettings *client_get_settings_state(ObClient *self) !g_pattern_match(app->name, strlen(self->name), self->name, NULL)) match = FALSE; else if (app->class && - !g_pattern_match(app->class, - strlen(self->class), self->class, NULL)) + !g_pattern_match(app->class, + strlen(self->class), self->class, NULL)) match = FALSE; else if (app->role && !g_pattern_match(app->role, strlen(self->role), self->role, NULL)) match = FALSE; + else if ((signed)app->type >= 0 && app->type != self->type) + match = FALSE; if (match) { ob_debug("Window matching: %s\n", app->name); diff --git a/openbox/config.c b/openbox/config.c index e1954a79..c82e3b3a 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -101,6 +101,7 @@ GSList *config_per_app_settings; ObAppSettings* config_create_app_settings(void) { ObAppSettings *settings = g_new0(ObAppSettings, 1); + settings->type = -1; settings->decor = -1; settings->shade = -1; settings->monitor = -1; @@ -124,6 +125,7 @@ void config_app_settings_copy_non_defaults(const ObAppSettings *src, g_assert(src != NULL); g_assert(dst != NULL); + copy_if(type, -1); copy_if(decor, -1); copy_if(shade, -1); copy_if(focus, -1); @@ -193,15 +195,16 @@ static void parse_per_app_settings(ObParseInst *inst, xmlDocPtr doc, xmlNodePtr node, gpointer data) { xmlNodePtr app = parse_find_node("application", node->children); - gchar *name = NULL, *class = NULL, *role = NULL; - gboolean name_set, class_set; + gchar *name = NULL, *class = NULL, *role = NULL, *type = NULL; + gboolean name_set, class_set, type_set; gboolean x_pos_given; while (app) { - name_set = class_set = x_pos_given = FALSE; + name_set = class_set = type_set = x_pos_given = FALSE; class_set = parse_attr_string("class", app, &class); name_set = parse_attr_string("name", app, &name); + type_set = parse_attr_string("type", app, &type); if (class_set || name_set) { xmlNodePtr n, c; ObAppSettings *settings = config_create_app_settings();; @@ -212,6 +215,25 @@ static void parse_per_app_settings(ObParseInst *inst, xmlDocPtr doc, if (class_set) settings->class = g_pattern_spec_new(class); + if (type_set) { + if (!g_ascii_strcasecmp(type, "normal")) + settings->type = OB_CLIENT_TYPE_NORMAL; + else if (!g_ascii_strcasecmp(type, "dialog")) + settings->type = OB_CLIENT_TYPE_DIALOG; + else if (!g_ascii_strcasecmp(type, "splash")) + settings->type = OB_CLIENT_TYPE_SPLASH; + else if (!g_ascii_strcasecmp(type, "utility")) + settings->type = OB_CLIENT_TYPE_UTILITY; + else if (!g_ascii_strcasecmp(type, "menu")) + settings->type = OB_CLIENT_TYPE_MENU; + else if (!g_ascii_strcasecmp(type, "toolbar")) + settings->type = OB_CLIENT_TYPE_TOOLBAR; + else if (!g_ascii_strcasecmp(type, "dock")) + settings->type = OB_CLIENT_TYPE_DOCK; + else if (!g_ascii_strcasecmp(type, "desktop")) + settings->type = OB_CLIENT_TYPE_DESKTOP; + } + if (parse_attr_string("role", app, &role)) settings->role = g_pattern_spec_new(role); diff --git a/openbox/config.h b/openbox/config.h index 3fd1b879..62b92473 100644 --- a/openbox/config.h +++ b/openbox/config.h @@ -23,6 +23,7 @@ #include "misc.h" #include "stacking.h" #include "place.h" +#include "client.h" #include "geom.h" #include "moveresize.h" #include "render/render.h" @@ -38,6 +39,7 @@ struct _ObAppSettings GPatternSpec *class; GPatternSpec *name; GPatternSpec *role; + ObClientType type; GravityPoint position; gboolean pos_given; -- cgit v1.2.3