diff options
Diffstat (limited to 'openbox')
| -rw-r--r-- | openbox/actions/desktop.c | 30 | ||||
| -rw-r--r-- | openbox/actions/moveresizeto.c | 11 | ||||
| -rw-r--r-- | openbox/client.c | 36 | ||||
| -rw-r--r-- | openbox/event.c | 2 | ||||
| -rw-r--r-- | openbox/frame.c | 3 | ||||
| -rw-r--r-- | openbox/menu.c | 11 | ||||
| -rw-r--r-- | openbox/popup.c | 2 | ||||
| -rw-r--r-- | openbox/screen.c | 135 | ||||
| -rw-r--r-- | openbox/startupnotify.c | 2 |
9 files changed, 160 insertions, 72 deletions
diff --git a/openbox/actions/desktop.c b/openbox/actions/desktop.c index e352aa2e..edd22aa2 100644 --- a/openbox/actions/desktop.c +++ b/openbox/actions/desktop.c @@ -21,7 +21,7 @@ typedef struct { gboolean wrap; ObDirection dir; } rel; - }; + } u; gboolean send; gboolean follow; } Options; @@ -46,9 +46,9 @@ static gpointer setup_go_func(xmlNodePtr node) o = g_new0(Options, 1); /* don't go anywhere if theres no options given */ o->type = ABSOLUTE; - o->abs.desktop = screen_desktop; + o->u.abs.desktop = screen_desktop; /* wrap by default - it's handy! */ - o->rel.wrap = TRUE; + o->u.rel.wrap = TRUE; if ((n = obt_parse_find_node(node, "to"))) { gchar *s = obt_parse_node_string(n); @@ -56,43 +56,43 @@ static gpointer setup_go_func(xmlNodePtr node) o->type = LAST; else if (!g_ascii_strcasecmp(s, "next")) { o->type = RELATIVE; - o->rel.linear = TRUE; - o->rel.dir = OB_DIRECTION_EAST; + o->u.rel.linear = TRUE; + o->u.rel.dir = OB_DIRECTION_EAST; } else if (!g_ascii_strcasecmp(s, "previous")) { o->type = RELATIVE; - o->rel.linear = TRUE; - o->rel.dir = OB_DIRECTION_WEST; + o->u.rel.linear = TRUE; + o->u.rel.dir = OB_DIRECTION_WEST; } else if (!g_ascii_strcasecmp(s, "north") || !g_ascii_strcasecmp(s, "up")) { o->type = RELATIVE; - o->rel.dir = OB_DIRECTION_NORTH; + o->u.rel.dir = OB_DIRECTION_NORTH; } else if (!g_ascii_strcasecmp(s, "south") || !g_ascii_strcasecmp(s, "down")) { o->type = RELATIVE; - o->rel.dir = OB_DIRECTION_SOUTH; + o->u.rel.dir = OB_DIRECTION_SOUTH; } else if (!g_ascii_strcasecmp(s, "west") || !g_ascii_strcasecmp(s, "left")) { o->type = RELATIVE; - o->rel.dir = OB_DIRECTION_WEST; + o->u.rel.dir = OB_DIRECTION_WEST; } else if (!g_ascii_strcasecmp(s, "east") || !g_ascii_strcasecmp(s, "right")) { o->type = RELATIVE; - o->rel.dir = OB_DIRECTION_EAST; + o->u.rel.dir = OB_DIRECTION_EAST; } else { o->type = ABSOLUTE; - o->abs.desktop = atoi(s) - 1; + o->u.abs.desktop = atoi(s) - 1; } g_free(s); } if ((n = obt_parse_find_node(node, "wrap"))) - o->rel.wrap = obt_parse_node_bool(n); + o->u.rel.wrap = obt_parse_node_bool(n); return o; } @@ -123,11 +123,11 @@ static gboolean run_func(ObActionsData *data, gpointer options) d = screen_last_desktop; break; case ABSOLUTE: - d = o->abs.desktop; + d = o->u.abs.desktop; break; case RELATIVE: d = screen_find_desktop(screen_desktop, - o->rel.dir, o->rel.wrap, o->rel.linear); + o->u.rel.dir, o->u.rel.wrap, o->u.rel.linear); break; } diff --git a/openbox/actions/moveresizeto.c b/openbox/actions/moveresizeto.c index 357c7315..3ee3498a 100644 --- a/openbox/actions/moveresizeto.c +++ b/openbox/actions/moveresizeto.c @@ -6,7 +6,9 @@ enum { CURRENT_MONITOR = -1, - ALL_MONITORS = -2 + ALL_MONITORS = -2, + NEXT_MONITOR = -3, + PREV_MONITOR = -4 }; typedef struct { @@ -84,6 +86,10 @@ static gpointer setup_func(xmlNodePtr node) if (g_ascii_strcasecmp(s, "current") != 0) { if (!g_ascii_strcasecmp(s, "all")) o->monitor = ALL_MONITORS; + else if(!g_ascii_strcasecmp(s, "next")) + o->monitor = NEXT_MONITOR; + else if(!g_ascii_strcasecmp(s, "prev")) + o->monitor = PREV_MONITOR; else o->monitor = obt_parse_node_int(n) - 1; } @@ -109,6 +115,9 @@ static gboolean run_func(ObActionsData *data, gpointer options) cmon = client_monitor(c); if (mon == CURRENT_MONITOR) mon = cmon; else if (mon == ALL_MONITORS) mon = SCREEN_AREA_ALL_MONITORS; + else if (mon == NEXT_MONITOR) mon = (cmon + 1 > screen_num_monitors - 1) ? 0 : (cmon + 1); + else if (mon == PREV_MONITOR) mon = (cmon == 0) ? (screen_num_monitors - 1) : (cmon - 1); + area = screen_area(c->desktop, mon, NULL); carea = screen_area(c->desktop, cmon, NULL); diff --git a/openbox/client.c b/openbox/client.c index d98ce642..38dc7c1a 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -233,7 +233,12 @@ void client_manage(Window window, ObPrompt *prompt) ob_debug("Window type: %d", self->type); ob_debug("Window group: 0x%x", self->group?self->group->leader:0); - ob_debug("Window name: %s class: %s", self->name, self->class); + ob_debug("Window name: %s class: %s role: %s", self->name, self->class, self->role); + + /* per-app settings override stuff from client_get_all, and return the + settings for other uses too. the returned settings is a shallow copy, + that needs to be freed with g_free(). */ + settings = client_get_settings_state(self); /* now we have all of the window's information so we can set this up. do this before creating the frame, so it can tell that we are still @@ -255,10 +260,6 @@ void client_manage(Window window, ObPrompt *prompt) time now */ grab_server(FALSE); - /* per-app settings override stuff from client_get_all, and return the - settings for other uses too. the returned settings is a shallow copy, - that needs to be freed with g_free(). */ - settings = client_get_settings_state(self); /* the session should get the last say though */ client_restore_session_state(self); @@ -3538,19 +3539,38 @@ ObClient *client_search_modal_child(ObClient *self) return NULL; } +static gboolean client_validate_unmap(ObClient *self, int n) +{ + XEvent e; + gboolean ret = TRUE; + + if (XCheckTypedWindowEvent(obt_display, self->window, UnmapNotify, &e)) { + if (n < self->ignore_unmaps) // ignore this one, but look for more + ret = client_validate_unmap(self, n+1); + else + ret = FALSE; // the window is going to become unmanaged + + /* put them back on the event stack so they end up in the same order */ + XPutBackEvent(obt_display, &e); + } + + return ret; +} + gboolean client_validate(ObClient *self) { XEvent e; XSync(obt_display, FALSE); /* get all events on the server */ - if (XCheckTypedWindowEvent(obt_display, self->window, DestroyNotify, &e) || - XCheckTypedWindowEvent(obt_display, self->window, UnmapNotify, &e)) - { + if (XCheckTypedWindowEvent(obt_display, self->window, DestroyNotify, &e)) { XPutBackEvent(obt_display, &e); return FALSE; } + if (!client_validate_unmap(self, 0)) + return FALSE; + return TRUE; } diff --git a/openbox/event.c b/openbox/event.c index f69267db..e2fd411f 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -656,7 +656,7 @@ static void event_process(const XEvent *ec, gpointer data) else if (e->type == MappingNotify) { /* keyboard layout changes for modifier mapping changes. reload the modifier map, and rebind all the key bindings as appropriate */ - ob_debug("Kepboard map changed. Reloading keyboard bindings."); + ob_debug("Keyboard map changed. Reloading keyboard bindings."); ob_set_state(OB_STATE_RECONFIGURING); obt_keyboard_reload(); keyboard_rebind(); diff --git a/openbox/frame.c b/openbox/frame.c index c633fa6d..ab5a14a8 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -339,7 +339,8 @@ void frame_adjust_area(ObFrame *self, gboolean moved, self->shaded = self->client->shaded; if (self->decorations & OB_FRAME_DECOR_BORDER || - (self->client->undecorated && config_theme_keepborder)) + (self->client->undecorated && config_theme_keepborder + && !self->client->fullscreen)) self->bwidth = ob_rr_theme->fbwidth; else self->bwidth = 0; diff --git a/openbox/menu.c b/openbox/menu.c index f7d50e39..3e45fb93 100644 --- a/openbox/menu.c +++ b/openbox/menu.c @@ -232,10 +232,13 @@ static gunichar parse_shortcut(const gchar *label, gboolean allow_shortcut, /* you have to use a printable ascii character for shortcuts don't allow space either, so you can have like "a _ b" */ - if (VALID_SHORTCUT(*(i+1))) { - shortcut = g_unichar_tolower(g_utf8_get_char(i+1)); - *position = i - *strippedlabel; - *always_show = TRUE; + if (VALID_SHORTCUT(*(i+1)) || *(i+1) == '_') { + /* Allow you to escape the first _ by putting __ */ + if (*(i+1) != '_') { + shortcut = g_unichar_tolower(g_utf8_get_char(i+1)); + *position = i - *strippedlabel; + *always_show = TRUE; + } /* remove the '_' from the string */ for (; *i != '\0'; ++i) diff --git a/openbox/popup.c b/openbox/popup.c index fd31846e..bddf137d 100644 --- a/openbox/popup.c +++ b/openbox/popup.c @@ -319,7 +319,7 @@ void popup_hide(ObPopup *self) event_end_ignore_all_enters(ignore_start); } else if (self->delay_mapped) { - obt_main_loop_timeout_remove(ob_main_loop, popup_show_timeout); + obt_main_loop_timeout_remove_data(ob_main_loop, popup_show_timeout, self, FALSE); self->delay_mapped = FALSE; } } diff --git a/openbox/screen.c b/openbox/screen.c index 74d073c4..09d5003c 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -77,7 +77,7 @@ static GSList *struts_left = NULL; static GSList *struts_right = NULL; static GSList *struts_bottom = NULL; -static ObPagerPopup *desktop_popup; +static ObPagerPopup **desktop_popup; /*! The number of microseconds that you need to be on a desktop before it will replace the remembered "last desktop" */ @@ -344,15 +344,22 @@ void screen_startup(gboolean reconfig) guint32 d; gboolean namesexist = FALSE; - desktop_popup = pager_popup_new(); - pager_popup_height(desktop_popup, POPUP_HEIGHT); - if (reconfig) { - /* update the pager popup's width */ - pager_popup_text_width_to_strings(desktop_popup, - screen_desktop_names, - screen_num_desktops); + guint i; + desktop_popup = g_new(ObPagerPopup*, screen_num_monitors); + for (i = 0; i < screen_num_monitors; i++) { + desktop_popup[i] = pager_popup_new(); + pager_popup_height(desktop_popup[i], POPUP_HEIGHT); + + /* update the pager popup's width */ + pager_popup_text_width_to_strings(desktop_popup[i], + screen_desktop_names, + screen_num_desktops); + } + return; + } else { + desktop_popup = NULL; } /* get the initial size */ @@ -441,7 +448,12 @@ void screen_startup(gboolean reconfig) void screen_shutdown(gboolean reconfig) { - pager_popup_free(desktop_popup); + guint i; + + for (i = 0; i < screen_num_monitors; i++) { + pager_popup_free(desktop_popup[i]); + } + g_free(desktop_popup); if (reconfig) return; @@ -911,39 +923,52 @@ static guint translate_row_col(guint r, guint c) static gboolean hide_desktop_popup_func(gpointer data) { - pager_popup_hide(desktop_popup); + guint i; + + for (i = 0; i < screen_num_monitors; i++) { + pager_popup_hide(desktop_popup[i]); + } return FALSE; /* don't repeat */ } void screen_show_desktop_popup(guint d) { Rect *a; + guint i; /* 0 means don't show the popup */ if (!config_desktop_popup_time) return; - a = screen_physical_area_active(); - pager_popup_position(desktop_popup, CenterGravity, - a->x + a->width / 2, a->y + a->height / 2); - pager_popup_icon_size_multiplier(desktop_popup, - (screen_desktop_layout.columns / - screen_desktop_layout.rows) / 2, - (screen_desktop_layout.rows/ - screen_desktop_layout.columns) / 2); - pager_popup_max_width(desktop_popup, - MAX(a->width/3, POPUP_WIDTH)); - pager_popup_show(desktop_popup, screen_desktop_names[d], d); - - obt_main_loop_timeout_remove(ob_main_loop, hide_desktop_popup_func); - obt_main_loop_timeout_add(ob_main_loop, config_desktop_popup_time * 1000, - hide_desktop_popup_func, NULL, NULL, NULL); - g_free(a); + for (i = 0; i < screen_num_monitors; i++) { + a = screen_physical_area_monitor(i); + pager_popup_position(desktop_popup[i], CenterGravity, + a->x + a->width / 2, a->y + a->height / 2); + pager_popup_icon_size_multiplier(desktop_popup[i], + (screen_desktop_layout.columns / + screen_desktop_layout.rows) / 2, + (screen_desktop_layout.rows/ + screen_desktop_layout.columns) / 2); + pager_popup_max_width(desktop_popup[i], + MAX(a->width/3, POPUP_WIDTH)); + pager_popup_show(desktop_popup[i], screen_desktop_names[d], d); + + obt_main_loop_timeout_remove(ob_main_loop, hide_desktop_popup_func); + obt_main_loop_timeout_add(ob_main_loop, config_desktop_popup_time * 1000, + hide_desktop_popup_func, desktop_popup[i], + g_direct_equal, NULL); + g_free(a); + } } void screen_hide_desktop_popup(void) { - obt_main_loop_timeout_remove(ob_main_loop, hide_desktop_popup_func); - pager_popup_hide(desktop_popup); + guint i; + + for (i = 0; i < screen_num_monitors; i++) { + obt_main_loop_timeout_remove_data(ob_main_loop, hide_desktop_popup_func, + desktop_popup[i], FALSE); + pager_popup_hide(desktop_popup[i]); + } } guint screen_find_desktop(guint from, ObDirection dir, @@ -1178,9 +1203,11 @@ void screen_update_desktop_names(void) } /* resize the pager for these names */ - pager_popup_text_width_to_strings(desktop_popup, - screen_desktop_names, - screen_num_desktops); + for (i = 0; i < screen_num_monitors; i++) { + pager_popup_text_width_to_strings(desktop_popup[i], + screen_desktop_names, + screen_num_desktops); + } } void screen_show_desktop(gboolean show, ObClient *show_only) @@ -1302,7 +1329,10 @@ typedef struct { static void get_xinerama_screens(Rect **xin_areas, guint *nxin) { guint i; - gint l, r, t, b; + gint n, l, r, t, b; +#ifdef XINERAMA + XineramaScreenInfo *info; +#endif if (ob_debug_xinerama) { gint w = WidthOfScreen(ScreenOfDisplay(obt_display, ob_screen)); @@ -1313,10 +1343,8 @@ static void get_xinerama_screens(Rect **xin_areas, guint *nxin) RECT_SET((*xin_areas)[1], w/2, 0, w-(w/2), h); } #ifdef XINERAMA - else if (obt_display_extension_xinerama) { - guint i; - gint n; - XineramaScreenInfo *info = XineramaQueryScreens(obt_display, &n); + else if (obt_display_extension_xinerama && + (info = XineramaQueryScreens(obt_display, &n))) { *nxin = n; *xin_areas = g_new(Rect, *nxin + 1); for (i = 0; i < *nxin; ++i) @@ -1357,6 +1385,20 @@ void screen_update_areas(void) g_free(monitor_area); get_xinerama_screens(&monitor_area, &screen_num_monitors); + if (!desktop_popup) { + desktop_popup = g_new(ObPagerPopup*, screen_num_monitors); + for (i = 0; i < screen_num_monitors; i++) { + desktop_popup[i] = pager_popup_new(); + pager_popup_height(desktop_popup[i], POPUP_HEIGHT); + + if (screen_desktop_names) + /* update the pager popup's width */ + pager_popup_text_width_to_strings(desktop_popup[i], + screen_desktop_names, + screen_num_desktops); + } + } + /* set up the user-specified margins */ config_margins.top_start = RECT_LEFT(monitor_area[screen_num_monitors]); config_margins.top_end = RECT_RIGHT(monitor_area[screen_num_monitors]); @@ -1454,6 +1496,15 @@ void screen_update_areas(void) b = MAX(b, s->strut->bottom); } + if (l) l += RECT_LEFT (monitor_area[screen_num_monitors]) + - RECT_LEFT (monitor_area[i]); + if (t) t += RECT_TOP (monitor_area[screen_num_monitors]) + - RECT_TOP (monitor_area[i]); + if (r) r -= RECT_RIGHT (monitor_area[screen_num_monitors]) + - RECT_RIGHT (monitor_area[i]); + if (b) b -= RECT_BOTTOM(monitor_area[screen_num_monitors]) + - RECT_BOTTOM(monitor_area[i]); + /* based on these margins, set the work area for the monitor/desktop */ dims[(i * screen_num_desktops + j) * 4 + 0] += l; @@ -1594,28 +1645,32 @@ Rect* screen_area(guint desktop, guint head, Rect *search) if ((s->desktop == d || s->desktop == DESKTOP_ALL) && STRUT_LEFT_IN_SEARCH(s->strut, search) && !STRUT_LEFT_IGNORE(s->strut, us, search)) - l = MAX(l, al + s->strut->left); + l = MAX(l, RECT_LEFT(monitor_area[screen_num_monitors]) + + s->strut->left); } for (it = struts_top; it; it = g_slist_next(it)) { ObScreenStrut *s = it->data; if ((s->desktop == d || s->desktop == DESKTOP_ALL) && STRUT_TOP_IN_SEARCH(s->strut, search) && !STRUT_TOP_IGNORE(s->strut, us, search)) - t = MAX(t, at + s->strut->top); + t = MAX(t, RECT_TOP(monitor_area[screen_num_monitors]) + + s->strut->top); } for (it = struts_right; it; it = g_slist_next(it)) { ObScreenStrut *s = it->data; if ((s->desktop == d || s->desktop == DESKTOP_ALL) && STRUT_RIGHT_IN_SEARCH(s->strut, search) && !STRUT_RIGHT_IGNORE(s->strut, us, search)) - r = MIN(r, ar - s->strut->right); + r = MIN(r, RECT_RIGHT(monitor_area[screen_num_monitors]) + - s->strut->right); } for (it = struts_bottom; it; it = g_slist_next(it)) { ObScreenStrut *s = it->data; if ((s->desktop == d || s->desktop == DESKTOP_ALL) && STRUT_BOTTOM_IN_SEARCH(s->strut, search) && !STRUT_BOTTOM_IGNORE(s->strut, us, search)) - b = MIN(b, ab - s->strut->bottom); + b = MIN(b, RECT_BOTTOM(monitor_area[screen_num_monitors]) + - s->strut->bottom); } /* limit to this monitor */ diff --git a/openbox/startupnotify.c b/openbox/startupnotify.c index 3e8799f8..aa6db7e6 100644 --- a/openbox/startupnotify.c +++ b/openbox/startupnotify.c @@ -239,7 +239,7 @@ void sn_setup_spawn_environment(const gchar *program, const gchar *name, gchar *desc; const char *id; - desc = g_strdup_printf(_("Running %s\n"), program); + desc = g_strdup_printf(_("Running %s"), program); if (sn_launcher_context_get_initiated(sn_launcher)) { sn_launcher_context_unref(sn_launcher); |
