← Back to team overview

cairo-dock-team team mailing list archive

[Bug 614843] [NEW] dock doesn't shrink

 

Public bug reported:

Some times dock doesn't shrink when leave-notify is sent to dock but _mouse_is_really_outside is false.
for example when compiz is on (and desktop wall) if dock is in the bottom, when mouse gets out of dock towards the bottom edge and while on edge gets out of dock, dock doesn't shrink. this patch worked for me. using mouse polling if in leave-notify the _mouse_is_really_outside is false.
version cairo-dock 2.2.0-0beta3 using  ppa and ubuntu 10.04 , 64 bit
cairo-dock-core_2.2.0-0beta3-20100724-0ubuntu1~ppa0~lucid_amd64.deb

======== PATCH ========
diff -c -r -b A/src/gldit/cairo-dock-callbacks.c B/src/gldit/cairo-dock-callbacks.c
*** A/src/gldit/cairo-dock-callbacks.c	2010-07-24 18:42:00.000000000 +0430
--- B/src/gldit/cairo-dock-callbacks.c	2010-08-08 00:59:35.000000000 +0430
***************
*** 537,542 ****
--- 537,597 ----
  	return FALSE;
  }
  
+ gboolean on_mouse_polling(CairoDock *pDock);
+ 
+ gboolean on_mouse_polling(CairoDock *pDock)
+ {
+ 	gint x, y;
+ 	// get the mouse position
+ 	gdk_display_get_pointer (gdk_display_get_default(), NULL, &x, &y, NULL);
+ 	
+ 	// calculate mouse position realative to the widget
+ 	pDock->container.iMouseX=x-pDock->container.iWindowPositionX;
+ 	pDock->container.iMouseY=y-pDock->container.iWindowPositionY;
+ 	
+ 	// if mouse is outside send a leave notify
+ 	if(_mouse_is_really_outside(pDock))
+ 	{
+ 		// TODO: use a better way
+ 		GdkEventCrossing eventCrossing;
+ 		eventCrossing.x_root=x;
+ 		eventCrossing.y_root=y;
+ 		eventCrossing.x=pDock->container.iMouseX;
+ 		eventCrossing.y=pDock->container.iMouseY;
+ 		eventCrossing.state=0;
+ 		eventCrossing.window=pDock->container.pWidget;
+ 		eventCrossing.subwindow=eventCrossing.window;
+ 		eventCrossing.type=GDK_LEAVE_NOTIFY;
+ 		eventCrossing.send_event=1;
+ 		eventCrossing.detail=GDK_NOTIFY_NONLINEAR;
+ 		eventCrossing.mode=GDK_CROSSING_NORMAL;
+ 		eventCrossing.focus=FALSE;
+ 		
+ 		cairo_dock_on_leave_notify(pDock->container.pWidget,&eventCrossing,pDock);
+ 		return FALSE;
+ 	}
+ 	// otherwise if mouse is in, send a motion notify
+ 	else
+ 	{
+ 		// TODO: use a better way
+ 		GdkEventMotion eventMotion;
+ 		eventMotion.x_root=x;
+ 		eventMotion.y_root=y;
+ 		eventMotion.x=pDock->container.iMouseX;
+ 		eventMotion.y=pDock->container.iMouseY;
+ 		eventMotion.axes=NULL;
+ 		eventMotion.state=0;
+ 		eventMotion.is_hint=0;
+ 		eventMotion.window=pDock->container.pWidget;
+ 		eventMotion.device=NULL;
+ 		eventMotion.type=GDK_MOTION_NOTIFY;
+ 		eventMotion.send_event=1;
+ 		
+ 		cairo_dock_on_motion_notify(pDock->container.pWidget,&eventMotion,pDock);
+ 		return TRUE;
+ 	}
+ 	
+ }
  
  gboolean cairo_dock_on_leave_notify (GtkWidget* pWidget, GdkEventCrossing* pEvent, CairoDock *pDock)
  {
***************
*** 563,568 ****
--- 619,625 ----
  		if (!_mouse_is_really_outside(pDock))
  		{
  			//g_print ("not really outside (%d;%d ; %d/%d)\n", (int)pEvent->x, (int)pEvent->y, pDock->iMaxDockHeight, pDock->iMinDockHeight);
+ 			pDock->iMousePollingSource=g_timeout_add(cairo_dock_get_animation_delta_t(pDock),(GSourceFunc)on_mouse_polling,pDock); //maybe it is better to be adjusted
  			return FALSE;
  		}
  	}
