e4ffe50cbb
icons undeneath the panel. This version of gnomepanel starts applets in the correct order, fixes a problem with focus, and updates a few of the translations.
441 lines
12 KiB
Text
441 lines
12 KiB
Text
This patch reverts fully rev.1.50 of xstuff.c and rev.1.22 of xstuff.h, as
|
|
well as partially rev.1.302 of session.c and rev.1.176 of basep-widget.c.
|
|
The goal is to make Nautilus recognizing presence of the panel on screen,
|
|
so that it doesn't put its icons under the panel(s). For some reason,
|
|
advertized in ChangeLog _NET_WM_WORKAREA isn't recognised by Nautilus-2.0.0
|
|
available at this time.
|
|
|
|
--- gnome-panel/xstuff.c.orig Sun Aug 4 18:30:21 2002
|
|
+++ gnome-panel/xstuff.c Thu Aug 8 22:19:15 2002
|
|
@@ -8,46 +8,97 @@
|
|
* Mark McLoughlin <mark@skynet.ie>
|
|
*/
|
|
#include <config.h>
|
|
-#include <string.h>
|
|
-
|
|
-#include <gdk/gdk.h>
|
|
#include <gdk/gdkx.h>
|
|
+#include <string.h>
|
|
|
|
+#include <X11/Xmd.h>
|
|
#include <X11/Xlib.h>
|
|
#include <X11/Xatom.h>
|
|
|
|
-#include "xstuff.h"
|
|
+/* Yes, yes I know, now bugger off ... */
|
|
+#define WNCK_I_KNOW_THIS_IS_UNSTABLE
|
|
+#include <libwnck/libwnck.h>
|
|
|
|
+#include "xstuff.h"
|
|
+#include "multiscreen-stuff.h"
|
|
+#include "basep-widget.h"
|
|
+#include "foobar-widget.h"
|
|
#include "global-keys.h"
|
|
|
|
-static Atom
|
|
-panel_atom_get (Display *display,
|
|
- const char *atom_name)
|
|
+/*list of all panel widgets created*/
|
|
+extern GSList *panel_list;
|
|
+
|
|
+static void xstuff_setup_global_desktop_area (int left, int right,
|
|
+ int top, int bottom);
|
|
+
|
|
+#define ATOM(name) xstuff_atom_intern(GDK_DISPLAY(),name)
|
|
+/* Once we have multiple display support we need to only use
|
|
+ * the below ones */
|
|
+
|
|
+#define ATOMD(display,name) xstuff_atom_intern(display,name)
|
|
+#define ATOMEV(event,name) xstuff_atom_intern(((XAnyEvent *)event)->display,name)
|
|
+#define ATOMGDK(win,name) xstuff_atom_intern(GDK_WINDOW_XDISPLAY(win),name)
|
|
+
|
|
+Atom
|
|
+xstuff_atom_intern (Display *display, const char *name)
|
|
{
|
|
- static GHashTable *atom_hash;
|
|
- Atom retval;
|
|
+ static GHashTable *cache = NULL;
|
|
+ char *key;
|
|
+ Atom atom;
|
|
|
|
g_return_val_if_fail (display != NULL, None);
|
|
- g_return_val_if_fail (atom_name != NULL, None);
|
|
+ g_return_val_if_fail (name != NULL, None);
|
|
+
|
|
+ if (cache == 0)
|
|
+ cache = g_hash_table_new (g_str_hash, g_str_equal);
|
|
|
|
- if (!atom_hash)
|
|
- atom_hash = g_hash_table_new_full (
|
|
- g_str_hash, g_str_equal, g_free, NULL);
|
|
-
|
|
- retval = GPOINTER_TO_UINT (g_hash_table_lookup (atom_hash, atom_name));
|
|
- if (!retval) {
|
|
- retval = XInternAtom (display, atom_name, FALSE);
|
|
-
|
|
- if (retval != None)
|
|
- g_hash_table_insert (atom_hash, g_strdup (atom_name),
|
|
- GUINT_TO_POINTER (retval));
|
|
+ key = g_strdup_printf ("%p %s", display, name);
|
|
+
|
|
+ atom = (Atom)g_hash_table_lookup (cache, key);
|
|
+ if (atom == 0) {
|
|
+ atom = XInternAtom (display, name, False);
|
|
+ g_hash_table_insert (cache, key, (gpointer)atom);
|
|
+ } else {
|
|
+ g_free (key);
|
|
}
|
|
|
|
- return retval;
|
|
+ return atom;
|
|
+}
|
|
+
|
|
+void
|
|
+xstuff_init (void)
|
|
+{
|
|
+ /* setup the keys filter */
|
|
+ gdk_window_add_filter (gdk_get_default_root_window (),
|
|
+ panel_global_keys_filter,
|
|
+ NULL);
|
|
+
|
|
+ gdk_error_trap_push ();
|
|
+
|
|
+ xstuff_setup_global_desktop_area (0, 0, 0, 0);
|
|
+
|
|
+ gdk_error_trap_pop ();
|
|
+}
|
|
+
|
|
+void
|
|
+xstuff_set_simple_hint (GdkWindow *w, const char *name, long val)
|
|
+{
|
|
+ Atom atom = ATOMGDK (w, name);
|
|
+
|
|
+ gdk_error_trap_push ();
|
|
+
|
|
+ XChangeProperty (GDK_DISPLAY (),
|
|
+ GDK_WINDOW_XWINDOW (w),
|
|
+ atom, atom,
|
|
+ 32, PropModeReplace,
|
|
+ (unsigned char*)&val, 1);
|
|
+
|
|
+ gdk_flush ();
|
|
+ gdk_error_trap_pop ();
|
|
}
|
|
|
|
/* Stolen from deskguide */
|
|
-static gpointer
|
|
+gpointer
|
|
get_typed_property_data (Display *xdisplay,
|
|
Window xwindow,
|
|
Atom property,
|
|
@@ -156,7 +207,7 @@
|
|
|
|
data = get_typed_property_data (GDK_DISPLAY (),
|
|
GDK_ROOT_WINDOW (),
|
|
- panel_atom_get (GDK_DISPLAY (), "_NET_SUPPORTED"),
|
|
+ ATOM ("_NET_SUPPORTED"),
|
|
XA_ATOM,
|
|
&size, 32);
|
|
if (data != NULL) {
|
|
@@ -176,11 +227,9 @@
|
|
|
|
XDeleteProperty (GDK_WINDOW_XDISPLAY (win),
|
|
GDK_WINDOW_XWINDOW (win),
|
|
- panel_atom_get (GDK_WINDOW_XDISPLAY (win),
|
|
- "WM_CLIENT_LEADER"));
|
|
+ ATOMGDK (win, "WM_CLIENT_LEADER"));
|
|
|
|
- old_wmhints = XGetWMHints (GDK_WINDOW_XDISPLAY (win),
|
|
- GDK_WINDOW_XWINDOW (win));
|
|
+ old_wmhints = XGetWMHints (GDK_DISPLAY (), GDK_WINDOW_XWINDOW (win));
|
|
/* General paranoia */
|
|
if (old_wmhints != NULL) {
|
|
memcpy (&wmhints, old_wmhints, sizeof (XWMHints));
|
|
@@ -197,16 +246,124 @@
|
|
wmhints.input = False;
|
|
wmhints.initial_state = NormalState;
|
|
}
|
|
-
|
|
- XSetWMHints (GDK_WINDOW_XDISPLAY (win),
|
|
+ XSetWMHints (GDK_DISPLAY (),
|
|
GDK_WINDOW_XWINDOW (win),
|
|
&wmhints);
|
|
}
|
|
|
|
+
|
|
+static void
|
|
+xstuff_setup_global_desktop_area (int left, int right, int top, int bottom)
|
|
+{
|
|
+ long vals[4];
|
|
+ static int old_left = -1, old_right = -1, old_top = -1, old_bottom = -1;+
|
|
+ left = left >= 0 ? left : old_left;
|
|
+ right = right >= 0 ? right : old_right;
|
|
+ top = top >= 0 ? top : old_top;
|
|
+ bottom = bottom >= 0 ? bottom : old_bottom;
|
|
+
|
|
+ if (old_left == left &&
|
|
+ old_right == right &&
|
|
+ old_top == top &&
|
|
+ old_bottom == bottom)
|
|
+ return;
|
|
+
|
|
+ vals[0] = left;
|
|
+ vals[1] = right;
|
|
+ vals[2] = top;
|
|
+ vals[3] = bottom;
|
|
+
|
|
+ XChangeProperty (GDK_DISPLAY (),
|
|
+ GDK_ROOT_WINDOW (),
|
|
+ ATOM ("GNOME_PANEL_DESKTOP_AREA"),
|
|
+ XA_CARDINAL,
|
|
+ 32, PropModeReplace,
|
|
+ (unsigned char *)vals, 4);
|
|
+
|
|
+ old_left = left;
|
|
+ old_right = right;
|
|
+ old_top = top;
|
|
+ old_bottom = bottom;
|
|
+}
|
|
+
|
|
+void
|
|
+xstuff_setup_desktop_area (int screen, int left, int right, int top, int bottom)
|
|
+{
|
|
+ char *screen_atom;
|
|
+ long vals[4];
|
|
+ static int screen_width = -1, screen_height = -1;
|
|
+
|
|
+ if (screen_width < 0)
|
|
+ screen_width = gdk_screen_width ();
|
|
+ if (screen_height < 0)
|
|
+ screen_height = gdk_screen_height ();
|
|
+
|
|
+ vals[0] = left;
|
|
+ vals[1] = right;
|
|
+ vals[2] = top;
|
|
+ vals[3] = bottom;
|
|
+
|
|
+ gdk_error_trap_push ();
|
|
+
|
|
+ /* Note, when we do standard multihead and we have per screen
|
|
+ * root window, this should just set the GNOME_PANEL_DESKTOP_AREA */
|
|
+ screen_atom = g_strdup_printf ("GNOME_PANEL_DESKTOP_AREA_%d",
|
|
+ screen);
|
|
+ XChangeProperty (GDK_DISPLAY (),
|
|
+ GDK_ROOT_WINDOW (),
|
|
+ ATOM (screen_atom),
|
|
+ XA_CARDINAL,
|
|
+ 32, PropModeReplace,
|
|
+ (unsigned char *)vals, 4);
|
|
+
|
|
+ g_free (screen_atom);
|
|
+
|
|
+ xstuff_setup_global_desktop_area
|
|
+ ((multiscreen_x (screen) == 0) ? left : -1,
|
|
+ (multiscreen_x (screen) +
|
|
+ multiscreen_width (screen) == screen_width) ? right : -1,
|
|
+ (multiscreen_y (screen) == 0) ? top : -1,
|
|
+ (multiscreen_y (screen) +
|
|
+ multiscreen_height (screen) == screen_height) ? bottom : -1);
|
|
+
|
|
+ gdk_flush ();
|
|
+ gdk_error_trap_pop ();
|
|
+}
|
|
+
|
|
+void
|
|
+xstuff_unsetup_desktop_area (void)
|
|
+{
|
|
+ int i;
|
|
+ char *screen_atom;
|
|
+
|
|
+ gdk_error_trap_push ();
|
|
+
|
|
+ XDeleteProperty (GDK_DISPLAY (),
|
|
+ GDK_ROOT_WINDOW (),
|
|
+ ATOM ("GNOME_PANEL_DESKTOP_AREA"));
|
|
+
|
|
+ for (i = 0; i < multiscreen_screens (); i++) {
|
|
+ screen_atom =
|
|
+ g_strdup_printf ("GNOME_PANEL_DESKTOP_AREA_%d", i);
|
|
+
|
|
+ XDeleteProperty (GDK_DISPLAY (),
|
|
+ GDK_ROOT_WINDOW (),
|
|
+ ATOM (screen_atom));
|
|
+
|
|
+ g_free (screen_atom);
|
|
+ }
|
|
+
|
|
+ gdk_flush ();
|
|
+ gdk_error_trap_pop ();
|
|
+}
|
|
+
|
|
+
|
|
+
|
|
/* This is such a broken stupid function. */
|
|
void
|
|
xstuff_set_pos_size (GdkWindow *window, int x, int y, int w, int h)
|
|
{
|
|
+ Window win = GDK_WINDOW_XWINDOW (window);
|
|
XSizeHints size_hints;
|
|
int old_x, old_y, old_w, old_h;
|
|
|
|
@@ -231,9 +388,7 @@
|
|
|
|
gdk_error_trap_push ();
|
|
|
|
- XSetWMNormalHints (GDK_WINDOW_XDISPLAY (window),
|
|
- GDK_WINDOW_XWINDOW (window),
|
|
- &size_hints);
|
|
+ XSetWMNormalHints (GDK_DISPLAY (), win, &size_hints);
|
|
|
|
gdk_window_move_resize (window, x, y, w, h);
|
|
|
|
@@ -250,33 +405,29 @@
|
|
xstuff_set_wmspec_dock_hints (GdkWindow *window,
|
|
gboolean autohide)
|
|
{
|
|
- Atom atoms [2] = { None, None };
|
|
+ Atom atoms[2] = { None, None };
|
|
|
|
- if (!autohide)
|
|
- atoms [0] = panel_atom_get (GDK_WINDOW_XDISPLAY (window),
|
|
- "_NET_WM_WINDOW_TYPE_DOCK");
|
|
- else {
|
|
- atoms [0] = panel_atom_get (GDK_WINDOW_XDISPLAY (window),
|
|
- "_GNOME_WINDOW_TYPE_AUTOHIDE_PANEL");
|
|
- atoms [1] = panel_atom_get (GDK_WINDOW_XDISPLAY (window),
|
|
- "_NET_WM_WINDOW_TYPE_DOCK");
|
|
+ if (autohide) {
|
|
+ atoms[0] = ATOMGDK (window, "_GNOME_WINDOW_TYPE_AUTOHIDE_PANEL");
|
|
+ atoms[1] = ATOMGDK (window, "_NET_WM_WINDOW_TYPE_DOCK");
|
|
+ } else {
|
|
+ atoms[0] = ATOMGDK (window, "_NET_WM_WINDOW_TYPE_DOCK");
|
|
}
|
|
|
|
XChangeProperty (GDK_WINDOW_XDISPLAY (window),
|
|
GDK_WINDOW_XWINDOW (window),
|
|
- panel_atom_get (GDK_WINDOW_XDISPLAY (window),
|
|
- "_NET_WM_WINDOW_TYPE"),
|
|
+ ATOMGDK (window, "_NET_WM_WINDOW_TYPE"),
|
|
XA_ATOM, 32, PropModeReplace,
|
|
- (unsigned char *) atoms,
|
|
+ (guchar *)atoms,
|
|
autohide ? 2 : 1);
|
|
}
|
|
|
|
void
|
|
xstuff_set_wmspec_strut (GdkWindow *window,
|
|
- int left,
|
|
- int right,
|
|
- int top,
|
|
- int bottom)
|
|
+ int left,
|
|
+ int right,
|
|
+ int top,
|
|
+ int bottom)
|
|
{
|
|
long vals [4];
|
|
|
|
@@ -287,25 +438,15 @@
|
|
|
|
XChangeProperty (GDK_WINDOW_XDISPLAY (window),
|
|
GDK_WINDOW_XWINDOW (window),
|
|
- panel_atom_get (GDK_WINDOW_XDISPLAY (window),
|
|
- "_NET_WM_STRUT"),
|
|
+ ATOMGDK (window, "_NET_WM_STRUT"),
|
|
XA_CARDINAL, 32, PropModeReplace,
|
|
- (unsigned char *) vals, 4);
|
|
+ (guchar *)vals, 4);
|
|
}
|
|
|
|
void
|
|
xstuff_delete_property (GdkWindow *window, const char *name)
|
|
{
|
|
- Display *xdisplay = GDK_WINDOW_XDISPLAY (window);
|
|
- Window xwindow = GDK_WINDOW_XWINDOW (window);
|
|
-
|
|
- XDeleteProperty (xdisplay, xwindow,
|
|
- panel_atom_get (xdisplay, name));
|
|
-}
|
|
-
|
|
-void
|
|
-xstuff_init (void)
|
|
-{
|
|
- gdk_window_add_filter (gdk_get_default_root_window (),
|
|
- panel_global_keys_filter, NULL);
|
|
+ XDeleteProperty (GDK_WINDOW_XDISPLAY (window),
|
|
+ GDK_WINDOW_XWINDOW (window),
|
|
+ ATOMGDK (window, name));
|
|
}
|
|
--- gnome-panel/xstuff.h.orig Fri Jun 21 02:07:59 2002
|
|
+++ gnome-panel/xstuff.h Thu Aug 8 22:11:31 2002
|
|
@@ -1,15 +1,36 @@
|
|
-#ifndef __XSTUFF_H__
|
|
-#define __XSTUFF_H__
|
|
+#ifndef XSTUFF_H
|
|
|
|
-#include <gdk/gdk.h>
|
|
+#include <gdk/gdkx.h>
|
|
+
|
|
+#include <X11/Xmd.h>
|
|
+#include <X11/Xlib.h>
|
|
+#include <X11/Xatom.h>
|
|
|
|
void xstuff_init (void);
|
|
+Atom xstuff_atom_intern (Display *display,
|
|
+ const char *name);
|
|
+void xstuff_set_simple_hint (GdkWindow *w,
|
|
+ const char *name,
|
|
+ long val);
|
|
void xstuff_delete_property (GdkWindow *window,
|
|
const char *name);
|
|
gboolean xstuff_is_compliant_wm (void);
|
|
|
|
+gpointer get_typed_property_data (Display *xdisplay,
|
|
+ Window xwindow,
|
|
+ Atom property,
|
|
+ Atom requested_type,
|
|
+ gint *size_p,
|
|
+ guint expected_format);
|
|
+
|
|
void xstuff_set_no_group_and_no_input (GdkWindow *win);
|
|
|
|
+void xstuff_setup_desktop_area (int screen,
|
|
+ int left,
|
|
+ int right,
|
|
+ int top,
|
|
+ int bottom);
|
|
+
|
|
void xstuff_unsetup_desktop_area (void);
|
|
void xstuff_set_pos_size (GdkWindow *window,
|
|
int x, int y,
|
|
@@ -22,4 +43,4 @@
|
|
int top,
|
|
int bottom);
|
|
|
|
-#endif /* __XSTUFF_H__ */
|
|
+#endif
|
|
--- gnome-panel/basep-widget.c.orig Sun Aug 4 18:29:17 2002
|
|
+++ gnome-panel/basep-widget.c Thu Aug 8 22:11:37 2002
|
|
@@ -2508,6 +2508,11 @@
|
|
BASEP_WIDGET (panel)->screen == screen)
|
|
gtk_widget_queue_resize (panel);
|
|
}
|
|
+ xstuff_setup_desktop_area (screen,
|
|
+ sb->left,
|
|
+ sb->right,
|
|
+ sb->top,
|
|
+ sb->bottom);
|
|
}
|
|
|
|
static guint queue_recalc_id = 0;
|
|
--- gnome-panel/session.c.orig Wed Jul 31 20:02:15 2002
|
|
+++ gnome-panel/session.c Thu Aug 8 22:11:41 2002
|
|
@@ -242,6 +242,8 @@
|
|
|
|
gnome_config_sync ();
|
|
|
|
+ xstuff_unsetup_desktop_area ();
|
|
+
|
|
panel_shell_unregister ();
|
|
|
|
gtk_main_quit();
|