Fix a problem appeared in version 2.0.2 by reverting some changes since
2.0.1. The problem is that in 2.0.2 a panel doesn't properly notify Natilus about desktop area occuped by it, so that with 2.0.2 Nautilus might put desktop icons under panel(s), which is of course looks and feels ugly. Summary of what changes were backed out can be found at the very top of patch-temp. Obtained from: GNOME cvs
This commit is contained in:
parent
695b074d80
commit
518dd83eca
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=63141
@ -7,6 +7,7 @@
|
||||
|
||||
PORTNAME= gnomepanel
|
||||
PORTVERSION= 2.0.2
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= x11 gnome
|
||||
MASTER_SITES= ${MASTER_SITE_GNOME}
|
||||
MASTER_SITE_SUBDIR= 2.0.0/sources/gnome-panel
|
||||
|
453
x11/gnome-panel/files/patch-temp
Normal file
453
x11/gnome-panel/files/patch-temp
Normal file
@ -0,0 +1,453 @@
|
||||
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 Wed Jun 26 02:46:44 2002
|
||||
+++ gnome-panel/xstuff.c Wed Jul 17 16:36:57 2002
|
||||
@@ -1,53 +1,101 @@
|
||||
/*
|
||||
* GNOME panel x stuff
|
||||
+ * Copyright 2000,2001 Eazel, Inc.
|
||||
*
|
||||
- * Copyright (C) 2000, 2001 Eazel, Inc.
|
||||
- * 2002 Sun Microsystems Inc.
|
||||
- *
|
||||
- * Authors: George Lebl <jirka@5z.com>
|
||||
- * Mark McLoughlin <mark@skynet.ie>
|
||||
+ * Authors: George Lebl
|
||||
*/
|
||||
#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 (!atom_hash)
|
||||
- atom_hash = g_hash_table_new_full (
|
||||
- g_str_hash, g_str_equal, g_free, NULL);
|
||||
+ if (cache == 0)
|
||||
+ cache = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
- retval = GPOINTER_TO_UINT (g_hash_table_lookup (atom_hash, atom_name));
|
||||
- if (!retval) {
|
||||
- retval = XInternAtom (display, atom_name, FALSE);
|
||||
+ key = g_strdup_printf ("%p %s", display, name);
|
||||
|
||||
- if (retval != None)
|
||||
- g_hash_table_insert (atom_hash, g_strdup (atom_name),
|
||||
- GUINT_TO_POINTER (retval));
|
||||
+ 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 +204,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 +224,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 +243,122 @@
|
||||
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;
|
||||
|
||||
/* Do not add USPosition / USSize here, fix the damn WM */
|
||||
@@ -222,9 +374,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);
|
||||
|
||||
@@ -236,62 +386,48 @@
|
||||
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];
|
||||
+ long vals[4];
|
||||
|
||||
- vals [0] = left;
|
||||
- vals [1] = right;
|
||||
- vals [2] = top;
|
||||
- vals [3] = bottom;
|
||||
+ vals[0] = left;
|
||||
+ vals[1] = right;
|
||||
+ vals[2] = top;
|
||||
+ vals[3] = bottom;
|
||||
|
||||
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 08:28:10 2002
|
||||
+++ gnome-panel/xstuff.h Wed Jul 17 16:36:57 2002
|
||||
@@ -1,15 +1,35 @@
|
||||
-#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 +42,4 @@
|
||||
int top,
|
||||
int bottom);
|
||||
|
||||
-#endif /* __XSTUFF_H__ */
|
||||
+#endif
|
||||
--- gnome-panel/basep-widget.c 2002/07/17 14:28:52 1.1
|
||||
+++ gnome-panel/basep-widget.c 2002/07/17 14:31:46
|
||||
@@ -2521,6 +2521,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 2002/07/17 14:31:48 1.1
|
||||
+++ gnome-panel/session.c 2002/07/17 14:32:03
|
||||
@@ -242,6 +242,8 @@
|
||||
|
||||
gnome_config_sync ();
|
||||
|
||||
+ xstuff_unsetup_desktop_area ();
|
||||
+
|
||||
panel_shell_unregister ();
|
||||
|
||||
gtk_main_quit();
|
@ -7,6 +7,7 @@
|
||||
|
||||
PORTNAME= gnomepanel
|
||||
PORTVERSION= 2.0.2
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= x11 gnome
|
||||
MASTER_SITES= ${MASTER_SITE_GNOME}
|
||||
MASTER_SITE_SUBDIR= 2.0.0/sources/gnome-panel
|
||||
|
453
x11/gnomepanel/files/patch-temp
Normal file
453
x11/gnomepanel/files/patch-temp
Normal file
@ -0,0 +1,453 @@
|
||||
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 Wed Jun 26 02:46:44 2002
|
||||
+++ gnome-panel/xstuff.c Wed Jul 17 16:36:57 2002
|
||||
@@ -1,53 +1,101 @@
|
||||
/*
|
||||
* GNOME panel x stuff
|
||||
+ * Copyright 2000,2001 Eazel, Inc.
|
||||
*
|
||||
- * Copyright (C) 2000, 2001 Eazel, Inc.
|
||||
- * 2002 Sun Microsystems Inc.
|
||||
- *
|
||||
- * Authors: George Lebl <jirka@5z.com>
|
||||
- * Mark McLoughlin <mark@skynet.ie>
|
||||
+ * Authors: George Lebl
|
||||
*/
|
||||
#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 (!atom_hash)
|
||||
- atom_hash = g_hash_table_new_full (
|
||||
- g_str_hash, g_str_equal, g_free, NULL);
|
||||
+ if (cache == 0)
|
||||
+ cache = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
- retval = GPOINTER_TO_UINT (g_hash_table_lookup (atom_hash, atom_name));
|
||||
- if (!retval) {
|
||||
- retval = XInternAtom (display, atom_name, FALSE);
|
||||
+ key = g_strdup_printf ("%p %s", display, name);
|
||||
|
||||
- if (retval != None)
|
||||
- g_hash_table_insert (atom_hash, g_strdup (atom_name),
|
||||
- GUINT_TO_POINTER (retval));
|
||||
+ 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 +204,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 +224,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 +243,122 @@
|
||||
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;
|
||||
|
||||
/* Do not add USPosition / USSize here, fix the damn WM */
|
||||
@@ -222,9 +374,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);
|
||||
|
||||
@@ -236,62 +386,48 @@
|
||||
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];
|
||||
+ long vals[4];
|
||||
|
||||
- vals [0] = left;
|
||||
- vals [1] = right;
|
||||
- vals [2] = top;
|
||||
- vals [3] = bottom;
|
||||
+ vals[0] = left;
|
||||
+ vals[1] = right;
|
||||
+ vals[2] = top;
|
||||
+ vals[3] = bottom;
|
||||
|
||||
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 08:28:10 2002
|
||||
+++ gnome-panel/xstuff.h Wed Jul 17 16:36:57 2002
|
||||
@@ -1,15 +1,35 @@
|
||||
-#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 +42,4 @@
|
||||
int top,
|
||||
int bottom);
|
||||
|
||||
-#endif /* __XSTUFF_H__ */
|
||||
+#endif
|
||||
--- gnome-panel/basep-widget.c 2002/07/17 14:28:52 1.1
|
||||
+++ gnome-panel/basep-widget.c 2002/07/17 14:31:46
|
||||
@@ -2521,6 +2521,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 2002/07/17 14:31:48 1.1
|
||||
+++ gnome-panel/session.c 2002/07/17 14:32:03
|
||||
@@ -242,6 +242,8 @@
|
||||
|
||||
gnome_config_sync ();
|
||||
|
||||
+ xstuff_unsetup_desktop_area ();
|
||||
+
|
||||
panel_shell_unregister ();
|
||||
|
||||
gtk_main_quit();
|
Loading…
Reference in New Issue
Block a user