when mapping a window with struts, invalidate the work areas it's on.

2002-02-08  Havoc Pennington  <hp@pobox.com>

	* src/window.c (meta_window_show): when mapping a window with
	struts, invalidate the work areas it's on. Should fix at least
	part of the problem with windows maximizing over panels.

	* src/workspace.c (meta_workspace_invalidate_work_area): also
	queue move/resize on sticky windows

	* src/tools/Makefile.am: consolidate reload-theme, restart into a
	"metacity-message" app and add enable/disable keybindings to the
	messages it knows about.

	* src/keybindings.c:
	(meta_change_keygrab): grab keyboard synchronously
	(meta_display_process_key_event): if all keybindings are toggled
	off, ReplayKeyboard, else AsyncKeyboard, except that the debug
	binding for toggling back on is always processed
	(meta_set_keybindings_disabled): function to disable/enable
	all keybindings
This commit is contained in:
Havoc Pennington 2002-02-08 06:01:58 +00:00 committed by Havoc Pennington
parent 43b67afc41
commit 51d9f9dce6
12 changed files with 386 additions and 286 deletions

View File

@ -1,3 +1,24 @@
2002-02-08 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_show): when mapping a window with
struts, invalidate the work areas it's on. Should fix at least
part of the problem with windows maximizing over panels.
* src/workspace.c (meta_workspace_invalidate_work_area): also
queue move/resize on sticky windows
* src/tools/Makefile.am: consolidate reload-theme, restart into a
"metacity-message" app and add enable/disable keybindings to the
messages it knows about.
* src/keybindings.c:
(meta_change_keygrab): grab keyboard synchronously
(meta_display_process_key_event): if all keybindings are toggled
off, ReplayKeyboard, else AsyncKeyboard, except that the debug
binding for toggling back on is always processed
(meta_set_keybindings_disabled): function to disable/enable
all keybindings
2002-02-07 Havoc Pennington <hp@pobox.com>
* src/run-metacity.sh: if DEMO_TEST is set then run the window

View File

@ -85,8 +85,7 @@ AM_GLIB_GNU_GETTEXT
## here we get the flags we'll actually use
PKG_CHECK_MODULES(METACITY, gtk+-2.0 >= 1.3.13 gconf-2.0 >= 1.1.5)
PKG_CHECK_MODULES(METACITY_RESTART, gtk+-2.0 >= 1.3.13)
PKG_CHECK_MODULES(METACITY_RELOAD_THEME, gtk+-2.0 >= 1.3.13)
PKG_CHECK_MODULES(METACITY_MESSAGE, gtk+-2.0 >= 1.3.13)
PKG_CHECK_MODULES(METACITY_WINDOW_DEMO, gtk+-2.0 >= 1.3.13)
CFLAGS="$METACITY_CFLAGS $CFLAGS"

View File