***************
*** 693,698 ****
--- 754,766 ----
  gboolean cairo_dock_on_enter_notify (GtkWidget* pWidget, GdkEventCrossing* pEvent, CairoDock *pDock)
  {
  	//g_print ("%s (bIsMainDock : %d; bInside:%d; state:%d; iMagnitudeIndex:%d; input shape:%x; event:%ld)\n", __func__, pDock->bIsMainDock, pDock->container.bInside, pDock->iInputState, pDock->iMagnitudeIndex, pDock->pShapeBitmap, pEvent);
+ 	
+ 	if(pDock->iMousePollingSource!=0)
+ 	{
+ 		g_source_remove(pDock->iMousePollingSource);
+ 		pDock->iMousePollingSource=0;
+ 	}
+ 	
  	s_pLastPointedDock = NULL;  // ajoute le 04/10/07 pour permettre aux sous-docks d'apparaitre si on entre en pointant tout de suite sur l'icone.
  	if (! cairo_dock_entrance_is_allowed (pDock))
  	{
diff -c -r -b A/src/gldit/cairo-dock-dock-factory.h B/src/gldit/cairo-dock-dock-factory.h
*** A/src/gldit/cairo-dock-dock-factory.h	2010-07-24 18:42:00.000000000 +0430
--- B/src/gldit/cairo-dock-dock-factory.h	2010-08-08 00:45:50.000000000 +0430
***************
*** 261,268 ****
  	guint iSidLoadBg;
  	
  	gint iNbDrawnIcons;
  	
! 	gchar reserved[12];
  };
  
  
--- 261,269 ----
  	guint iSidLoadBg;
  	
  	gint iNbDrawnIcons;
+ 	guint iMousePollingSource;
  	
! 	gchar reserved[8];
  };

** Affects: cairo-dock-core
     Importance: Undecided
         Status: New

-- 
dock doesn't shrink
https://bugs.launchpad.net/bugs/614843
You received this bug notification because you are a member of Cairo-
Dock Team, which is subscribed to Cairo-Dock Core.

Status in Cairo-Dock : Core: New

Bug description:
Some times dock doesn't shrink when leave-notify is sent to dock but _mouse_is_really_outside is false.
for example when compiz is on (and desktop wall) if dock is in the bottom, when mouse gets out of dock towards the bottom edge and while on edge gets out of dock, dock doesn't shrink. this patch worked for me. using mouse polling if in leave-notify the _mouse_is_really_outside is false.
version cairo-dock 2.2.0-0beta3 using  ppa and ubuntu 10.04 , 64 bit
cairo-dock-core_2.2.0-0beta3-20100724-0ubuntu1~ppa0~lucid_amd64.deb

======== PATCH ========
diff -c -r -b A/src/gldit/cairo-dock-callbacks.c B/src/gldit/cairo-dock-callbacks.c
*** A/src/gldit/cairo-dock-callbacks.c	2010-07-24 18:42:00.000000000 +0430
--- B/src/gldit/cairo-dock-callbacks.c	2010-08-08 00:59:35.000000000 +0430
***************
*** 537,542 ****
--- 537,597 ----
  	return FALSE;
  }
  
