mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
do nothing if screen is being unmanaged, we don't want to blow away state,
2002-06-22 Havoc Pennington <hp@pobox.com> * src/workspace.c (set_number_of_spaces_hint): do nothing if screen is being unmanaged, we don't want to blow away state, we want to remember it for the next window manager. 2002-06-22 Havoc Pennington <hp@pobox.com> * src/workspace.c (meta_screen_ensure_workspace_popup): rename from meta_workspace_ensure_tab_popup, and use workspace->name instead of a hardcoded name
This commit is contained in:
parent
0243071f15
commit
8a8171ebc7
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
|||||||
|
2002-06-22 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
|
* src/workspace.c (set_number_of_spaces_hint): do nothing if
|
||||||
|
screen is being unmanaged, we don't want to blow away state,
|
||||||
|
we want to remember it for the next window manager.
|
||||||
|
|
||||||
|
2002-06-22 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
|
* src/workspace.c (meta_screen_ensure_workspace_popup): rename
|
||||||
|
from meta_workspace_ensure_tab_popup, and use workspace->name
|
||||||
|
instead of a hardcoded name
|
||||||
|
|
||||||
2002-06-22 Havoc Pennington <hp@pobox.com>
|
2002-06-22 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
* src/xprops.c (meta_prop_get_utf8_list): new utility function
|
* src/xprops.c (meta_prop_get_utf8_list): new utility function
|
||||||
|
@ -262,6 +262,8 @@ meta_display_open (const char *name)
|
|||||||
|
|
||||||
display = g_new (MetaDisplay, 1);
|
display = g_new (MetaDisplay, 1);
|
||||||
|
|
||||||
|
display->closing = 0;
|
||||||
|
|
||||||
/* here we use XDisplayName which is what the user
|
/* here we use XDisplayName which is what the user
|
||||||
* probably put in, vs. DisplayString(display) which is
|
* probably put in, vs. DisplayString(display) which is
|
||||||
* canonicalized by XOpenDisplay()
|
* canonicalized by XOpenDisplay()
|
||||||
@ -556,6 +558,8 @@ meta_display_close (MetaDisplay *display)
|
|||||||
if (display->error_traps > 0)
|
if (display->error_traps > 0)
|
||||||
meta_bug ("Display closed with error traps pending\n");
|
meta_bug ("Display closed with error traps pending\n");
|
||||||
|
|
||||||
|
display->closing += 1;
|
||||||
|
|
||||||
if (display->autoraise_timeout_id != 0)
|
if (display->autoraise_timeout_id != 0)
|
||||||
{
|
{
|
||||||
g_source_remove (display->autoraise_timeout_id);
|
g_source_remove (display->autoraise_timeout_id);
|
||||||
@ -2267,7 +2271,7 @@ meta_display_begin_grab_op (MetaDisplay *display,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING:
|
case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING:
|
||||||
meta_workspace_ensure_tab_popup (display, window->screen);
|
meta_screen_ensure_workspace_popup (window->screen);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -220,6 +220,9 @@ struct _MetaDisplay
|
|||||||
|
|
||||||
/* Xinerama cache */
|
/* Xinerama cache */
|
||||||
unsigned int xinerama_cache_invalidated : 1;
|
unsigned int xinerama_cache_invalidated : 1;
|
||||||
|
|
||||||
|
/* Closing down the display */
|
||||||
|
int closing;
|
||||||
};
|
};
|
||||||
|
|
||||||
gboolean meta_display_open (const char *name);
|
gboolean meta_display_open (const char *name);
|
||||||
|
125
src/screen.c
125
src/screen.c
@ -314,6 +314,7 @@ meta_screen_new (MetaDisplay *display,
|
|||||||
}
|
}
|
||||||
|
|
||||||
screen = g_new (MetaScreen, 1);
|
screen = g_new (MetaScreen, 1);
|
||||||
|
screen->closing = 0;
|
||||||
|
|
||||||
screen->display = display;
|
screen->display = display;
|
||||||
screen->number = number;
|
screen->number = number;
|
||||||
@ -493,6 +494,8 @@ meta_screen_free (MetaScreen *screen)
|
|||||||
MetaDisplay *display;
|
MetaDisplay *display;
|
||||||
|
|
||||||
display = screen->display;
|
display = screen->display;
|
||||||
|
|
||||||
|
screen->closing += 1;
|
||||||
|
|
||||||
meta_display_grab (display);
|
meta_display_grab (display);
|
||||||
|
|
||||||
@ -922,6 +925,79 @@ meta_screen_ensure_tab_popup (MetaScreen *screen,
|
|||||||
/* don't show tab popup, since proper window isn't selected yet */
|
/* don't show tab popup, since proper window isn't selected yet */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_screen_ensure_workspace_popup (MetaScreen *screen)
|
||||||
|
{
|
||||||
|
MetaTabEntry *entries;
|
||||||
|
GdkPixbuf *icon;
|
||||||
|
int len, rows, cols;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (screen->tab_popup)
|
||||||
|
return;
|
||||||
|
|
||||||
|
icon = meta_ui_get_default_window_icon (NULL);
|
||||||
|
|
||||||
|
len = meta_screen_get_n_workspaces (screen);
|
||||||
|
|
||||||
|
entries = g_new (MetaTabEntry, len + 1);
|
||||||
|
entries[len].key = NULL;
|
||||||
|
entries[len].title = NULL;
|
||||||
|
entries[len].icon = NULL;
|
||||||
|
|
||||||
|
meta_screen_calc_workspace_layout (screen, len, &rows, &cols);
|
||||||
|
|
||||||
|
if (screen->vertical_workspaces)
|
||||||
|
{
|
||||||
|
int j, k;
|
||||||
|
|
||||||
|
for (i = 0; i < rows; ++i)
|
||||||
|
{
|
||||||
|
for (j = 0; j < cols; ++j)
|
||||||
|
{
|
||||||
|
MetaWorkspace *workspace;
|
||||||
|
|
||||||
|
k = i + (j * rows);
|
||||||
|
workspace = meta_display_get_workspace_by_index (screen->display,
|
||||||
|
k);
|
||||||
|
|
||||||
|
g_assert (workspace);
|
||||||
|
|
||||||
|
entries[i].key = (MetaTabEntryKey) workspace;
|
||||||
|
entries[i].title = workspace->name;
|
||||||
|
entries[i].icon = icon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (i = 0; i < len; ++i)
|
||||||
|
{
|
||||||
|
MetaWorkspace *workspace;
|
||||||
|
|
||||||
|
workspace = meta_display_get_workspace_by_index (screen->display, i);
|
||||||
|
|
||||||
|
g_assert (workspace);
|
||||||
|
|
||||||
|
entries[i].key = (MetaTabEntryKey) workspace;
|
||||||
|
entries[i].title = workspace->name;
|
||||||
|
entries[i].icon = icon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
screen->tab_popup = meta_ui_tab_popup_new (entries,
|
||||||
|
screen->number,
|
||||||
|
len,
|
||||||
|
cols,
|
||||||
|
FALSE);
|
||||||
|
|
||||||
|
g_free (entries);
|
||||||
|
|
||||||
|
g_object_unref (G_OBJECT (icon));
|
||||||
|
|
||||||
|
/* don't show tab popup, since proper window isn't selected yet */
|
||||||
|
}
|
||||||
|
|
||||||
/* Focus top window on active workspace */
|
/* Focus top window on active workspace */
|
||||||
void
|
void
|
||||||
meta_screen_focus_top_window (MetaScreen *screen,
|
meta_screen_focus_top_window (MetaScreen *screen,
|
||||||
@ -1175,3 +1251,52 @@ meta_create_offscreen_window (Display *xdisplay,
|
|||||||
CWOverrideRedirect,
|
CWOverrideRedirect,
|
||||||
&attrs);
|
&attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_screen_calc_workspace_layout (MetaScreen *screen,
|
||||||
|
int num_workspaces,
|
||||||
|
int *r,
|
||||||
|
int *c)
|
||||||
|
{
|
||||||
|
int cols, rows;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 3 rows, 4 columns, horizontal layout:
|
||||||
|
* +--+--+--+--+
|
||||||
|
* | 1| 2| 3| 4|
|
||||||
|
* +--+--+--+--+
|
||||||
|
* | 5| 6| 7| 8|
|
||||||
|
* +--+--+--+--+
|
||||||
|
* | 9|10|11|12|
|
||||||
|
* +--+--+--+--+
|
||||||
|
*
|
||||||
|
* vertical layout:
|
||||||
|
* +--+--+--+--+
|
||||||
|
* | 1| 4| 7|10|
|
||||||
|
* +--+--+--+--+
|
||||||
|
* | 2| 5| 8|11|
|
||||||
|
* +--+--+--+--+
|
||||||
|
* | 3| 6| 9|12|
|
||||||
|
* +--+--+--+--+
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
rows = screen->rows_of_workspaces;
|
||||||
|
cols = screen->columns_of_workspaces;
|
||||||
|
if (rows <= 0 && cols <= 0)
|
||||||
|
cols = num_workspaces;
|
||||||
|
|
||||||
|
if (rows <= 0)
|
||||||
|
rows = num_workspaces / cols + ((num_workspaces % cols) > 0 ? 1 : 0);
|
||||||
|
if (cols <= 0)
|
||||||
|
cols = num_workspaces / rows + ((num_workspaces % rows) > 0 ? 1 : 0);
|
||||||
|
|
||||||
|
/* paranoia */
|
||||||
|
if (rows < 1)
|
||||||
|
rows = 1;
|
||||||
|
if (cols < 1)
|
||||||
|
cols = 1;
|
||||||
|
|
||||||
|
*r = rows;
|
||||||
|
*c = cols;
|
||||||
|
}
|
||||||
|
@ -77,6 +77,8 @@ struct _MetaScreen
|
|||||||
guint vertical_workspaces : 1;
|
guint vertical_workspaces : 1;
|
||||||
|
|
||||||
guint keys_grabbed : 1;
|
guint keys_grabbed : 1;
|
||||||
|
|
||||||
|
int closing;
|
||||||
};
|
};
|
||||||
|
|
||||||
MetaScreen* meta_screen_new (MetaDisplay *display,
|
MetaScreen* meta_screen_new (MetaDisplay *display,
|
||||||
@ -98,6 +100,8 @@ void meta_screen_set_cursor (MetaScreen *scree
|
|||||||
void meta_screen_ensure_tab_popup (MetaScreen *screen,
|
void meta_screen_ensure_tab_popup (MetaScreen *screen,
|
||||||
MetaTabList type);
|
MetaTabList type);
|
||||||
|
|
||||||
|
void meta_screen_ensure_workspace_popup (MetaScreen *screen);
|
||||||
|
|
||||||
void meta_screen_focus_top_window (MetaScreen *screen,
|
void meta_screen_focus_top_window (MetaScreen *screen,
|
||||||
MetaWindow *not_this_one);
|
MetaWindow *not_this_one);
|
||||||
|
|
||||||
@ -111,6 +115,11 @@ void meta_screen_update_workspace_names (MetaScreen *scree
|
|||||||
Window meta_create_offscreen_window (Display *xdisplay,
|
Window meta_create_offscreen_window (Display *xdisplay,
|
||||||
Window parent);
|
Window parent);
|
||||||
|
|
||||||
|
void meta_screen_calc_workspace_layout (MetaScreen *screen,
|
||||||
|
int num_workspaces,
|
||||||
|
int *r,
|
||||||
|
int *c);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
138
src/workspace.c
138
src/workspace.c
@ -310,6 +310,9 @@ static int
|
|||||||
set_number_of_spaces_hint (MetaScreen *screen)
|
set_number_of_spaces_hint (MetaScreen *screen)
|
||||||
{
|
{
|
||||||
unsigned long data[1];
|
unsigned long data[1];
|
||||||
|
|
||||||
|
if (screen->closing > 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
data[0] = meta_screen_get_n_workspaces (screen);
|
data[0] = meta_screen_get_n_workspaces (screen);
|
||||||
|
|
||||||
@ -521,52 +524,6 @@ meta_workspace_get_work_area (MetaWorkspace *workspace,
|
|||||||
*area = workspace->work_area;
|
*area = workspace->work_area;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
calc_rows_and_cols (MetaScreen *screen, int num_workspaces, int *r, int *c)
|
|
||||||
{
|
|
||||||
int cols, rows;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 3 rows, 4 columns, horizontal layout:
|
|
||||||
* +--+--+--+--+
|
|
||||||
* | 1| 2| 3| 4|
|
|
||||||
* +--+--+--+--+
|
|
||||||
* | 5| 6| 7| 8|
|
|
||||||
* +--+--+--+--+
|
|
||||||
* | 9|10|11|12|
|
|
||||||
* +--+--+--+--+
|
|
||||||
*
|
|
||||||
* vertical layout:
|
|
||||||
* +--+--+--+--+
|
|
||||||
* | 1| 4| 7|10|
|
|
||||||
* +--+--+--+--+
|
|
||||||
* | 2| 5| 8|11|
|
|
||||||
* +--+--+--+--+
|
|
||||||
* | 3| 6| 9|12|
|
|
||||||
* +--+--+--+--+
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
rows = screen->rows_of_workspaces;
|
|
||||||
cols = screen->columns_of_workspaces;
|
|
||||||
if (rows <= 0 && cols <= 0)
|
|
||||||
cols = num_workspaces;
|
|
||||||
|
|
||||||
if (rows <= 0)
|
|
||||||
rows = num_workspaces / cols + ((num_workspaces % cols) > 0 ? 1 : 0);
|
|
||||||
if (cols <= 0)
|
|
||||||
cols = num_workspaces / rows + ((num_workspaces % rows) > 0 ? 1 : 0);
|
|
||||||
|
|
||||||
/* paranoia */
|
|
||||||
if (rows < 1)
|
|
||||||
rows = 1;
|
|
||||||
if (cols < 1)
|
|
||||||
cols = 1;
|
|
||||||
|
|
||||||
*r = rows;
|
|
||||||
*c = cols;
|
|
||||||
}
|
|
||||||
|
|
||||||
MetaWorkspace*
|
MetaWorkspace*
|
||||||
meta_workspace_get_neighbor (MetaWorkspace *workspace,
|
meta_workspace_get_neighbor (MetaWorkspace *workspace,
|
||||||
MetaMotionDirection direction)
|
MetaMotionDirection direction)
|
||||||
@ -577,7 +534,8 @@ meta_workspace_get_neighbor (MetaWorkspace *workspace,
|
|||||||
i = meta_workspace_index (workspace);
|
i = meta_workspace_index (workspace);
|
||||||
num_workspaces = meta_screen_get_n_workspaces (workspace->screen);
|
num_workspaces = meta_screen_get_n_workspaces (workspace->screen);
|
||||||
|
|
||||||
calc_rows_and_cols (workspace->screen, num_workspaces, &rows, &cols);
|
meta_screen_calc_workspace_layout (workspace->screen, num_workspaces,
|
||||||
|
&rows, &cols);
|
||||||
|
|
||||||
grid_area = rows * cols;
|
grid_area = rows * cols;
|
||||||
|
|
||||||
@ -665,8 +623,8 @@ meta_workspace_get_neighbor (MetaWorkspace *workspace,
|
|||||||
else
|
else
|
||||||
i += cols;
|
i += cols;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_verbose ("Neighbor space is %d\n", i);
|
meta_verbose ("Neighbor space is %d\n", i);
|
||||||
|
|
||||||
@ -674,88 +632,6 @@ meta_workspace_get_neighbor (MetaWorkspace *workspace,
|
|||||||
i);
|
i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
meta_workspace_ensure_tab_popup (MetaDisplay *display,
|
|
||||||
MetaScreen *screen)
|
|
||||||
{
|
|
||||||
MetaTabEntry *entries;
|
|
||||||
GdkPixbuf *icon;
|
|
||||||
int len, rows, cols;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (screen->tab_popup)
|
|
||||||
return;
|
|
||||||
|
|
||||||
icon = meta_ui_get_default_window_icon (NULL);
|
|
||||||
|
|
||||||
len = meta_screen_get_n_workspaces (screen);
|
|
||||||
|
|
||||||
entries = g_new (MetaTabEntry, len + 1);
|
|
||||||
entries[len].key = NULL;
|
|
||||||
entries[len].title = NULL;
|
|
||||||
entries[len].icon = NULL;
|
|
||||||
|
|
||||||
calc_rows_and_cols (screen, len, &rows, &cols);
|
|
||||||
|
|
||||||
if (screen->vertical_workspaces)
|
|
||||||
{
|
|
||||||
int j, k;
|
|
||||||
|
|
||||||
for (i = 0; i < rows; ++i)
|
|
||||||
{
|
|
||||||
for (j = 0; j < cols; ++j)
|
|
||||||
{
|
|
||||||
MetaWorkspace *workspace;
|
|
||||||
char *title;
|
|
||||||
|
|
||||||
k = i + (j * rows);
|
|
||||||
workspace = meta_display_get_workspace_by_index (display, k);
|
|
||||||
|
|
||||||
g_assert (workspace);
|
|
||||||
|
|
||||||
title = g_strdup_printf (_("Workspace %d"), k + 1);
|
|
||||||
|
|
||||||
entries[i].key = (MetaTabEntryKey) workspace;
|
|
||||||
entries[i].title = title;
|
|
||||||
entries[i].icon = icon;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (i = 0; i < len; ++i)
|
|
||||||
{
|
|
||||||
MetaWorkspace *workspace;
|
|
||||||
char *title;
|
|
||||||
|
|
||||||
workspace = meta_display_get_workspace_by_index (display, i);
|
|
||||||
|
|
||||||
g_assert (workspace);
|
|
||||||
|
|
||||||
title = g_strdup_printf (_("Workspace %d"), i + 1);
|
|
||||||
|
|
||||||
entries[i].key = (MetaTabEntryKey) workspace;
|
|
||||||
entries[i].title = title;
|
|
||||||
entries[i].icon = icon;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
screen->tab_popup = meta_ui_tab_popup_new (entries,
|
|
||||||
screen->number,
|
|
||||||
len,
|
|
||||||
cols,
|
|
||||||
FALSE);
|
|
||||||
|
|
||||||
for (i = 0; i < len; ++i)
|
|
||||||
g_free((void *) entries[i].title);
|
|
||||||
|
|
||||||
g_free (entries);
|
|
||||||
|
|
||||||
g_object_unref (G_OBJECT (icon));
|
|
||||||
|
|
||||||
/* don't show tab popup, since proper window isn't selected yet */
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_workspace_set_name (MetaWorkspace *workspace,
|
meta_workspace_set_name (MetaWorkspace *workspace,
|
||||||
const char *name)
|
const char *name)
|
||||||
|
@ -71,9 +71,6 @@ void meta_workspace_get_work_area (MetaWorkspace *workspace,
|
|||||||
MetaWorkspace* meta_workspace_get_neighbor (MetaWorkspace *workspace,
|
MetaWorkspace* meta_workspace_get_neighbor (MetaWorkspace *workspace,
|
||||||
MetaMotionDirection direction);
|
MetaMotionDirection direction);
|
||||||
|
|
||||||
void meta_workspace_ensure_tab_popup (MetaDisplay *display,
|
|
||||||
MetaScreen *screen);
|
|
||||||
|
|
||||||
void meta_workspace_set_name (MetaWorkspace *workspace,
|
void meta_workspace_set_name (MetaWorkspace *workspace,
|
||||||
const char *name);
|
const char *name);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user