@ -142,7 +142,8 @@ meta_display_open (const char *name)
"_METACITY_RESTART_MESSAGE",
"_NET_WM_STRUT",
"_WIN_HINTS",
"_METACITY_RELOAD_THEME_MESSAGE"
"_METACITY_RELOAD_THEME_MESSAGE",
"_METACITY_SET_KEYBINDINGS_MESSAGE"
};
Atom atoms[G_N_ELEMENTS(atom_names)];
@ -239,6 +240,7 @@ meta_display_open (const char *name)
display->atom_net_wm_strut = atoms[45];
display->atom_win_hints = atoms[46];
display->atom_metacity_reload_theme_message = atoms[47];
display->atom_metacity_set_keybindings_message = atoms[48];
/* Offscreen unmapped window used for _NET_SUPPORTING_WM_CHECK,
* created in screen_new
@ -1116,6 +1118,13 @@ event_callback (XEvent *event,
TRUE);
meta_display_retheme_all ();
}
else if (event->xclient.message_type ==
display->atom_metacity_set_keybindings_message)
{
meta_verbose ("Received set keybindings request = %d\n",
(int) event->xclient.data.l[0]);
meta_set_keybindings_disabled (!event->xclient.data.l[0]);
}
}
}
break;

View File

@ -107,6 +107,7 @@ struct _MetaDisplay
Atom atom_net_wm_strut;
Atom atom_win_hints;
Atom atom_metacity_reload_theme_message;
Atom atom_metacity_set_keybindings_message;
/* This is the actual window from focus events,
* not the one we last set

View File

@ -32,6 +32,7 @@
/* Plainly we'll want some more configurable keybinding system
* eventually.
*/
static gboolean all_bindings_disabled = FALSE;
typedef void (* MetaKeyHandler) (MetaDisplay *display,
MetaWindow *window,
@ -78,7 +79,6 @@ static void handle_spew_mark (MetaDisplay *display,
XEvent *event,
gpointer data);
static gboolean process_keyboard_move_grab (MetaDisplay *display,
MetaWindow *window,
XEvent *event,
@ -129,7 +129,7 @@ static MetaKeyBinding screen_bindings[] = {
};
static MetaKeyBinding debug_bindings[] = {
{ XK_m, Mod1Mask | ControlMask | ShiftMask, KeyPress, handle_spew_mark, NULL, 0 },
{ XK_m, Mod1Mask | ControlMask | ShiftMask, KeyPress, handle_spew_mark, NULL, 0 },
{ None, 0, 0, NULL, NULL, 0 }
};
@ -208,7 +208,7 @@ meta_change_keygrab (MetaDisplay *display,
modmask | ignored_mask,
xwindow,
True,
GrabModeAsync, GrabModeAsync);
GrabModeAsync, GrabModeSync);
else
XUngrabKey (display->xdisplay, keycode,
modmask | ignored_mask,
@ -542,7 +542,13 @@ meta_display_process_key_event (MetaDisplay *display,
KeySym keysym;
gboolean handled;
/* window may be NULL */
XAllowEvents (display->xdisplay,
all_bindings_disabled ? ReplayKeyboard : AsyncKeyboard,
event->xkey.time);
if (all_bindings_disabled)
return;
/* window may be NULL */
keysym = XKeycodeToKeysym (display->xdisplay, event->xkey.keycode, 0);
@ -1117,3 +1123,18 @@ handle_spew_mark (MetaDisplay *display,
meta_verbose ("-- MARK MARK MARK MARK --\n");
}
void
meta_set_keybindings_disabled (gboolean setting)
{
if (meta_is_debugging ())
{
all_bindings_disabled = setting;
meta_verbose ("Keybindings %s\n", all_bindings_disabled ? "disabled" : "enabled");
}
else
{
meta_verbose ("Ignoring keybindings disable message, not in debug mode\n");
}
}

View File

@ -1,17 +1,13 @@
INCLUDES=@METACITY_RESTART_CFLAGS@ @METACITY_RELOAD_THEME_CFLAGS@ @METACITY_WINDOW_DEMO_CFLAGS@
INCLUDES=@METACITY_WINDOW_DEMO_CFLAGS@ @METACITY_MESSAGE_CFLAGS@
metacity_restart_SOURCES= \
metacity-restart.c
metacity_reload_theme_SOURCES= \
metacity-reload-theme.c
metacity_message_SOURCES= \
metacity-message.c
metacity_window_demo_SOURCES= \
metacity-window-demo.c
bin_PROGRAMS=metacity-restart metacity-reload-theme metacity-window-demo
bin_PROGRAMS=metacity-message metacity-window-demo
metacity_restart_LDADD= @METACITY_RESTART_LIBS@
metacity_reload_theme_LDADD= @METACITY_RELOAD_THEME_LIBS@
metacity_message_LDADD= @METACITY_MESSAGE_LIBS@
metacity_window_demo_LDADD= @METACITY_WINDOW_DEMO_LIBS@

View File

@ -0,0 +1,139 @@
/* Metacity send-magic-messages app */
/*
* Copyright (C) 2002 Havoc Pennington
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <stdlib.h>
#include <string.h>
static void
send_restart (void)
{
XEvent xev;
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;
xev.xclient.send_event = True;
xev.xclient.display = gdk_display;
xev.xclient.window = gdk_x11_get_default_root_xwindow ();
xev.xclient.message_type = XInternAtom (gdk_display,
"_METACITY_RESTART_MESSAGE",
False);
xev.xclient.format = 32;
xev.xclient.data.l[0] = 0;
xev.xclient.data.l[1] = 0;
xev.xclient.data.l[2] = 0;
XSendEvent (gdk_display,
gdk_x11_get_default_root_xwindow (),
False,
SubstructureRedirectMask | SubstructureNotifyMask,
&xev);
XFlush (gdk_display);
XSync (gdk_display, False);
}
static void
send_reload_theme (void)
{
XEvent xev;
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;
xev.xclient.send_event = True;
xev.xclient.display = gdk_display;
xev.xclient.window = gdk_x11_get_default_root_xwindow ();
xev.xclient.message_type = XInternAtom (gdk_display,
"_METACITY_RELOAD_THEME_MESSAGE",
False);
xev.xclient.format = 32;
xev.xclient.data.l[0] = 0;
xev.xclient.data.l[1] = 0;
xev.xclient.data.l[2] = 0;
XSendEvent (gdk_display,
gdk_x11_get_default_root_xwindow (),
False,
SubstructureRedirectMask | SubstructureNotifyMask,
&xev);
XFlush (gdk_display);
XSync (gdk_display, False);
}
static void
send_set_keybindings (gboolean enabled)
{
XEvent xev;
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;
xev.xclient.send_event = True;
xev.xclient.display = gdk_display;
xev.xclient.window = gdk_x11_get_default_root_xwindow ();
xev.xclient.message_type = XInternAtom (gdk_display,
"_METACITY_SET_KEYBINDINGS_MESSAGE",
False);
xev.xclient.format = 32;
xev.xclient.data.l[0] = enabled;
xev.xclient.data.l[1] = 0;
xev.xclient.data.l[2] = 0;
XSendEvent (gdk_display,
gdk_x11_get_default_root_xwindow (),
False,
SubstructureRedirectMask | SubstructureNotifyMask,
&xev);
XFlush (gdk_display);
XSync (gdk_display, False);
}
static void
usage (void)
{
g_printerr ("Usage: metacity-message (restart|reload-theme|enable-keybindings|disable-keybindings)\n");
exit (1);
}
int
main (int argc, char **argv)
{
gtk_init (&argc, &argv);
if (argc < 2)
usage ();
if (strcmp (argv[1], "restart") == 0)
send_restart ();
else if (strcmp (argv[1], "reload-theme") == 0)
send_reload_theme ();
else if (strcmp (argv[1], "enable-keybindings") == 0)
send_set_keybindings (TRUE);
else if (strcmp (argv[1], "disable-keybindings") == 0)
send_set_keybindings (FALSE);
else
usage ();
return 0;
}

View File

@ -1,56 +0,0 @@
/* Metacity theme-reloader app */
/*
* Copyright (C) 2002 Havoc Pennington
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
int
main (int argc, char **argv)
{
XEvent xev;
gtk_init (&argc, &argv);
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;
xev.xclient.send_event = True;
xev.xclient.display = gdk_display;
xev.xclient.window = gdk_x11_get_default_root_xwindow ();
xev.xclient.message_type = XInternAtom (gdk_display,
"_METACITY_RELOAD_THEME_MESSAGE",
False);
xev.xclient.format = 32;
xev.xclient.data.l[0] = 0;
xev.xclient.data.l[1] = 0;
xev.xclient.data.l[2] = 0;
XSendEvent (gdk_display,
gdk_x11_get_default_root_xwindow (),
False,
SubstructureRedirectMask | SubstructureNotifyMask,
&xev);
XFlush (gdk_display);
XSync (gdk_display, False);
return 0;
}

View File

@ -1,56 +0,0 @@
/* Metacity restart app */
/*
* Copyright (C) 2001 Havoc Pennington
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
int
main (int argc, char **argv)
{
XEvent xev;
gtk_init (&argc, &argv);
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;
xev.xclient.send_event = True;
xev.xclient.display = gdk_display;
xev.xclient.window = gdk_x11_get_default_root_xwindow ();
xev.xclient.message_type = XInternAtom (gdk_display,
"_METACITY_RESTART_MESSAGE",
False);
xev.xclient.format = 32;
xev.xclient.data.l[0] = 0;
xev.xclient.data.l[1] = 0;
xev.xclient.data.l[2] = 0;
XSendEvent (gdk_display,
gdk_x11_get_default_root_xwindow (),
False,
SubstructureRedirectMask | SubstructureNotifyMask,
&xev);
XFlush (gdk_display);
XSync (gdk_display, False);
return 0;
}

View File

@ -195,7 +195,8 @@ utility_cb (gpointer callback_data,
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_UTILITY");
gtk_window_set_title (GTK_WINDOW (window), "Utility");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (callback_data));
vbox = gtk_vbox_new (FALSE, 0);
@ -269,7 +270,8 @@ splashscreen_cb (gpointer callback_data,
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_SPLASHSCREEN");
gtk_window_set_title (GTK_WINDOW (window), "Splashscreen");
vbox = gtk_vbox_new (FALSE, 0);
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
@ -318,7 +320,7 @@ make_dock (int type)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_DOCK");
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 0);
@ -339,21 +341,25 @@ make_dock (int type)
gtk_widget_set_size_request (window, DOCK_SIZE, gdk_screen_height ());
gtk_window_move (GTK_WINDOW (window), 0, 0);
set_gtk_window_struts (window, DOCK_SIZE, 0, 0, 0);
gtk_window_set_title (GTK_WINDOW (window), "LeftDock");
break;
case DOCK_RIGHT:
gtk_widget_set_size_request (window, DOCK_SIZE, gdk_screen_height ());
gtk_window_move (GTK_WINDOW (window), gdk_screen_width () - DOCK_SIZE, 0);
set_gtk_window_struts (window, 0, DOCK_SIZE, 0, 0);
gtk_window_set_title (GTK_WINDOW (window), "RightDock");
break;
case DOCK_TOP:
gtk_widget_set_size_request (window, gdk_screen_width (), DOCK_SIZE);
gtk_window_move (GTK_WINDOW (window), 0, 0);
set_gtk_window_struts (window, 0, 0, DOCK_SIZE, 0);
gtk_window_set_title (GTK_WINDOW (window), "TopDock");
break;
case DOCK_BOTTOM:
gtk_widget_set_size_request (window, gdk_screen_width (), DOCK_SIZE);
gtk_window_move (GTK_WINDOW (window), 0, gdk_screen_height () - DOCK_SIZE);
set_gtk_window_struts (window, 0, 0, 0, DOCK_SIZE);
gtk_window_set_title (GTK_WINDOW (window), "BottomDock");
break;
case DOCK_ALL:
break;
@ -391,6 +397,7 @@ desktop_cb (gpointer callback_data,
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_DESKTOP");
gtk_window_set_title (GTK_WINDOW (window), "Desktop");
gtk_widget_set_size_request (window,
gdk_screen_width (), gdk_screen_height ());
gtk_window_move (GTK_WINDOW (window), 0, 0);
@ -481,175 +488,176 @@ mark_set_callback (GtkTextBuffer *buffer,
update_statusbar (buffer, GTK_STATUSBAR (data));
}
static int window_count = 0;
static void
destroy_cb (GtkWidget *w, gpointer data)
{
--window_count;
if (window_count == 0)
gtk_main_quit ();
}
static GtkWidget *
do_appwindow (void)
{
static GtkWidget *window = NULL;
GtkWidget *window;
GtkWidget *table;
GtkWidget *toolbar;
GtkWidget *handlebox;
GtkWidget *statusbar;
GtkWidget *contents;
GtkWidget *sw;
GtkTextBuffer *buffer;
GtkAccelGroup *accel_group;
GtkItemFactory *item_factory;
/* Create the toplevel window
*/
++window_count;
if (!window)
{
GtkWidget *table;
GtkWidget *toolbar;
GtkWidget *handlebox;
GtkWidget *statusbar;
GtkWidget *contents;
GtkWidget *sw;
GtkTextBuffer *buffer;
GtkAccelGroup *accel_group;
GtkItemFactory *item_factory;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Application Window");
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (destroy_cb), NULL);
/* Create the toplevel window
*/
table = gtk_table_new (1, 4, FALSE);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Application Window");
/* NULL window variable when window is closed */
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_widget_destroyed),
&window);
/* Also quit ;-) */
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit),
NULL);
gtk_container_add (GTK_CONTAINER (window), table);
table = gtk_table_new (1, 4, FALSE);
/* Create the menubar
*/
gtk_container_add (GTK_CONTAINER (window), table);
accel_group = gtk_accel_group_new ();
gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
g_object_unref (accel_group);
/* Create the menubar
*/
item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", accel_group);
/* Set up item factory to go away with the window */
g_object_ref (item_factory);
gtk_object_sink (GTK_OBJECT (item_factory));
g_object_set_data_full (G_OBJECT (window),
"<main>",
item_factory,
(GDestroyNotify) g_object_unref);
/* create menu items */
gtk_item_factory_create_items (item_factory, G_N_ELEMENTS (menu_items),
menu_items, window);
gtk_table_attach (GTK_TABLE (table),
gtk_item_factory_get_widget (item_factory, "<main>"),
/* X direction */ /* Y direction */
0, 1, 0, 1,
GTK_EXPAND | GTK_FILL, 0,
0, 0);
/* Create the toolbar
*/
toolbar = gtk_toolbar_new ();
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
GTK_STOCK_NEW,
"Open another one of these windows",
NULL,
G_CALLBACK (do_appwindow),
window, /* user data for callback */
-1); /* -1 means "append" */
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
GTK_STOCK_OPEN,
"This is a demo button with an 'open' icon",
NULL,
G_CALLBACK (toolbar_cb),
window, /* user data for callback */
-1); /* -1 means "append" */
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
GTK_STOCK_QUIT,
"This is a demo button with a 'quit' icon",
NULL,
G_CALLBACK (toolbar_cb),
window, /* user data for callback */
-1); /* -1 means "append" */
handlebox = gtk_handle_box_new ();
gtk_container_add (GTK_CONTAINER (handlebox), toolbar);
accel_group = gtk_accel_group_new ();
gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
g_object_unref (accel_group);
gtk_table_attach (GTK_TABLE (table),
handlebox,
/* X direction */ /* Y direction */
0, 1, 1, 2,
GTK_EXPAND | GTK_FILL, 0,
0, 0);
/* Create document
*/
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
GTK_SHADOW_IN);
item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", accel_group);
gtk_table_attach (GTK_TABLE (table),
sw,
/* X direction */ /* Y direction */
0, 1, 2, 3,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
0, 0);
/* Set up item factory to go away with the window */
g_object_ref (item_factory);
gtk_object_sink (GTK_OBJECT (item_factory));
g_object_set_data_full (G_OBJECT (window),
"<main>",
item_factory,
(GDestroyNotify) g_object_unref);
/* create menu items */
gtk_item_factory_create_items (item_factory, G_N_ELEMENTS (menu_items),
menu_items, window);
gtk_table_attach (GTK_TABLE (table),
gtk_item_factory_get_widget (item_factory, "<main>"),
/* X direction */ /* Y direction */
0, 1, 0, 1,
GTK_EXPAND | GTK_FILL, 0,
0, 0);
/* Create the toolbar
*/
toolbar = gtk_toolbar_new ();
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
GTK_STOCK_OPEN,
"This is a demo button with an 'open' icon",
NULL,
G_CALLBACK (toolbar_cb),
window, /* user data for callback */
-1); /* -1 means "append" */
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
GTK_STOCK_QUIT,
"This is a demo button with a 'quit' icon",
NULL,
G_CALLBACK (toolbar_cb),
window, /* user data for callback */
-1); /* -1 means "append" */
handlebox = gtk_handle_box_new ();
gtk_container_add (GTK_CONTAINER (handlebox), toolbar);
gtk_window_set_default_size (GTK_WINDOW (window),
200, 200);
gtk_table_attach (GTK_TABLE (table),
handlebox,
/* X direction */ /* Y direction */
0, 1, 1, 2,
GTK_EXPAND | GTK_FILL, 0,
0, 0);
/* Create document
*/
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
GTK_SHADOW_IN);
contents = gtk_text_view_new ();
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (contents),
PANGO_WRAP_WORD);
gtk_table_attach (GTK_TABLE (table),
sw,
/* X direction */ /* Y direction */
0, 1, 2, 3,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
0, 0);
gtk_container_add (GTK_CONTAINER (sw),
contents);
gtk_window_set_default_size (GTK_WINDOW (window),
200, 200);
/* Create statusbar */
statusbar = gtk_statusbar_new ();
gtk_table_attach (GTK_TABLE (table),
statusbar,
/* X direction */ /* Y direction */
0, 1, 3, 4,
GTK_EXPAND | GTK_FILL, 0,
0, 0);
/* Show text widget info in the statusbar */
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (contents));
gtk_text_buffer_set_text (buffer,
"This demo demonstrates various kinds of windows that "
"window managers and window manager themes should handle. "
"Be sure to tear off the menu and toolbar, those are also "
"a special kind of window.",
-1);
contents = gtk_text_view_new ();
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (contents),
PANGO_WRAP_WORD);
g_signal_connect_object (buffer,
"changed",
G_CALLBACK (update_statusbar),
statusbar,
0);
g_signal_connect_object (buffer,
"mark_set", /* cursor moved */
G_CALLBACK (mark_set_callback),
statusbar,
0);
gtk_container_add (GTK_CONTAINER (sw),
contents);
update_statusbar (buffer, GTK_STATUSBAR (statusbar));
/* Create statusbar */
statusbar = gtk_statusbar_new ();
gtk_table_attach (GTK_TABLE (table),
statusbar,
/* X direction */ /* Y direction */
0, 1, 3, 4,
GTK_EXPAND | GTK_FILL, 0,
0, 0);
/* Show text widget info in the statusbar */
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (contents));
gtk_text_buffer_set_text (buffer,
"This demo demonstrates various kinds of windows that "
"window managers and window manager themes should handle. "
"Be sure to tear off the menu and toolbar, those are also "
"a special kind of window.",
-1);
g_signal_connect_object (buffer,
"changed",
G_CALLBACK (update_statusbar),
statusbar,
0);
g_signal_connect_object (buffer,
"mark_set", /* cursor moved */
G_CALLBACK (mark_set_callback),
statusbar,
0);
update_statusbar (buffer, GTK_STATUSBAR (statusbar));
}
if (!GTK_WIDGET_VISIBLE (window))
{
gtk_widget_show_all (window);
}
else
{
gtk_widget_destroy (window);
window = NULL;
}
gtk_widget_show_all (window);
return window;
}

