After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 106534 - The PAGER would have to respond to the events drag_motion activating window and/or workspace
The PAGER would have to respond to the events drag_motion activating window a...
Status: RESOLVED DUPLICATE of bug 95614
Product: libwnck
Classification: Core
Component: general
2.3.x
Other All
: High normal
: ---
Assigned To: libwnck maintainers
libwnck maintainers
Depends on:
Blocks:
 
 
Reported: 2003-02-19 17:00 UTC by Fernando Villacis Postigo
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch for version libwnck-2.2.1 (5.47 KB, patch)
2003-02-20 11:42 UTC, Fernando Villacis Postigo
none Details | Review
patch for version libwnck-2.3.0 (5.32 KB, patch)
2003-05-05 13:24 UTC, Fernando Villacis Postigo
none Details | Review

Description Fernando Villacis Postigo 2003-02-19 17:00:57 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;
Comment 1 Havoc Pennington 2003-02-19 20:55:26 UTC
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.
Comment 2 Fernando Villacis Postigo 2003-02-20 11:42:54 UTC
Created attachment 14464 [details] [review]
patch for version libwnck-2.2.1
Comment 3 Fernando Villacis Postigo 2003-05-05 13:24:17 UTC
Created attachment 16271 [details] [review]
patch for version libwnck-2.3.0
Comment 4 Fernando Villacis Postigo 2003-05-05 14:03:54 UTC
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.
Comment 5 Fernando Villacis Postigo 2003-05-05 14:45:48 UTC

*** This bug has been marked as a duplicate of 95614 ***