mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
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:
parent
43b67afc41
commit
51d9f9dce6
21
ChangeLog
21
ChangeLog
@ -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>
|
2002-02-07 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
* src/run-metacity.sh: if DEMO_TEST is set then run the window
|
* src/run-metacity.sh: if DEMO_TEST is set then run the window
|
||||||
|
@ -85,8 +85,7 @@ AM_GLIB_GNU_GETTEXT
|
|||||||
|
|
||||||
## here we get the flags we'll actually use
|
## 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, 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_MESSAGE, gtk+-2.0 >= 1.3.13)
|
||||||
PKG_CHECK_MODULES(METACITY_RELOAD_THEME, gtk+-2.0 >= 1.3.13)
|
|
||||||
PKG_CHECK_MODULES(METACITY_WINDOW_DEMO, gtk+-2.0 >= 1.3.13)
|
PKG_CHECK_MODULES(METACITY_WINDOW_DEMO, gtk+-2.0 >= 1.3.13)
|
||||||
|
|
||||||
CFLAGS="$METACITY_CFLAGS $CFLAGS"
|
CFLAGS="$METACITY_CFLAGS $CFLAGS"
|
||||||
|
@ -142,7 +142,8 @@ meta_display_open (const char *name)
|
|||||||
"_METACITY_RESTART_MESSAGE",
|
"_METACITY_RESTART_MESSAGE",
|
||||||
"_NET_WM_STRUT",
|
"_NET_WM_STRUT",
|
||||||
"_WIN_HINTS",
|
"_WIN_HINTS",
|
||||||
"_METACITY_RELOAD_THEME_MESSAGE"
|
"_METACITY_RELOAD_THEME_MESSAGE",
|
||||||
|
"_METACITY_SET_KEYBINDINGS_MESSAGE"
|
||||||
};
|
};
|
||||||
Atom atoms[G_N_ELEMENTS(atom_names)];
|
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_net_wm_strut = atoms[45];
|
||||||
display->atom_win_hints = atoms[46];
|
display->atom_win_hints = atoms[46];
|
||||||
display->atom_metacity_reload_theme_message = atoms[47];
|
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,
|
/* Offscreen unmapped window used for _NET_SUPPORTING_WM_CHECK,
|
||||||
* created in screen_new
|
* created in screen_new
|
||||||
@ -1116,6 +1118,13 @@ event_callback (XEvent *event,
|
|||||||
TRUE);
|
TRUE);
|
||||||
meta_display_retheme_all ();
|
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;
|
break;
|
||||||
|
@ -107,6 +107,7 @@ struct _MetaDisplay
|
|||||||
Atom atom_net_wm_strut;
|
Atom atom_net_wm_strut;
|
||||||
Atom atom_win_hints;
|
Atom atom_win_hints;
|
||||||
Atom atom_metacity_reload_theme_message;
|
Atom atom_metacity_reload_theme_message;
|
||||||
|
Atom atom_metacity_set_keybindings_message;
|
||||||
|
|
||||||
/* This is the actual window from focus events,
|
/* This is the actual window from focus events,
|
||||||
* not the one we last set
|
* not the one we last set
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
/* Plainly we'll want some more configurable keybinding system
|
/* Plainly we'll want some more configurable keybinding system
|
||||||
* eventually.
|
* eventually.
|
||||||
*/
|
*/
|
||||||
|
static gboolean all_bindings_disabled = FALSE;
|
||||||
|
|
||||||
typedef void (* MetaKeyHandler) (MetaDisplay *display,
|
typedef void (* MetaKeyHandler) (MetaDisplay *display,
|
||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
@ -78,7 +79,6 @@ static void handle_spew_mark (MetaDisplay *display,
|
|||||||
XEvent *event,
|
XEvent *event,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
|
|
||||||
static gboolean process_keyboard_move_grab (MetaDisplay *display,
|
static gboolean process_keyboard_move_grab (MetaDisplay *display,
|
||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
XEvent *event,
|
XEvent *event,
|
||||||
@ -208,7 +208,7 @@ meta_change_keygrab (MetaDisplay *display,
|
|||||||
modmask | ignored_mask,
|
modmask | ignored_mask,
|
||||||
xwindow,
|
xwindow,
|
||||||
True,
|
True,
|
||||||
GrabModeAsync, GrabModeAsync);
|
GrabModeAsync, GrabModeSync);
|
||||||
else
|
else
|
||||||
XUngrabKey (display->xdisplay, keycode,
|
XUngrabKey (display->xdisplay, keycode,
|
||||||
modmask | ignored_mask,
|
modmask | ignored_mask,
|
||||||
@ -542,6 +542,12 @@ meta_display_process_key_event (MetaDisplay *display,
|
|||||||
KeySym keysym;
|
KeySym keysym;
|
||||||
gboolean handled;
|
gboolean handled;
|
||||||
|
|
||||||
|
XAllowEvents (display->xdisplay,
|
||||||
|
all_bindings_disabled ? ReplayKeyboard : AsyncKeyboard,
|
||||||
|
event->xkey.time);
|
||||||
|
if (all_bindings_disabled)
|
||||||
|
return;
|
||||||
|
|
||||||
/* window may be NULL */
|
/* window may be NULL */
|
||||||
|
|
||||||
keysym = XKeycodeToKeysym (display->xdisplay, event->xkey.keycode, 0);
|
keysym = XKeycodeToKeysym (display->xdisplay, event->xkey.keycode, 0);
|
||||||
@ -1117,3 +1123,18 @@ handle_spew_mark (MetaDisplay *display,
|
|||||||
meta_verbose ("-- MARK MARK MARK MARK --\n");
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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_message_SOURCES= \
|
||||||
metacity-restart.c
|
metacity-message.c
|
||||||
|
|
||||||
metacity_reload_theme_SOURCES= \
|
|
||||||
metacity-reload-theme.c
|
|
||||||
|
|
||||||
metacity_window_demo_SOURCES= \
|
metacity_window_demo_SOURCES= \
|
||||||
metacity-window-demo.c
|
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_message_LDADD= @METACITY_MESSAGE_LIBS@
|
||||||
metacity_reload_theme_LDADD= @METACITY_RELOAD_THEME_LIBS@
|
|
||||||
metacity_window_demo_LDADD= @METACITY_WINDOW_DEMO_LIBS@
|
metacity_window_demo_LDADD= @METACITY_WINDOW_DEMO_LIBS@
|
||||||
|
139
src/tools/metacity-message.c
Normal file
139
src/tools/metacity-message.c
Normal 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;
|
||||||
|
}
|
||||||
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
@ -195,6 +195,7 @@ utility_cb (gpointer callback_data,
|
|||||||
|
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_UTILITY");
|
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));
|
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (callback_data));
|
||||||
|
|
||||||
@ -269,6 +270,7 @@ splashscreen_cb (gpointer callback_data,
|
|||||||
|
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_SPLASHSCREEN");
|
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);
|
vbox = gtk_vbox_new (FALSE, 0);
|
||||||
|
|
||||||
@ -339,21 +341,25 @@ make_dock (int type)
|
|||||||
gtk_widget_set_size_request (window, DOCK_SIZE, gdk_screen_height ());
|
gtk_widget_set_size_request (window, DOCK_SIZE, gdk_screen_height ());
|
||||||
gtk_window_move (GTK_WINDOW (window), 0, 0);
|
gtk_window_move (GTK_WINDOW (window), 0, 0);
|
||||||
set_gtk_window_struts (window, DOCK_SIZE, 0, 0, 0);
|
set_gtk_window_struts (window, DOCK_SIZE, 0, 0, 0);
|
||||||
|
gtk_window_set_title (GTK_WINDOW (window), "LeftDock");
|
||||||
break;
|
break;
|
||||||
case DOCK_RIGHT:
|
case DOCK_RIGHT:
|
||||||
gtk_widget_set_size_request (window, DOCK_SIZE, gdk_screen_height ());
|
gtk_widget_set_size_request (window, DOCK_SIZE, gdk_screen_height ());
|
||||||
gtk_window_move (GTK_WINDOW (window), gdk_screen_width () - DOCK_SIZE, 0);
|
gtk_window_move (GTK_WINDOW (window), gdk_screen_width () - DOCK_SIZE, 0);
|
||||||
set_gtk_window_struts (window, 0, DOCK_SIZE, 0, 0);
|
set_gtk_window_struts (window, 0, DOCK_SIZE, 0, 0);
|
||||||
|
gtk_window_set_title (GTK_WINDOW (window), "RightDock");
|
||||||
break;
|
break;
|
||||||
case DOCK_TOP:
|
case DOCK_TOP:
|
||||||
gtk_widget_set_size_request (window, gdk_screen_width (), DOCK_SIZE);
|
gtk_widget_set_size_request (window, gdk_screen_width (), DOCK_SIZE);
|
||||||
gtk_window_move (GTK_WINDOW (window), 0, 0);
|
gtk_window_move (GTK_WINDOW (window), 0, 0);
|
||||||
set_gtk_window_struts (window, 0, 0, DOCK_SIZE, 0);
|
set_gtk_window_struts (window, 0, 0, DOCK_SIZE, 0);
|
||||||
|
gtk_window_set_title (GTK_WINDOW (window), "TopDock");
|
||||||
break;
|
break;
|
||||||
case DOCK_BOTTOM:
|
case DOCK_BOTTOM:
|
||||||
gtk_widget_set_size_request (window, gdk_screen_width (), DOCK_SIZE);
|
gtk_widget_set_size_request (window, gdk_screen_width (), DOCK_SIZE);
|
||||||
gtk_window_move (GTK_WINDOW (window), 0, gdk_screen_height () - DOCK_SIZE);
|
gtk_window_move (GTK_WINDOW (window), 0, gdk_screen_height () - DOCK_SIZE);
|
||||||
set_gtk_window_struts (window, 0, 0, 0, DOCK_SIZE);
|
set_gtk_window_struts (window, 0, 0, 0, DOCK_SIZE);
|
||||||
|
gtk_window_set_title (GTK_WINDOW (window), "BottomDock");
|
||||||
break;
|
break;
|
||||||
case DOCK_ALL:
|
case DOCK_ALL:
|
||||||
break;
|
break;
|
||||||
@ -391,6 +397,7 @@ desktop_cb (gpointer callback_data,
|
|||||||
|
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_DESKTOP");
|
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,
|
gtk_widget_set_size_request (window,
|
||||||
gdk_screen_width (), gdk_screen_height ());
|
gdk_screen_width (), gdk_screen_height ());
|
||||||
gtk_window_move (GTK_WINDOW (window), 0, 0);
|
gtk_window_move (GTK_WINDOW (window), 0, 0);
|
||||||
@ -481,13 +488,20 @@ mark_set_callback (GtkTextBuffer *buffer,
|
|||||||
update_statusbar (buffer, GTK_STATUSBAR (data));
|
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 *
|
static GtkWidget *
|
||||||
do_appwindow (void)
|
do_appwindow (void)
|
||||||
{
|
{
|
||||||
static GtkWidget *window = NULL;
|
GtkWidget *window;
|
||||||
|
|
||||||
if (!window)
|
|
||||||
{
|
|
||||||
GtkWidget *table;
|
GtkWidget *table;
|
||||||
GtkWidget *toolbar;
|
GtkWidget *toolbar;
|
||||||
GtkWidget *handlebox;
|
GtkWidget *handlebox;
|
||||||
@ -501,18 +515,13 @@ do_appwindow (void)
|
|||||||
/* Create the toplevel window
|
/* Create the toplevel window
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
++window_count;
|
||||||
|
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_title (GTK_WINDOW (window), "Application Window");
|
gtk_window_set_title (GTK_WINDOW (window), "Application Window");
|
||||||
|
|
||||||
/* NULL window variable when window is closed */
|
|
||||||
g_signal_connect (G_OBJECT (window), "destroy",
|
g_signal_connect (G_OBJECT (window), "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed),
|
G_CALLBACK (destroy_cb), NULL);
|
||||||
&window);
|
|
||||||
|
|
||||||
/* Also quit ;-) */
|
|
||||||
g_signal_connect (G_OBJECT (window), "destroy",
|
|
||||||
G_CALLBACK (gtk_main_quit),
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
table = gtk_table_new (1, 4, FALSE);
|
table = gtk_table_new (1, 4, FALSE);
|
||||||
|
|
||||||
@ -550,6 +559,14 @@ do_appwindow (void)
|
|||||||
*/
|
*/
|
||||||
toolbar = gtk_toolbar_new ();
|
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_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
|
||||||
GTK_STOCK_OPEN,
|
GTK_STOCK_OPEN,
|
||||||
"This is a demo button with an 'open' icon",
|
"This is a demo button with an 'open' icon",
|
||||||
@ -583,7 +600,7 @@ do_appwindow (void)
|
|||||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||||
|
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||||
GTK_POLICY_NEVER,
|
GTK_POLICY_AUTOMATIC,
|
||||||
GTK_POLICY_AUTOMATIC);
|
GTK_POLICY_AUTOMATIC);
|
||||||
|
|
||||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
|
||||||
@ -639,17 +656,8 @@ do_appwindow (void)
|
|||||||
0);
|
0);
|
||||||
|
|
||||||
update_statusbar (buffer, GTK_STATUSBAR (statusbar));
|
update_statusbar (buffer, GTK_STATUSBAR (statusbar));
|
||||||
}
|
|
||||||
|
|
||||||
if (!GTK_WIDGET_VISIBLE (window))
|
|
||||||
{
|
|
||||||
gtk_widget_show_all (window);
|
gtk_widget_show_all (window);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gtk_widget_destroy (window);
|
|
||||||
window = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
14
src/window.c
14
src/window.c
@ -1085,11 +1085,13 @@ void
|
|||||||
meta_window_show (MetaWindow *window)
|
meta_window_show (MetaWindow *window)
|
||||||
{
|
{
|
||||||
gboolean did_placement;
|
gboolean did_placement;
|
||||||
|
gboolean did_show;
|
||||||
|
|
||||||
meta_topic (META_DEBUG_WINDOW_STATE,
|
meta_topic (META_DEBUG_WINDOW_STATE,
|
||||||
"Showing window %s, shaded: %d iconic: %d placed: %d\n",
|
"Showing window %s, shaded: %d iconic: %d placed: %d\n",
|
||||||
window->desc, window->shaded, window->iconic, window->placed);
|
window->desc, window->shaded, window->iconic, window->placed);
|
||||||
|
|
||||||
|
did_show = FALSE;
|
||||||
did_placement = FALSE;
|
did_placement = FALSE;
|
||||||
if (!window->placed)
|
if (!window->placed)
|
||||||
{
|
{
|
||||||
@ -1155,6 +1157,7 @@ meta_window_show (MetaWindow *window)
|
|||||||
meta_error_trap_push (window->display);
|
meta_error_trap_push (window->display);
|
||||||
XMapWindow (window->display->xdisplay, window->xwindow);
|
XMapWindow (window->display->xdisplay, window->xwindow);
|
||||||
meta_error_trap_pop (window->display);
|
meta_error_trap_pop (window->display);
|
||||||
|
did_show = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->iconic)
|
if (window->iconic)
|
||||||
@ -1190,6 +1193,17 @@ meta_window_show (MetaWindow *window)
|
|||||||
meta_window_focus (window,
|
meta_window_focus (window,
|
||||||
meta_display_get_current_time (window->display));
|
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
|
void
|
||||||
|
@ -334,6 +334,7 @@ void
|
|||||||
meta_workspace_invalidate_work_area (MetaWorkspace *workspace)
|
meta_workspace_invalidate_work_area (MetaWorkspace *workspace)
|
||||||
{
|
{
|
||||||
GList *tmp;
|
GList *tmp;
|
||||||
|
GList *windows;
|
||||||
|
|
||||||
if (workspace->work_area_invalid)
|
if (workspace->work_area_invalid)
|
||||||
{
|
{
|
||||||
@ -350,7 +351,8 @@ meta_workspace_invalidate_work_area (MetaWorkspace *workspace)
|
|||||||
workspace->work_area_invalid = TRUE;
|
workspace->work_area_invalid = TRUE;
|
||||||
|
|
||||||
/* redo the size/position constraints on all windows */
|
/* redo the size/position constraints on all windows */
|
||||||
tmp = workspace->windows;
|
windows = meta_workspace_list_windows (workspace);
|
||||||
|
tmp = windows;
|
||||||
while (tmp != NULL)
|
while (tmp != NULL)
|
||||||
{
|
{
|
||||||
MetaWindow *w = tmp->data;
|
MetaWindow *w = tmp->data;
|
||||||
@ -359,6 +361,8 @@ meta_workspace_invalidate_work_area (MetaWorkspace *workspace)
|
|||||||
|
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_list_free (windows);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user