+ gboolean on_mouse_polling(CairoDock *pDock);
+ 
+ gboolean on_mouse_polling(CairoDock *pDock)
+ {
+ 	gint x, y;
+ 	// get the mouse position
+ 	gdk_display_get_pointer (gdk_display_get_default(), NULL, &x, &y, NULL);
+ 	
+ 	// calculate mouse position realative to the widget
+ 	pDock->container.iMouseX=x-pDock->container.iWindowPositionX;
+ 	pDock->container.iMouseY=y-pDock->container.iWindowPositionY;
+ 	
+ 	// if mouse is outside send a leave notify
+ 	if(_mouse_is_really_outside(pDock))
+ 	{
+ 		// TODO: use a better way
+ 		GdkEventCrossing eventCrossing;
+ 		eventCrossing.x_root=x;
+ 		eventCrossing.y_root=y;
+ 		eventCrossing.x=pDock->container.iMouseX;
+ 		eventCrossing.y=pDock->container.iMouseY;
+ 		eventCrossing.state=0;
+ 		eventCrossing.window=pDock->container.pWidget;
+ 		eventCrossing.subwindow=eventCrossing.window;
+ 		eventCrossing.type=GDK_LEAVE_NOTIFY;
+ 		eventCrossing.send_event=1;
+ 		eventCrossing.detail=GDK_NOTIFY_NONLINEAR;
+ 		eventCrossing.mode=GDK_CROSSING_NORMAL;
+ 		eventCrossing.focus=FALSE;
+ 		
+ 		cairo_dock_on_leave_notify(pDock->container.pWidget,&eventCrossing,pDock);
+ 		return FALSE;
+ 	}
+ 	// otherwise if mouse is in, send a motion notify
+ 	else
+ 	{
+ 		// TODO: use a better way
+ 		GdkEventMotion eventMotion;
+ 		eventMotion.x_root=x;
+ 		eventMotion.y_root=y;
+ 		eventMotion.x=pDock->container.iMouseX;
+ 		eventMotion.y=pDock->container.iMouseY;
+ 		eventMotion.axes=NULL;
+ 		eventMotion.state=0;
+ 		eventMotion.is_hint=0;
+ 		eventMotion.window=pDock->container.pWidget;
+ 		eventMotion.device=NULL;
+ 		eventMotion.type=GDK_MOTION_NOTIFY;
+ 		eventMotion.send_event=1;
+ 		
+ 		cairo_dock_on_motion_notify(pDock->container.pWidget,&eventMotion,pDock);
+ 		return TRUE;
+ 	}
+ 	
+ }
  
  gboolean cairo_dock_on_leave_notify (GtkWidget* pWidget, GdkEventCrossing* pEvent, CairoDock *pDock)
  {
***************
*** 563,568 ****
--- 619,625 ----
  		if (!_mouse_is_really_outside(pDock))
  		{
  			//g_print ("not really outside (%d;%d ; %d/%d)\n", (int)pEvent->x, (int)pEvent->y, pDock->iMaxDockHeight, pDock->iMinDockHeight);
+ 			pDock->iMousePollingSource=g_timeout_add(cairo_dock_get_animation_delta_t(pDock),(GSourceFunc)on_mouse_polling,pDock); //maybe it is better to be adjusted
  			return FALSE;
  		}
  	}
***************
*** 693,698 ****
--- 754,766 ----
  gboolean cairo_dock_on_enter_notify (GtkWidget* pWidget, GdkEventCrossing* pEvent, CairoDock *pDock)
  {
  	//g_print ("%s (bIsMainDock : %d; bInside:%d; state:%d; iMagnitudeIndex:%d; input shape:%x; event:%ld)\n", __func__, pDock->bIsMainDock, pDock->container.bInside, pDock->iInputState, pDock->iMagnitudeIndex, pDock->pShapeBitmap, pEvent);
+ 	
+ 	if(pDock->iMousePollingSource!=0)
+ 	{
+ 		g_source_remove(pDock->iMousePollingSource);
+ 		pDock->iMousePollingSource=0;
+ 	}
+ 	
  	s_pLastPointedDock = NULL;  // ajoute le 04/10/07 pour permettre aux sous-docks d'apparaitre si on entre en pointant tout de suite sur l'icone.
  	if (! cairo_dock_entrance_is_allowed (pDock))
  	{
diff -c -r -b A/src/gldit/cairo-dock-dock-factory.h B/src/gldit/cairo-dock-dock-factory.h
*** A/src/gldit/cairo-dock-dock-factory.h	2010-07-24 18:42:00.000000000 +0430
--- B/src/gldit/cairo-dock-dock-factory.h	2010-08-08 00:45:50.000000000 +0430
***************
*** 261,268 ****
  	guint iSidLoadBg;
  	
  	gint iNbDrawnIcons;
  	
! 	gchar reserved[12];
  };
  
  
--- 261,269 ----
  	guint iSidLoadBg;
  	
  	gint iNbDrawnIcons;
+ 	guint iMousePollingSource;
  	
! 	gchar reserved[8];
  };





Follow ups

References