GNOME Bugzilla – Bug 106534
The PAGER would have to respond to the events drag_motion activating window and/or workspace
Last modified: 2004-12-22 21:47:04 UTC
Just as the takslist it responds to events "drag_motion" activating windows, the pager would have to do the same. I hack a patch for version libwnck-2.2.1 Sorry for my english, my native language is the Spanish. fvp. ======================== diff -Nuar libwnck-2.2.1/libwnck/pager.c libwnck-2.2.1-1fvp/libwnck/pager.c --- libwnck-2.2.1/libwnck/pager.c 2002-11-24 14:34:11.000000000 -0300 +++ libwnck-2.2.1-1fvp/libwnck/pager.c 2003-02-19 13:06:32.000000000 -0300 @@ -29,6 +29,7 @@ #define N_SCREEN_CONNECTIONS 10 +#define TIMEOUT_ACTIVATE 1000 struct _WnckPagerPrivate { @@ -57,6 +58,9 @@ GdkPixbuf *bg_cache; int layout_manager_token; + guint dnd_activate; + WnckWindow *dnd_window; + WnckWorkspace *dnd_workspace; }; enum @@ -86,6 +90,12 @@ GdkEventExpose *event); static gboolean wnck_pager_button_press (GtkWidget *widget, GdkEventButton *event); +static gboolean wnck_pager_drag_motion (GtkWidget *widget, + GdkDragContext *context, + gint x, + gint y, + guint time); +static gboolean wnck_pager_drag_motion_timeout (gpointer data); static gboolean wnck_pager_motion (GtkWidget *widget, GdkEventMotion *event); static gboolean wnck_pager_button_release (GtkWidget *widget, @@ -99,6 +109,9 @@ WnckScreen *screen); static void wnck_pager_connect_window (WnckPager *pager, WnckWindow *window); +static void wnck_pager_drag_motion_leave (GtkWidget *widget, + GdkDragContext *context, + guint time); static void wnck_pager_disconnect_screen (WnckPager *pager); static void wnck_pager_set_layout_hint (WnckPager *pager); @@ -158,6 +171,7 @@ pager->priv->workspace_size = 48; pager->priv->bg_cache = NULL; pager->priv->layout_manager_token = WNCK_NO_MANAGER_TOKEN; + gtk_drag_dest_set (GTK_WIDGET(pager), 0, NULL, 0, 0); } static void @@ -179,7 +193,9 @@ widget_class->button_release_event = wnck_pager_button_release; widget_class->motion_notify_event = wnck_pager_motion; widget_class->focus = wnck_pager_focus; - widget_class->get_accessible = wnck_pager_get_accessible; + widget_class->get_accessible = wnck_pager_get_accessible; + widget_class->drag_leave = wnck_pager_drag_motion_leave; + widget_class->drag_motion = wnck_pager_drag_motion; } static void @@ -957,6 +973,89 @@ return handled; } +static gboolean +wnck_pager_drag_motion (GtkWidget *widget, + GdkDragContext *context, + gint x, + gint y, + guint time) +{ + WnckPager *pager; + gboolean handled = FALSE; + int space_number; + WnckWorkspace *space = NULL; + GdkRectangle workspace_rect; + + pager = WNCK_PAGER (widget); + if (pager->priv->dnd_activate == 0 ) + pager->priv->dnd_activate = g_timeout_add (TIMEOUT_ACTIVATE, + wnck_pager_drag_motion_timeout, + pager); + + space_number = workspace_at_point (pager, x, y); + + if (space_number != -1) + { + handled = TRUE; + + get_workspace_rect (pager, space_number, &workspace_rect); + space = wnck_screen_get_workspace (pager->priv->screen, space_number); + pager->priv->dnd_workspace = space; + pager->priv->dnd_window = NULL; + } + + if (space) + { + GList *windows; + GList *tmp; + + windows = + get_windows_for_workspace_in_bottom_to_top (pager->priv->screen, + space); + + /* clicks on top windows first */ + windows = g_list_reverse (windows); + + tmp = windows; + while (tmp != NULL) + { + WnckWindow *win = WNCK_WINDOW (tmp->data); + GdkRectangle winrect; + + get_window_rect (win, &workspace_rect, &winrect); + + if (POINT_IN_RECT (x, y, winrect)) + { + // wnck_window_activate (win); + pager->priv->dnd_window = win; + break; + } + + tmp = tmp->next; + } + + g_list_free (windows); + } + + gdk_drag_status (context,0,time); + + return handled; +} + +static gboolean +wnck_pager_drag_motion_timeout (gpointer data) +{ + WnckPager *pager = WNCK_PAGER (data); + + pager->priv->dnd_activate = 0; + if (wnck_workspace_get_number (wnck_screen_get_active_workspace ( pager->priv->screen)) + != wnck_workspace_get_number(pager->priv->dnd_workspace)) + wnck_workspace_activate (pager->priv->dnd_workspace); + if(pager->priv->dnd_window && !wnck_window_is_active (pager->priv->dnd_window)) + wnck_window_activate (pager->priv->dnd_window); + return FALSE; +} + static gboolean wnck_pager_motion (GtkWidget *widget, GdkEventMotion *event) @@ -1443,6 +1542,22 @@ } static void +wnck_pager_drag_motion_leave (GtkWidget *widget, + GdkDragContext *context, + guint time) +{ + WnckPager *pager; + pager = WNCK_PAGER (widget); + if (pager->priv->dnd_activate != 0) + { + g_source_remove (pager->priv->dnd_activate); + pager->priv->dnd_activate = 0; + pager->priv->dnd_window = 0; + pager->priv->dnd_workspace = 0; + } +} + +static void wnck_pager_disconnect_screen (WnckPager *pager) { int i;
Could you attach the patch with "Create a new attachment" instead of pasting it into the text box? it gets a bit whitespace-corrupted otherwise.
Created attachment 14464 [details] [review] patch for version libwnck-2.2.1
Created attachment 16271 [details] [review] patch for version libwnck-2.3.0
This paths allows to the users can drag an object to another application in another workspace. I think that it is a very necessary characteristic and I want to know what changes are necessary for this patch are considerate.
*** This bug has been marked as a duplicate of 95614 ***