Re: Panels with compiz

Tony Houghton <[email protected]>
Newsgroups gmane.comp.desktop.rox.devel
Message-ID <[email protected]>
In <[email protected]>
Tony Houghton <[email protected]> wrote:

> I'll try to get around to it tonight. I wonder if we also ought to get
> rid of the panel_is_a_dock option and force it on, or at least make it
> default to on. Setting the DOCK type hint is the correct thing to do
> and I'm not sure why anyone would want to disable it.

Here's my patch to add a keep panel on top option. If you applied the
previous patch revert it when you apply this.

Reading the tooltip for the dock option I realised it could be to
support window managers that are aware of the DOCK type hint but not the
BELOW state, so I haven't deleted the option, but I have changed it to
TRUE by default.

-- 
TH * http://www.realh.co.uk

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
rox-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rox-devel
rox-panel-on-top-option.diff (text/x-patch, 5.5 KB)
diff --git a/ROX-Filer/Options.xml b/ROX-Filer/Options.xml
index 7d3c67f..841b61c 100644
--- a/ROX-Filer/Options.xml
+++ b/ROX-Filer/Options.xml
@@ -317,7 +317,8 @@ xterm -e wget $1</entry>
       <toggle name='override_redirect' label='Override window manager control of the pinboard and panels'>Some window managers don't support the new Extended Window Manager Hints system, and so treat the pinboard and panels like normal windows. Turn this on to fix problems such as the pinboard coming to the front when you click on it, titlebars and other decorations appearing around windows, or having them appear in window-select lists.</toggle>
       <toggle name='pinboard_forward_buttons_13' label='Pass all backdrop mouse clicks to window manager'>Normally, right clicking on the desktop background will open the pinboard menu and left clicking will clear the selection. Turn this on to forward the events to your window manager instead. Clicks on icons will not be forwarded.</toggle>
       <toggle name='blackbox_hack' label='Blackbox root menus hack'>Blackbox, Fluxbox and similar window managers do not yet work well with the ROX-Filer pinboard. This option enables some workarounds. These window managers are expected to change their behaviour in new versions so that this isn't necessary.</toggle>
-      <toggle name='panel_is_dock' label="Panel is a 'dock'">Disable this option if the panel stays above other windows against your wishes. Requires a restart to take effect.</toggle>
+      <toggle name='panel_is_dock' label="Panel is a 'dock'">Makes sure panels stay against screen edges. Disable this option if the panel stays above other windows against your wishes. Requires a restart to take effect.</toggle>
+      <toggle name='panel_on_top' label="Panel stays on top">Keeps the panel above other windows. Enable this option to make sure the dock option works correctly in some versions of compiz. May require a restart to take effect.</toggle>
     </frame>
     <frame label='Drag and drop'>
       <toggle name='dnd_no_hostnames' label="Don't use hostnames">Some older applications don't support XDND fully and may need to have this option turned on. Use this if dragging files to an application shows a + sign on the pointer but the drop doesn't work.</toggle>
diff --git a/ROX-Filer/src/panel.c b/ROX-Filer/src/panel.c
index c84299b..fb55ca8 100644
--- a/ROX-Filer/src/panel.c
+++ b/ROX-Filer/src/panel.c
@@ -201,6 +201,7 @@ static GList *build_monitor_number(Option *option,
 					xmlNode *node, guchar *label);
 static gboolean may_autoscroll(Panel *panel);
 static void panel_update_geometry(Panel *panel);
+static gboolean panel_keep_below(Panel *panel, gboolean setting);
 
 
 static GtkWidget *dnd_highlight = NULL; /* (stops flickering) */
@@ -214,6 +215,7 @@ static Option o_panel_xinerama;
 static Option o_panel_monitor;
 static Option o_panel_avoid;
 static Option o_panel_is_dock;
+static Option o_panel_on_top;
 
 static gint panel_monitor = -1;
 
@@ -232,7 +234,8 @@ void panel_init(void)
 	option_add_int(&o_panel_monitor, "panel_monitor", 0);
 
 	option_add_int(&o_panel_avoid, "panel_avoid", TRUE);
-	option_add_int(&o_panel_is_dock, "panel_is_dock", FALSE);
+	option_add_int(&o_panel_is_dock, "panel_is_dock", TRUE);
+	option_add_int(&o_panel_on_top, "panel_on_top", FALSE);
 
 	option_add_notify(panel_style_changed);
 
@@ -556,8 +559,7 @@ Panel *panel_new(const gchar *name, PanelSide side)
 	gdk_window_lower(panel->window->window);
 	gtk_widget_show(panel->window);
 	/* This has no effect until after window is showing; GTK+ bug? */
-	keep_below(panel->window->window, TRUE);
-
+	if (panel_keep_below(panel, TRUE))
 	{
 		GdkWindow *pinboard;
 
@@ -1671,12 +1673,13 @@ static gint panel_leave_event(GtkWidget *widget,
 	if (event->mode != GDK_CROSSING_NORMAL)
 		return FALSE;	/* Grab for menu, DnD, etc */
 
-	keep_below(panel->window->window, TRUE);
-
-	/* Shouldn't need this as well as keep_below but some WMs don't
-	 * automatically lower as soon as the hint is set */ 
-	pinboard = pinboard_get_window();
-	window_put_just_above(panel->window->window, pinboard);
+	if (panel_keep_below(panel, TRUE))
+	{
+		/* Shouldn't need this as well as keep_below but some WMs don't
+		 * automatically lower as soon as the hint is set */ 
+		pinboard = pinboard_get_window();
+		window_put_just_above(panel->window->window, pinboard);
+	}
 
 	return FALSE;
 }
@@ -1695,10 +1698,8 @@ static void motion_may_raise(Panel *panel, int x, int y)
 	else
 		raise = x == panel->window->allocation.width - 1;
 
-	if (raise)
+	if (raise && panel_keep_below(panel, FALSE))
 	{
-		keep_below(panel->window->window, FALSE);
-
 		/* Shouldn't need this as well as keep_below but some WMs don't
 		 * automatically raise as soon as the hint is set */ 
 		gdk_window_raise(panel->window->window);
@@ -2749,10 +2750,9 @@ static void panel_drag_leave(GtkWidget	*widget,
 	
 	window = panel->window->window;
 	gdk_window_get_pointer(window, &x, &y, NULL);
-	if (x < 0 || y < 0 || x > alloc->width || y > alloc->height)
+	if ((x < 0 || y < 0 || x > alloc->width || y > alloc->height) &&
+		panel_keep_below(panel, TRUE))
 	{
-		keep_below(panel->window->window, TRUE);
-
 		/* Shouldn't need this as well as keep_below but some WMs don't
 		 * automatically lower as soon as the hint is set */ 
 		pinboard = pinboard_get_window();
@@ -2869,3 +2869,14 @@ GtkWidget *panel_new_panel_submenu(void)
 	}
 	return menu;
 }
+
+static gboolean panel_keep_below(Panel *panel, gboolean setting)
+{
+	if (!o_panel_on_top.int_value)
+	{
+		keep_below(panel->window->window, setting);
+		return TRUE;
+	}
+	return FALSE;
+}
+
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.