From dbbbbb7d48a03910554ab933ef71eb0e10f7a8e7 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Wed, 27 Feb 2008 23:11:08 -0500 Subject: When showing a window's title in the kill prompt, if it doesn't have a title use its parent's (same way the focus cycle popup does) --- openbox/client.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'openbox') diff --git a/openbox/client.c b/openbox/client.c index 20a4dffc..39a54820 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -3410,7 +3410,14 @@ static void client_prompt_kill(ObClient *self) { 0, OB_KILL_RESULT_YES } }; gchar *m; - const gchar *y; + const gchar *y, *title; + + title = self->original_title; + if (title[0] == '\0') { + /* empty string, so use its parent */ + ObClient *p = client_search_top_direct_parent(self); + if (p) title = p->original_title; + } if (client_on_localhost(self)) { const gchar *sig; @@ -3422,13 +3429,13 @@ static void client_prompt_kill(ObClient *self) m = g_strdup_printf (_("The window \"%s\" does not seem to be responding. Do you want to force it to exit by sending the %s signal?"), - self->original_title, sig); + title, sig); y = _("End Process"); } else { m = g_strdup_printf (_("The window \"%s\" does not seem to be responding. Do you want to disconnect it from the X server?"), - self->original_title); + title); y = _("Disconnect"); } /* set the dialog buttons' text */ -- cgit v1.2.3 From ff0f8dc6a965ed5bcb70430ec4e1ebd68607a614 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Thu, 28 Feb 2008 01:20:20 -0500 Subject: fix some off-by-one errors in edge finding for moving and resizing windows (bug 3506) --- openbox/client.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'openbox') diff --git a/openbox/client.c b/openbox/client.c index 39a54820..8fb10bb9 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -4107,17 +4107,17 @@ static void detect_edge(Rect area, ObDirection dir, if (my_head <= head + 1) skip_head = TRUE; /* check if our window's tail is past the tail of this window */ - if (my_head + my_size - 1 <= tail) + if (my_head + my_size - 1 < tail) skip_tail = TRUE; /* check if the head of this window is closer than the previously chosen edge (take into account that the previously chosen edge might have been a tail, not a head) */ - if (head + (*near_edge ? 0 : my_size) < *dest) + if (head + (*near_edge ? 0 : my_size) <= *dest) skip_head = TRUE; /* check if the tail of this window is closer than the previously chosen edge (take into account that the previously chosen edge might have been a head, not a tail) */ - if (tail - (!*near_edge ? 0 : my_size) < *dest) + if (tail - (!*near_edge ? 0 : my_size) <= *dest) skip_tail = TRUE; break; case OB_DIRECTION_SOUTH: @@ -4126,17 +4126,17 @@ static void detect_edge(Rect area, ObDirection dir, if (my_head >= head - 1) skip_head = TRUE; /* check if our window's tail is past the tail of this window */ - if (my_head - my_size + 1 >= tail) + if (my_head - my_size + 1 > tail) skip_tail = TRUE; /* check if the head of this window is closer than the previously chosen edge (take into account that the previously chosen edge might have been a tail, not a head) */ - if (head - (*near_edge ? 0 : my_size) > *dest) + if (head - (*near_edge ? 0 : my_size) >= *dest) skip_head = TRUE; /* check if the tail of this window is closer than the previously chosen edge (take into account that the previously chosen edge might have been a head, not a tail) */ - if (tail + (!*near_edge ? 0 : my_size) > *dest) + if (tail + (!*near_edge ? 0 : my_size) >= *dest) skip_tail = TRUE; break; default: @@ -4144,7 +4144,7 @@ static void detect_edge(Rect area, ObDirection dir, } ob_debug("my head %d size %d\n", my_head, my_size); - ob_debug("head %d tail %d deest %d\n", head, tail, *dest); + ob_debug("head %d tail %d dest %d\n", head, tail, *dest); if (!skip_head) { ob_debug("using near edge %d\n", head); *dest = head; -- cgit v1.2.3 From 2f1dc6da006adb7ffac7ec8ddd8c2c8188aed777 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Thu, 28 Feb 2008 12:42:40 +0100 Subject: Try to fix the off-by-one errors even more. --- openbox/client.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'openbox') diff --git a/openbox/client.c b/openbox/client.c index 8fb10bb9..02008de9 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -4107,7 +4107,7 @@ static void detect_edge(Rect area, ObDirection dir, if (my_head <= head + 1) skip_head = TRUE; /* check if our window's tail is past the tail of this window */ - if (my_head + my_size - 1 < tail) + if (my_head + my_size - 1 <= tail) skip_tail = TRUE; /* check if the head of this window is closer than the previously chosen edge (take into account that the previously chosen @@ -4126,7 +4126,7 @@ static void detect_edge(Rect area, ObDirection dir, if (my_head >= head - 1) skip_head = TRUE; /* check if our window's tail is past the tail of this window */ - if (my_head - my_size + 1 > tail) + if (my_head - my_size + 1 >= tail) skip_tail = TRUE; /* check if the head of this window is closer than the previously chosen edge (take into account that the previously chosen @@ -4307,28 +4307,28 @@ void client_find_resize_directional(ObClient *self, ObDirection side, switch (side) { case OB_DIRECTION_EAST: head = RECT_RIGHT(self->frame->area) + - (self->size_inc.width - 1) * (grow ? 1 : -1); + (self->size_inc.width - 1) * (grow ? 1 : 0); e_start = RECT_TOP(self->frame->area); e_size = self->frame->area.height; dir = grow ? OB_DIRECTION_EAST : OB_DIRECTION_WEST; break; case OB_DIRECTION_WEST: head = RECT_LEFT(self->frame->area) - - (self->size_inc.width - 1) * (grow ? 1 : -1); + (self->size_inc.width - 1) * (grow ? 1 : 0); e_start = RECT_TOP(self->frame->area); e_size = self->frame->area.height; dir = grow ? OB_DIRECTION_WEST : OB_DIRECTION_EAST; break; case OB_DIRECTION_NORTH: head = RECT_TOP(self->frame->area) - - (self->size_inc.height - 1) * (grow ? 1 : -1); + (self->size_inc.height - 1) * (grow ? 1 : 0); e_start = RECT_LEFT(self->frame->area); e_size = self->frame->area.width; dir = grow ? OB_DIRECTION_NORTH : OB_DIRECTION_SOUTH; break; case OB_DIRECTION_SOUTH: head = RECT_BOTTOM(self->frame->area) + - (self->size_inc.height - 1) * (grow ? 1 : -1); + (self->size_inc.height - 1) * (grow ? 1 : 0); e_start = RECT_LEFT(self->frame->area); e_size = self->frame->area.width; dir = grow ? OB_DIRECTION_SOUTH : OB_DIRECTION_NORTH; -- cgit v1.2.3 From 7a6485e4bb4ceb88f6279d4bce054c1aa30d45dd Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Thu, 28 Feb 2008 17:54:49 +0100 Subject: Update send-to-desktop menu in the client menu when ctrl-clicking and the client is still visible, ie toggling omnipresent. Also indicates which is the current desktop by moving the omnipresent icon to it when the window is omnipresent. Do some refactoring and cleanup so the net change is removal of lines, go me. --- openbox/client_menu.c | 124 +++++++++++++++++++++++--------------------------- 1 file changed, 58 insertions(+), 66 deletions(-) (limited to 'openbox') diff --git a/openbox/client_menu.c b/openbox/client_menu.c index f35b5bd3..6c3147ae 100644 --- a/openbox/client_menu.c +++ b/openbox/client_menu.c @@ -37,9 +37,9 @@ #define LAYER_MENU_NAME "client-layer-menu" enum { - LAYER_TOP, - LAYER_NORMAL, - LAYER_BOTTOM + LAYER_TOP = 1, + LAYER_NORMAL = 0, + LAYER_BOTTOM = -1 }; enum { @@ -55,6 +55,15 @@ enum { CLIENT_CLOSE }; +static void set_icon_color(ObMenuEntry *e) +{ + e->data.normal.mask_normal_color = ob_rr_theme->menu_color; + e->data.normal.mask_selected_color = ob_rr_theme->menu_selected_color; + e->data.normal.mask_disabled_color = ob_rr_theme->menu_disabled_color; + e->data.normal.mask_disabled_selected_color = + ob_rr_theme->menu_disabled_selected_color; +} + static gboolean client_menu_update(ObMenuFrame *frame, gpointer data) { ObMenu *menu = frame->menu; @@ -211,19 +220,7 @@ static void layer_menu_execute(ObMenuEntry *e, ObMenuFrame *f, if (!config_focus_under_mouse) ignore_start = event_start_ignore_all_enters(); - switch (e->id) { - case LAYER_TOP: - client_set_layer(c, 1); - break; - case LAYER_NORMAL: - client_set_layer(c, 0); - break; - case LAYER_BOTTOM: - client_set_layer(c, -1); - break; - default: - g_assert_not_reached(); - } + client_set_layer(c, e->id); if (!config_focus_under_mouse) event_end_ignore_all_enters(ignore_start); @@ -238,44 +235,52 @@ static void layer_menu_execute(ObMenuEntry *e, ObMenuFrame *f, static gboolean send_to_menu_update(ObMenuFrame *frame, gpointer data) { ObMenu *menu = frame->menu; + ObClient *c = frame->client; guint i; ObMenuEntry *e; + GList *it; - menu_clear_entries(menu); - - if (frame->client == NULL || !client_normal(frame->client)) + if (c == NULL || !client_normal(c)) return FALSE; /* don't show the menu */ - for (i = 0; i <= screen_num_desktops; ++i) { - const gchar *name; - guint desk; + if (!data) + menu_clear_entries(menu); - if (i >= screen_num_desktops) { - menu_add_separator(menu, -1, NULL); + if (!menu->entries) { + for (i = 0; i <= screen_num_desktops; ++i) { + const gchar *name; + guint desk; - desk = DESKTOP_ALL; - name = _("All desktops"); - } else { - desk = i; - name = screen_desktop_names[i]; - } + if (i == screen_num_desktops) { + menu_add_separator(menu, -1, NULL); - e = menu_add_normal(menu, desk, name, NULL, FALSE); - e->id = desk; - if (desk == DESKTOP_ALL) { - e->data.normal.mask = ob_rr_theme->desk_mask; - e->data.normal.mask_normal_color = ob_rr_theme->menu_color; - e->data.normal.mask_selected_color = - ob_rr_theme->menu_selected_color; - e->data.normal.mask_disabled_color = - ob_rr_theme->menu_disabled_color; - e->data.normal.mask_disabled_selected_color = - ob_rr_theme->menu_disabled_selected_color; + desk = DESKTOP_ALL; + name = _("All desktops"); + } else { + desk = i; + name = screen_desktop_names[i]; + } + + e = menu_add_normal(menu, desk, name, NULL, FALSE); + e->id = desk; } + } + + for (it = menu->entries; it; it = g_list_next(it)) { + ObMenuEntry *e = it->data; + guint desk = e->id; - if (frame->client->desktop == desk) - e->data.normal.enabled = FALSE; + e->data.normal.enabled = c->desktop != desk; + + if ((desk == DESKTOP_ALL && c->desktop != DESKTOP_ALL) || + (c->desktop == DESKTOP_ALL && desk == screen_desktop)) + { + e->data.normal.mask = ob_rr_theme->desk_mask; + set_icon_color(e); + } else + e->data.normal.mask = NULL; } + return TRUE; /* show the menu */ } @@ -285,9 +290,13 @@ static void send_to_menu_execute(ObMenuEntry *e, ObMenuFrame *f, g_assert(c); client_set_desktop(c, e->id, FALSE, FALSE); - /* the client won't even be on the screen anymore, so hide the menu */ - if (f) + if (f && c->desktop != screen_desktop && c->desktop != DESKTOP_ALL) + /* the client won't even be on the screen anymore, so hide the menu */ menu_frame_hide_all(); + else if (f) { + send_to_menu_update(f, (gpointer)1); + menu_frame_render(f); + } } static void client_menu_place(ObMenuFrame *frame, gint *x, gint *y, @@ -367,7 +376,6 @@ void client_menu_startup(void) menu_add_normal(menu, LAYER_NORMAL, _("_Normal"), NULL, TRUE); menu_add_normal(menu, LAYER_BOTTOM, _("Always on _bottom"),NULL, TRUE); - menu = menu_new(SEND_TO_MENU_NAME, _("_Send to desktop"), TRUE, NULL); menu_set_update_func(menu, send_to_menu_update); menu_set_execute_func(menu, send_to_menu_execute); @@ -384,11 +392,7 @@ void client_menu_startup(void) e = menu_add_normal(menu, CLIENT_RESTORE, _("R_estore"), NULL, TRUE); e->data.normal.mask = ob_rr_theme->max_toggled_mask; - e->data.normal.mask_normal_color = ob_rr_theme->menu_color; - e->data.normal.mask_selected_color = ob_rr_theme->menu_selected_color; - e->data.normal.mask_disabled_color = ob_rr_theme->menu_disabled_color; - e->data.normal.mask_disabled_selected_color = - ob_rr_theme->menu_disabled_selected_color; + set_icon_color(e); menu_add_normal(menu, CLIENT_MOVE, _("_Move"), NULL, TRUE); @@ -396,19 +400,11 @@ void client_menu_startup(void) e = menu_add_normal(menu, CLIENT_ICONIFY, _("Ico_nify"), NULL, TRUE); e->data.normal.mask = ob_rr_theme->iconify_mask; - e->data.normal.mask_normal_color = ob_rr_theme->menu_color; - e->data.normal.mask_selected_color = ob_rr_theme->menu_selected_color; - e->data.normal.mask_disabled_color = ob_rr_theme->menu_disabled_color; - e->data.normal.mask_disabled_selected_color = - ob_rr_theme->menu_disabled_selected_color; + set_icon_color(e); e = menu_add_normal(menu, CLIENT_MAXIMIZE, _("Ma_ximize"), NULL, TRUE); e->data.normal.mask = ob_rr_theme->max_mask; - e->data.normal.mask_normal_color = ob_rr_theme->menu_color; - e->data.normal.mask_selected_color = ob_rr_theme->menu_selected_color; - e->data.normal.mask_disabled_color = ob_rr_theme->menu_disabled_color; - e->data.normal.mask_disabled_selected_color = - ob_rr_theme->menu_disabled_selected_color; + set_icon_color(e); menu_add_normal(menu, CLIENT_SHADE, _("_Roll up/down"), NULL, TRUE); @@ -418,9 +414,5 @@ void client_menu_startup(void) e = menu_add_normal(menu, CLIENT_CLOSE, _("_Close"), NULL, TRUE); e->data.normal.mask = ob_rr_theme->close_mask; - e->data.normal.mask_normal_color = ob_rr_theme->menu_color; - e->data.normal.mask_selected_color = ob_rr_theme->menu_selected_color; - e->data.normal.mask_disabled_color = ob_rr_theme->menu_disabled_color; - e->data.normal.mask_disabled_selected_color = - ob_rr_theme->menu_disabled_selected_color; + set_icon_color(e); } -- cgit v1.2.3 From a4a1a667fc341b1fb2c420b6b699a9074fefbdad Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Thu, 28 Feb 2008 10:00:29 -0500 Subject: If a window is maximized and has FUNC_MAXIMIZE disabled, still let it unmaximize. When normal hints change and we reconfigure, the w/h of the window may not have changed - rather the minw/maxh etc may have changed. So in client_try_configure always run through the code that checks them to see if the client should be resized or whatever. --- openbox/client.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'openbox') diff --git a/openbox/client.c b/openbox/client.c index 02008de9..816fa922 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -2874,8 +2874,10 @@ void client_try_configure(ObClient *self, gint *x, gint *y, gint *w, gint *h, /* gets the client's position */ frame_frame_gravity(self->frame, x, y); - /* work within the preferred sizes given by the window */ - if (!(*w == self->area.width && *h == self->area.height)) { + /* work within the preferred sizes given by the window, these may have + changed rather than it's requested width and height, so always run + through this code */ + { gint basew, baseh, minw, minh; gint incw, inch; gfloat minratio, maxratio; @@ -3254,7 +3256,7 @@ void client_maximize(ObClient *self, gboolean max, gint dir) gint x, y, w, h; g_assert(dir == 0 || dir == 1 || dir == 2); - if (!(self->functions & OB_CLIENT_FUNC_MAXIMIZE)) return; /* can't */ + if (!(self->functions & OB_CLIENT_FUNC_MAXIMIZE) && max) return;/* can't */ /* check if already done */ if (max) { -- cgit v1.2.3 From 017d9564440d5b8b5cc03ad6c1e17e37d29ec74b Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Thu, 28 Feb 2008 20:40:52 +0100 Subject: Free copied glists when removing desktops. --- openbox/screen.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'openbox') diff --git a/openbox/screen.c b/openbox/screen.c index 346b50c3..f9b0b303 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -542,6 +542,7 @@ void screen_set_num_desktops(guint num) stacking_raise(CLIENT_AS_WINDOW(c)); } } + g_list_free(stacking_copy); /* change our struts/area to match (after moving windows) */ screen_update_areas(); @@ -798,6 +799,7 @@ void screen_remove_desktop(gboolean current) } } } + g_list_free(stacking_copy); /* fallback focus like we're changing desktops */ if (screen_desktop < screen_num_desktops - 1) { -- cgit v1.2.3 From 323df7cbc2052e27d10da334faed93bd3f2ec7a3 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Thu, 28 Feb 2008 20:57:33 +0100 Subject: Very inconsequential changes. --- openbox/frame.c | 8 ++++---- openbox/screen.c | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'openbox') diff --git a/openbox/frame.c b/openbox/frame.c index 3304f4b5..0b764a4c 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -99,7 +99,7 @@ ObFrame *frame_new(ObClient *client) mask = 0; if (visual) { /* client has a 32-bit visual */ - mask |= CWColormap | CWBackPixel | CWBorderPixel; + mask = CWColormap | CWBackPixel | CWBorderPixel; /* create a colormap with the visual */ self->colormap = attrib.colormap = XCreateColormap(ob_display, @@ -116,7 +116,7 @@ ObFrame *frame_new(ObClient *client) mask = 0; if (visual) { /* client has a 32-bit visual */ - mask |= CWColormap | CWBackPixel | CWBorderPixel; + mask = CWColormap | CWBackPixel | CWBorderPixel; attrib.colormap = RrColormap(ob_rr_inst); } @@ -190,7 +190,7 @@ ObFrame *frame_new(ObClient *client) set_theme_statics(self); - return (ObFrame*)self; + return self; } static void set_theme_statics(ObFrame *self) @@ -1154,7 +1154,7 @@ static void layout_title(ObFrame *self) self->label_width = self->width - (ob_rr_theme->paddingx + 1) * 2; self->leftmost = self->rightmost = OB_FRAME_CONTEXT_NONE; - /* figure out what's being show, find each element's position, and the + /* figure out what's being shown, find each element's position, and the width of the label do the ones before the label, then after the label, diff --git a/openbox/screen.c b/openbox/screen.c index f9b0b303..2e48f85c 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -56,20 +56,20 @@ static gboolean replace_wm(void); static void screen_tell_ksplash(void); static void screen_fallback_focus(void); -guint screen_num_desktops; -guint screen_num_monitors; -guint screen_desktop; -guint screen_last_desktop; -gboolean screen_showing_desktop; +guint screen_num_desktops; +guint screen_num_monitors; +guint screen_desktop; +guint screen_last_desktop; +gboolean screen_showing_desktop; ObDesktopLayout screen_desktop_layout; -gchar **screen_desktop_names; -Window screen_support_win; -Time screen_desktop_user_time = CurrentTime; +gchar **screen_desktop_names; +Window screen_support_win; +Time screen_desktop_user_time = CurrentTime; static Size screen_physical_size; static guint screen_old_desktop; static gboolean screen_desktop_timeout = TRUE; -/*! An array of desktops, holding array of areas per monitor */ +/*! An array of desktops, holding an array of areas per monitor */ static Rect *monitor_area = NULL; /*! An array of desktops, holding an array of struts */ static GSList *struts_top = NULL; @@ -340,7 +340,7 @@ static void screen_tell_ksplash(void) e.xclient.display = ob_display; e.xclient.window = RootWindow(ob_display, ob_screen); e.xclient.message_type = - XInternAtom(ob_display, "_KDE_SPLASH_PROGRESS", False ); + XInternAtom(ob_display, "_KDE_SPLASH_PROGRESS", False); e.xclient.format = 8; strcpy(e.xclient.data.b, "wm started"); XSendEvent(ob_display, RootWindow(ob_display, ob_screen), @@ -548,7 +548,7 @@ void screen_set_num_desktops(guint num) screen_update_areas(); /* may be some unnamed desktops that we need to fill in with names - (after updating the areas so the popup can resize) */ + (after updating the areas so the popup can resize) */ screen_update_desktop_names(); /* change our desktop if we're on one that no longer exists! */ -- cgit v1.2.3 From ab089515eff792ba893d2e2fdd29e9b76f15b26e Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Thu, 28 Feb 2008 22:37:18 +0100 Subject: Update po/ with new strings, and update swedish translation. Also add an overly long comment about translating FILE in the help output. --- openbox/openbox.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'openbox') diff --git a/openbox/openbox.c b/openbox/openbox.c index 6233ec98..fb1e75d0 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -511,6 +511,9 @@ static void print_help() g_print(_(" --help Display this help and exit\n")); g_print(_(" --version Display the version and exit\n")); g_print(_(" --replace Replace the currently running window manager\n")); + /* TRANSLATORS: if you translate "FILE" here, make sure to keep the "Specify..." + aligned still, if you have to, make a new line with \n and 22 spaces. It's + fine to leave it as FILE though. */ g_print(_(" --config-file FILE Specify the path to the config file to use\n")); g_print(_(" --sm-disable Disable connection to the session manager\n")); g_print(_("\nPassing messages to a running Openbox instance:\n")); -- cgit v1.2.3 From 835b2de913cddcf545246d88a8a4e5d7d0028f8a Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Fri, 29 Feb 2008 03:18:12 +0100 Subject: Remove an unused variable. --- openbox/focus_cycle.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'openbox') diff --git a/openbox/focus_cycle.c b/openbox/focus_cycle.c index 2348f8d0..c7fc42ee 100644 --- a/openbox/focus_cycle.c +++ b/openbox/focus_cycle.c @@ -73,7 +73,6 @@ ObClient* focus_cycle(gboolean forward, gboolean all_desktops, gboolean showbar, gboolean dialog, gboolean done, gboolean cancel) { - static ObClient *t = NULL; static GList *order = NULL; GList *it, *start, *list; ObClient *ft = NULL; @@ -150,7 +149,6 @@ ObClient* focus_cycle(gboolean forward, gboolean all_desktops, done_cycle: if (done && !cancel) ret = focus_cycle_target; - t = NULL; focus_cycle_target = NULL; g_list_free(order); order = NULL; -- cgit v1.2.3