View File

@ -1085,11 +1085,13 @@ void
meta_window_show (MetaWindow *window)
{
gboolean did_placement;
gboolean did_show;
meta_topic (META_DEBUG_WINDOW_STATE,
"Showing window %s, shaded: %d iconic: %d placed: %d\n",
window->desc, window->shaded, window->iconic, window->placed);
did_show = FALSE;
did_placement = FALSE;
if (!window->placed)
{
@ -1155,7 +1157,8 @@ meta_window_show (MetaWindow *window)
meta_error_trap_push (window->display);
XMapWindow (window->display->xdisplay, window->xwindow);
meta_error_trap_pop (window->display);
}
did_show = TRUE;
}
if (window->iconic)
{
@ -1190,6 +1193,17 @@ meta_window_show (MetaWindow *window)
meta_window_focus (window,
meta_display_get_current_time (window->display));
}
if (did_show)
{
if (window->has_struts)
{
meta_topic (META_DEBUG_WORKAREA,
"Mapped window %s with struts, so invalidating work areas\n",
window->desc);
invalidate_work_areas (window);
}
}
}
void

View File

@ -334,7 +334,8 @@ void
meta_workspace_invalidate_work_area (MetaWorkspace *workspace)
{
GList *tmp;
GList *windows;
if (workspace->work_area_invalid)
{
meta_topic (META_DEBUG_WORKAREA,
@ -350,15 +351,18 @@ meta_workspace_invalidate_work_area (MetaWorkspace *workspace)
workspace->work_area_invalid = TRUE;
/* redo the size/position constraints on all windows */
tmp = workspace->windows;
windows = meta_workspace_list_windows (workspace);
tmp = windows;
while (tmp != NULL)
{
MetaWindow *w = tmp->data;
meta_window_queue_move_resize (w);
tmp = tmp->next;
}
g_list_free (windows);
}
void