diff options
Diffstat (limited to 'openbox')
| -rw-r--r-- | openbox/client.c | 39 | ||||
| -rw-r--r-- | openbox/client_menu.c | 124 | ||||
| -rw-r--r-- | openbox/focus_cycle.c | 2 | ||||
| -rw-r--r-- | openbox/frame.c | 8 | ||||
| -rw-r--r-- | openbox/openbox.c | 3 | ||||
| -rw-r--r-- | openbox/screen.c | 24 |
6 files changed, 102 insertions, 98 deletions
diff --git a/openbox/client.c b/openbox/client.c index 67d2290a..bf1d4f9c 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -2796,8 +2796,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; @@ -3176,7 +3178,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) { @@ -3332,7 +3334,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; @@ -3344,13 +3353,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 */ @@ -3991,12 +4000,12 @@ static void detect_edge(Rect area, ObDirection dir, /* 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: @@ -4010,12 +4019,12 @@ static void detect_edge(Rect area, ObDirection dir, /* 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: @@ -4023,7 +4032,7 @@ static void detect_edge(Rect area, ObDirection dir, } ob_debug("my head %d size %d", my_head, my_size); - ob_debug("head %d tail %d deest %d", head, tail, *dest); + ob_debug("head %d tail %d dest %d", head, tail, *dest); if (!skip_head) { ob_debug("using near edge %d", head); *dest = head; @@ -4186,28 +4195,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; diff --git a/openbox/client_menu.c b/openbox/client_menu.c index 04f50e85..18f847ed 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); } diff --git a/openbox/focus_cycle.c b/openbox/focus_cycle.c index dbf79c9a..4d793777 100644 --- a/openbox/focus_cycle.c +++ b/openbox/focus_cycle.c @@ -72,7 +72,6 @@ ObClient* focus_cycle(gboolean forward, gboolean all_desktops, gboolean showbar, ObFocusCyclePopupMode mode, gboolean done, gboolean cancel) { - static ObClient *t = NULL; static GList *order = NULL; GList *it, *start, *list; ObClient *ft = NULL; @@ -149,7 +148,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; diff --git a/openbox/frame.c b/openbox/frame.c index e8a532cc..25c47048 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -98,7 +98,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(obt_display, obt_root(ob_screen), @@ -114,7 +114,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); } @@ -188,7 +188,7 @@ ObFrame *frame_new(ObClient *client) set_theme_statics(self); - return (ObFrame*)self; + return self; } static void set_theme_statics(ObFrame *self) @@ -1150,7 +1150,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/openbox.c b/openbox/openbox.c index 291b694b..49587abc 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -490,6 +490,9 @@ static void print_help(void) 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")); diff --git a/openbox/screen.c b/openbox/screen.c index 221e338d..60638a83 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -55,20 +55,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; @@ -330,7 +330,7 @@ static void screen_tell_ksplash(void) e.xclient.display = obt_display; e.xclient.window = obt_root(ob_screen); e.xclient.message_type = - XInternAtom(obt_display, "_KDE_SPLASH_PROGRESS", False ); + XInternAtom(obt_display, "_KDE_SPLASH_PROGRESS", False); e.xclient.format = 8; strcpy(e.xclient.data.b, "wm started"); XSendEvent(obt_display, obt_root(ob_screen), @@ -529,12 +529,13 @@ 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(); /* 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! */ @@ -784,6 +785,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) { |
