xfwm: support for 2d pagers
Paramjit Oberoi
param at cs.wisc.edu
Thu Sep 23 03:25:54 CEST 2004
Patch for fixing edge scrolling attached. Handles both window
dragging as well non-window-dragging cases.
-param
Olivier Fourdan wrote (Wed, Sep 22, 2004 at 11:41:48PM +0200) :
> From: Olivier Fourdan <fourdan at xfce.org>
> To: xfce4 devel list <xfce4-dev at xfce.org>
> X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2)
> Date: Wed, 22 Sep 2004 23:41:48 +0200
> Subject: Re: xfwm: support for 2d pagers
> Sender: xfce4-dev-bounces at xfce.org
>
> On Wed, 2004-09-22 at 21:41, Olivier Fourdan wrote:
> > On Tue, 2004-09-21 at 08:48, Olivier Fourdan wrote:
> > > Ok applied. All shortcuts are set to "none" by default for now though.
> >
> > The patch is incomplete though as it does not address dragging a window
> > from a desktop to another one (yeah, I just realized that)
>
> Anyway, it will stay like that for now...
>
> Cheers,
> Olivier.
> --
> - Olivier Fourdan - fourdan at xfce.org - http://www.xfce.org -
>
> _______________________________________________
> Xfce4-dev mailing list
> Xfce4-dev at xfce.org
> http://lunar-linux.org/mailman/listinfo/xfce4-dev
-------------- next part --------------
? Makefile
? config.h
? config.log
? config.status
? libtool
? stamp-h1
? xfwm4.spec
? defaults/Makefile
? doc/Makefile
? doc/C/Makefile
? doc/C/images/Makefile
? doc/fr/Makefile
? doc/fr/images/Makefile
? doc/it/Makefile
? doc/it/images/Makefile
? icons/Makefile
? icons/48x48/Makefile
? icons/scalable/Makefile
? mcs-plugin/.deps
? mcs-plugin/.libs
? mcs-plugin/Makefile
? mcs-plugin/workspaces_plugin.la
? mcs-plugin/workspaces_plugin_la-margins.lo
? mcs-plugin/workspaces_plugin_la-plugin.lo
? mcs-plugin/workspaces_plugin_la-workspaces.lo
? mcs-plugin/xfwm4_plugin.la
? mcs-plugin/xfwm4_plugin_la-xfwm4_plugin.lo
? mcs-plugin/xfwm4_plugin_la-xfwm4_shortcuteditor.lo
? po/Makefile
? po/Makefile.in
? po/POTFILES
? src/.deps
? src/.libs
? src/Makefile
? src/xfwm4
? themes/Makefile
? themes/default/Makefile
? themes/default-4.0/Makefile
? themes/default.keys/Makefile
? themes/opta/Makefile
? themes/symphony/Makefile
? themes/waza/Makefile
Index: src/client.c
===================================================================
RCS file: /cvsroot/xfce/xfce4/xfwm4/src/client.c,v
retrieving revision 1.421
diff -u -r1.421 client.c
--- src/client.c 22 Sep 2004 22:39:18 -0000 1.421
+++ src/client.c 23 Sep 2004 01:18:23 -0000
@@ -2726,6 +2726,7 @@
clientMove_event_filter (XEvent * xevent, gpointer data)
{
static int edge_scroll_x = 0;
+ static int edge_scroll_y = 0;
ScreenInfo *screen_info = NULL;
DisplayInfo *display_info = NULL;
XfceFilterStatus status = XEV_FILTER_STOP;
@@ -2825,13 +2826,14 @@
{
if ((screen_info->params->wrap_windows) && (screen_info->params->wrap_resistance))
{
- int msx, msy, max;
+ int msx, msy, maxx, maxy;
msx = xevent->xmotion.x_root;
msy = xevent->xmotion.y_root;
- max = gdk_screen_get_width (screen_info->gscr) - 1;
+ maxx = gdk_screen_get_width (screen_info->gscr) - 1;
+ maxy = gdk_screen_get_height (screen_info->gscr) - 1;
- if ((msx == 0) || (msx == max))
+ if ((msx == 0) || (msx == maxx))
{
edge_scroll_x++;
}
@@ -2839,22 +2841,57 @@
{
edge_scroll_x = 0;
}
+ if ((msy == 0) || (msy == maxy))
+ {
+ edge_scroll_y++;
+ }
+ else
+ {
+ edge_scroll_y = 0;
+ }
+
if (edge_scroll_x > screen_info->params->wrap_resistance)
{
edge_scroll_x = 0;
- if ((msx == 0) && (screen_info->current_ws > 0))
+ if (msx == 0)
+ {
+ if (workspaceMove (screen_info, 0, -1, c))
+ {
+ XWarpPointer (display_info->dpy, None, screen_info->xroot,
+ 0, 0, 0, 0, maxx - 10, msy);
+ msx = xevent->xmotion.x_root = maxx - 10;
+ }
+ }
+ else if (msx == maxx)
+ {
+ if (workspaceMove (screen_info, 0, 1, c))
+ {
+ XWarpPointer (display_info->dpy, None, screen_info->xroot,
+ 0, 0, 0, 0, 10, msy);
+ msx = xevent->xmotion.x_root = 10;
+ }
+ }
+ }
+ if (edge_scroll_y > screen_info->params->wrap_resistance)
+ {
+ edge_scroll_y = 0;
+ if (msy == 0)
{
- XWarpPointer (display_info->dpy, None, screen_info->xroot, 0, 0, 0, 0,
- max - 10, msy);
- msx = xevent->xmotion.x_root = max - 10;
- workspaceSwitch (screen_info, screen_info->current_ws - 1, c);
+ if (workspaceMove (screen_info, -1, 0, c))
+ {
+ XWarpPointer (display_info->dpy, None, screen_info->xroot,
+ 0, 0, 0, 0, msx, maxy - 10);
+ msy = xevent->xmotion.y_root = maxy - 10;
+ }
}
- else if ((msx == max) && (screen_info->current_ws < (screen_info->workspace_count - 1)))
+ else if (msy == maxy)
{
- XWarpPointer (display_info->dpy, None, screen_info->xroot,
- 0, 0, 0, 0, 10, msy);
- msx = xevent->xmotion.x_root = 10;
- workspaceSwitch (screen_info, screen_info->current_ws + 1, c);
+ if (workspaceMove (screen_info, 1, 0, c))
+ {
+ XWarpPointer (display_info->dpy, None, screen_info->xroot,
+ 0, 0, 0, 0, msx, 10);
+ msy = xevent->xmotion.y_root = 10;
+ }
}
}
}
@@ -2909,6 +2946,7 @@
{
TRACE ("event loop now finished");
edge_scroll_x = 0;
+ edge_scroll_y = 0;
gtk_main_quit ();
}
Index: src/events.c
===================================================================
RCS file: /cvsroot/xfce/xfce4/xfwm4/src/events.c,v
retrieving revision 1.248
diff -u -r1.248 events.c
--- src/events.c 22 Sep 2004 22:37:21 -0000 1.248
+++ src/events.c 23 Sep 2004 01:18:24 -0000
@@ -78,6 +78,7 @@
static GdkAtom atom_rcfiles = GDK_NONE;
static xfwmWindow menu_event_window;
static int edge_scroll_x = 0;
+static int edge_scroll_y = 0;
static void handleEvent (DisplayInfo *display_info, XEvent * ev);
static void menu_callback (Menu * menu, MenuOp op, Window client_xwindow,
@@ -245,7 +246,7 @@
static void
handleMotionNotify (DisplayInfo *display_info, XMotionEvent * ev)
{
- int msx, msy, max;
+ int msx, msy, maxx, maxy;
ScreenInfo *screen_info = NULL;
TRACE ("entering handleMotionNotify");
@@ -269,9 +270,10 @@
{
msx = ev->x_root;
msy = ev->y_root;
- max = gdk_screen_get_width (screen_info->gscr) - 1;
+ maxx = gdk_screen_get_width (screen_info->gscr) - 1;
+ maxy = gdk_screen_get_height (screen_info->gscr) - 1;
- if ((msx == 0) || (msx == max))
+ if ((msx == 0) || (msx == maxx))
{
edge_scroll_x++;
}
@@ -279,18 +281,51 @@
{
edge_scroll_x = 0;
}
+ if ((msy == 0) || (msy == maxy))
+ {
+ edge_scroll_y++;
+ }
+ else
+ {
+ edge_scroll_y = 0;
+ }
+
if (edge_scroll_x > screen_info->params->wrap_resistance)
{
edge_scroll_x = 0;
if (msx == 0)
{
- XWarpPointer (display_info->dpy, None, screen_info->xroot, 0, 0, 0, 0, max - 10, msy);
- workspaceSwitch (screen_info, screen_info->current_ws - 1, NULL);
+ if (workspaceMove (screen_info, 0, -1, NULL))
+ {
+ XWarpPointer (display_info->dpy, None, screen_info->xroot, 0, 0, 0, 0, maxx - 10, msy);
+ }
+ }
+ else if (msx == maxx)
+ {
+ if (workspaceMove (screen_info, 0, 1, NULL))
+ {
+ XWarpPointer (display_info->dpy, None, screen_info->xroot, 0, 0, 0, 0, 10, msy);
+ }
+ }
+ while (XCheckWindowEvent(display_info->dpy, ev->window, PointerMotionMask, (XEvent *) ev))
+ ; /* Skip event */
+ }
+ if (edge_scroll_y > screen_info->params->wrap_resistance)
+ {
+ edge_scroll_y = 0;
+ if (msy == 0)
+ {
+ if (workspaceMove (screen_info, -1, 0, NULL))
+ {
+ XWarpPointer (display_info->dpy, None, screen_info->xroot, 0, 0, 0, 0, msx, maxy - 10);
+ }
}
- else if (msx == max)
+ else if (msy == maxy)
{
- XWarpPointer (display_info->dpy, None, screen_info->xroot, 0, 0, 0, 0, 10, msy);
- workspaceSwitch (screen_info, screen_info->current_ws + 1, NULL);
+ if (workspaceMove (screen_info, 1, 0, NULL))
+ {
+ XWarpPointer (display_info->dpy, None, screen_info->xroot, 0, 0, 0, 0, msx, 10);
+ }
}
while (XCheckWindowEvent(display_info->dpy, ev->window, PointerMotionMask, (XEvent *) ev))
; /* Skip event */
@@ -1303,7 +1338,9 @@
(ev->window == MYWINDOW_XWINDOW (screen_info->sidewalk[1])))
{
TRACE ("Reset edge_scroll_x");
+ TRACE ("Reset edge_scroll_y");
edge_scroll_x = 0;
+ edge_scroll_y = 0;
}
}
Index: src/screen.c
===================================================================
RCS file: /cvsroot/xfce/xfce4/xfwm4/src/screen.c,v
retrieving revision 1.4
diff -u -r1.4 screen.c
--- src/screen.c 22 Aug 2004 22:18:50 -0000 1.4
+++ src/screen.c 23 Sep 2004 01:18:24 -0000
@@ -122,6 +122,15 @@
1, gdk_screen_get_height (gscr),
LeaveWindowMask | PointerMotionMask);
+ xfwmWindowTemp (display_info->dpy, screen_info->xroot, &screen_info->sidewalk[2], 0, 0,
+ gdk_screen_get_width (gscr), 1,
+ LeaveWindowMask | PointerMotionMask);
+
+ xfwmWindowTemp (display_info->dpy, screen_info->xroot, &screen_info->sidewalk[3],
+ 0, gdk_screen_get_height (gscr) - 1,
+ gdk_screen_get_width (gscr), 1,
+ LeaveWindowMask | PointerMotionMask);
+
screen_info->gnome_win = GDK_WINDOW_XWINDOW (screen_info->gtk_win->window);
screen_info->net_system_tray_selection =
@@ -184,6 +193,8 @@
xfwmWindowDelete (&screen_info->sidewalk[0]);
xfwmWindowDelete (&screen_info->sidewalk[1]);
+ xfwmWindowDelete (&screen_info->sidewalk[2]);
+ xfwmWindowDelete (&screen_info->sidewalk[3]);
XSetInputFocus (display_info->dpy, screen_info->xroot, RevertToPointerRoot, GDK_CURRENT_TIME);
g_free (screen_info->params);
Index: src/screen.h
===================================================================
RCS file: /cvsroot/xfce/xfce4/xfwm4/src/screen.h,v
retrieving revision 1.8
diff -u -r1.8 screen.h
--- src/screen.h 21 Sep 2004 06:40:17 -0000 1.8
+++ src/screen.h 23 Sep 2004 01:18:24 -0000
@@ -80,7 +80,7 @@
int depth;
GtkWidget *gtk_win;
- xfwmWindow sidewalk[2];
+ xfwmWindow sidewalk[4];
Window gnome_win;
Window xroot;
Window systray;
Index: src/workspaces.c
===================================================================
RCS file: /cvsroot/xfce/xfce4/xfwm4/src/workspaces.c,v
retrieving revision 1.80
diff -u -r1.80 workspaces.c
--- src/workspaces.c 21 Sep 2004 06:40:17 -0000 1.80
+++ src/workspaces.c 23 Sep 2004 01:18:24 -0000
@@ -165,7 +165,9 @@
return value;
}
-void
+/* returns TRUE if the workspace was changed, FALSE otherwise */
+
+gboolean
workspaceMove (ScreenInfo *screen_info, int rowmod, int colmod, Client * c2)
{
int row, col, newrow, newcol, n;
@@ -177,7 +179,7 @@
if (n == screen_info->current_ws)
{
- return;
+ return FALSE;
}
if (n < screen_info->workspace_count)
@@ -206,14 +208,15 @@
}
else
{
- g_return_if_fail(FALSE);
+ g_return_val_if_fail(FALSE, FALSE);
}
n = workspaceGetNumber(screen_info, newrow, newcol);
}
- g_return_if_fail(n < screen_info->workspace_count);
+ g_return_val_if_fail(n < screen_info->workspace_count, FALSE);
workspaceSwitch(screen_info, n, c2);
}
+ return TRUE;
}
void
Index: src/workspaces.h
===================================================================
RCS file: /cvsroot/xfce/xfce4/xfwm4/src/workspaces.h,v
retrieving revision 1.20
diff -u -r1.20 workspaces.h
--- src/workspaces.h 21 Sep 2004 06:40:17 -0000 1.20
+++ src/workspaces.h 23 Sep 2004 01:18:24 -0000
@@ -32,7 +32,7 @@
#include "screen.h"
#include "client.h"
-void workspaceMove (ScreenInfo *, int, int, Client *);
+gboolean workspaceMove (ScreenInfo *, int, int, Client *);
void workspaceSwitch (ScreenInfo *, int, Client *);
void workspaceSetNames (ScreenInfo *, char *, int);
void workspaceSetCount (ScreenInfo *, int);
More information about the Xfce4-dev
mailing list