summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2002-02-08 06:01:58 +0000
committerHavoc Pennington <hp@src.gnome.org>2002-02-08 06:01:58 +0000
commit51d9f9dce63404f6c74a15d874a105726fdc95f4 (patch)
tree3ef244747b544be0fdee77184cdfdfac49e3006f /src/tools
parent43b67afc41b55340bc358ef4ddf271b965b72244 (diff)
downloadmetacity-51d9f9dce63404f6c74a15d874a105726fdc95f4.tar.gz
metacity-51d9f9dce63404f6c74a15d874a105726fdc95f4.tar.bz2
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
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/Makefile.am14
-rw-r--r--src/tools/metacity-message.c139
-rw-r--r--src/tools/metacity-reload-theme.c56
-rw-r--r--src/tools/metacity-restart.c56
-rw-r--r--src/tools/metacity-window-demo.c312
5 files changed, 304 insertions, 273 deletions
diff --git a/src/tools/Makefile.am b/src/tools/Makefile.am
index c9f4fb7..29d8531 100644
--- a/src/tools/Makefile.am
+++ b/src/tools/Makefile.am
@@ -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@
diff --git a/src/tools/metacity-message.c b/src/tools/metacity-message.c
new file mode 100644
index 0000000..5188615
--- /dev/null
+++ b/src/tools/metacity-message.c
@@ -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;
+}
+
diff --git a/src/tools/metacity-reload-theme.c b/src/tools/metacity-reload-theme.c
deleted file mode 100644
index 0ef19d5..0000000
--- a/src/tools/metacity-reload-theme.c
+++ /dev/null
@@ -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;
-}
-
diff --git a/src/tools/metacity-restart.c b/src/tools/metacity-restart.c
deleted file mode 100644
index c1eacba..0000000
--- a/src/tools/metacity-restart.c
+++ /dev/null
@@ -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;
-}
-
diff --git a/src/tools/metacity-window-demo.c b/src/tools/metacity-window-demo.c
index 71bd9ec..9e87371 100644
--- a/src/tools/metacity-window-demo.c
+++ b/src/tools/metacity-window-demo.c
@@ -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;
-
- if (!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
- */
+ GtkWidget *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");
-
- /* 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);
+ /* Create the toplevel window
+ */
+
+ ++window_count;
+
+ 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);
- table = gtk_table_new (1, 4, FALSE);
+ table = gtk_table_new (1, 4, FALSE);
- gtk_container_add (GTK_CONTAINER (window), table);
+ gtk_container_add (GTK_CONTAINER (window), table);
- /* Create the menubar
- */
+ /* Create the menubar
+ */
- accel_group = gtk_accel_group_new ();
- gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
- g_object_unref (accel_group);
+ accel_group = gtk_accel_group_new ();
+ gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
+ g_object_unref (accel_group);
- 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_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);
+ 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);
- gtk_table_attach (GTK_TABLE (table),
- handlebox,
- /* X direction */ /* Y direction */
- 0, 1, 1, 2,
- GTK_EXPAND | GTK_FILL, 0,
- 0, 0);
+ gtk_table_attach (GTK_TABLE (table),
+ handlebox,
+ /* X direction */ /* Y direction */
+ 0, 1, 1, 2,
+ GTK_EXPAND | GTK_FILL, 0,
+ 0, 0);
- /* Create document
- */
+ /* Create document
+ */
- sw = gtk_scrolled_window_new (NULL, NULL);
+ 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_policy (GTK_SCROLLED_WINDOW (sw),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
- GTK_SHADOW_IN);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
+ GTK_SHADOW_IN);
- 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_window_set_default_size (GTK_WINDOW (window),
- 200, 200);
+ 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_window_set_default_size (GTK_WINDOW (window),
+ 200, 200);
- contents = gtk_text_view_new ();
- gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (contents),
- PANGO_WRAP_WORD);
+ contents = gtk_text_view_new ();
+ gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (contents),
+ PANGO_WRAP_WORD);
- gtk_container_add (GTK_CONTAINER (sw),
- contents);
-
- /* 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);
+ gtk_container_add (GTK_CONTAINER (sw),
+ contents);
+
+ /* 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);
+ 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));
- }
+ 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;
}