new function

2002-09-03  Havoc Pennington  <hp@pobox.com>

	* src/display.c (meta_display_get_tab_current): new function

	* src/keybindings.c (do_choose_window): apply modified patch from
	JeyaSudha to still display tab popup if only one window is on the
	desktop.
This commit is contained in:
Havoc Pennington 2002-09-04 04:15:46 +00:00 committed by Havoc Pennington
parent a6a7407faa
commit cbb0b8e66c
5 changed files with 86 additions and 58 deletions

View File

@ -1,3 +1,11 @@
2002-09-03 Havoc Pennington <hp@pobox.com>
* src/display.c (meta_display_get_tab_current): new function
* src/keybindings.c (do_choose_window): apply modified patch from
JeyaSudha to still display tab popup if only one window is on the
desktop.
2002-06-25 JeyaSudha <jeyasudha.duraipandy@wipro.com> 2002-06-25 JeyaSudha <jeyasudha.duraipandy@wipro.com>
* src/session.c, src/window.c: Session saves the unmaximized * src/session.c, src/window.c: Session saves the unmaximized

View File

@ -3119,6 +3119,26 @@ meta_display_get_tab_next (MetaDisplay *display,
display->mru_list); display->mru_list);
} }
MetaWindow*
meta_display_get_tab_current (MetaDisplay *display,
MetaTabList type,
MetaScreen *screen,
MetaWorkspace *workspace)
{
MetaWindow *window;
window = display->focus_window;
if (window != NULL &&
window->screen == screen &&
IN_TAB_CHAIN (window, type) &&
(workspace == NULL ||
meta_window_visible_on_workspace (window, workspace)))
return window;
else
return NULL;
}
int int
meta_resize_gravity_from_grab_op (MetaGrabOp op) meta_resize_gravity_from_grab_op (MetaGrabOp op)
{ {

View File

@ -369,6 +369,11 @@ MetaWindow* meta_display_get_tab_next (MetaDisplay *display,
MetaWindow *window, MetaWindow *window,
gboolean backward); gboolean backward);
MetaWindow* meta_display_get_tab_current (MetaDisplay *display,
MetaTabList type,
MetaScreen *screen,
MetaWorkspace *workspace);
int meta_resize_gravity_from_grab_op (MetaGrabOp op); int meta_resize_gravity_from_grab_op (MetaGrabOp op);
gboolean meta_rectangle_intersect (MetaRectangle *src1, gboolean meta_rectangle_intersect (MetaRectangle *src1,

View File

@ -2333,58 +2333,50 @@ do_choose_window (MetaDisplay *display,
MetaKeyBinding *binding, MetaKeyBinding *binding,
gboolean show_popup) gboolean show_popup)
{ {
MetaWindow *window; MetaScreen *screen;
MetaTabList type; MetaTabList type;
gboolean backward; gboolean backward;
MetaWindow *initial_selection;
type = GPOINTER_TO_INT (binding->handler->data); type = GPOINTER_TO_INT (binding->handler->data);
meta_topic (META_DEBUG_KEYBINDINGS, meta_topic (META_DEBUG_KEYBINDINGS,
"Tab list = %d show_popup = %d\n", type, show_popup); "Tab list = %d show_popup = %d\n", type, show_popup);
/* backward if shift is down, this isn't configurable */
backward = (event->xkey.state & ShiftMask) != 0;
window = NULL;
if (display->focus_window != NULL)
{
window = meta_display_get_tab_next (display,
type,
display->focus_window->screen,
display->focus_window->screen->active_workspace,
display->focus_window,
backward);
}
if (window == NULL)
{
MetaScreen *screen;
screen = meta_display_screen_for_root (display, screen = meta_display_screen_for_root (display,
event->xkey.root); event->xkey.root);
/* We get the screen because event_window may be NULL, if (screen == NULL)
* in which case we can't use event_window->screen
*/
if (screen)
{ {
window = meta_display_get_tab_next (screen->display, meta_topic (META_DEBUG_KEYBINDINGS,
"No screen for root 0x%lx, not doing choose_window\n",
event->xkey.root);
return;
}
/* backward if shift is down, this isn't configurable */
backward = (event->xkey.state & ShiftMask) != 0;
initial_selection = meta_display_get_tab_next (display,
type, type,
screen, screen,
screen->active_workspace, screen->active_workspace,
NULL, NULL,
backward); backward);
}
}
if (window) /* Note that focus_window may not be in the tab chain, but it's OK */
{ if (initial_selection == NULL)
initial_selection = meta_display_get_tab_current (display,
type, screen,
screen->active_workspace);
meta_topic (META_DEBUG_KEYBINDINGS, meta_topic (META_DEBUG_KEYBINDINGS,
"Starting tab/cycle between windows\n"); "Initially selecting window %s\n",
initial_selection ? initial_selection->desc : "(none)");
if (meta_display_begin_grab_op (window->display, if (initial_selection != NULL &&
window->screen, meta_display_begin_grab_op (display,
screen,
NULL, NULL,
show_popup ? show_popup ?
tab_op_from_tab_type (type) : tab_op_from_tab_type (type) :
@ -2395,15 +2387,14 @@ do_choose_window (MetaDisplay *display,
event->xkey.time, event->xkey.time,
0, 0)) 0, 0))
{ {
meta_ui_tab_popup_select (window->screen->tab_popup, meta_ui_tab_popup_select (screen->tab_popup,
(MetaTabEntryKey) window->xwindow); (MetaTabEntryKey) initial_selection->xwindow);
if (show_popup) if (show_popup)
meta_ui_tab_popup_set_showing (window->screen->tab_popup, meta_ui_tab_popup_set_showing (screen->tab_popup,
TRUE); TRUE);
else else
meta_window_raise (window); meta_window_raise (initial_selection);
}
} }
} }

View File

@ -446,6 +446,10 @@ meta_ui_tab_popup_select (MetaTabPopup *popup,
{ {
GList *tmp; GList *tmp;
/* Note, "key" may not be in the list of entries; other code assumes
* it's OK to pass in a key that isn't.
*/
tmp = popup->entries; tmp = popup->entries;
while (tmp != NULL) while (tmp != NULL)
{ {