[Goodies-commits] r7444 - in xfce4-notes-plugin/trunk: . panel-plugin
Mike Massonnet
mmassonnet at xfce.org
Sat May 30 00:57:57 CEST 2009
Author: mmassonnet
Date: 2009-05-29 22:57:57 +0000 (Fri, 29 May 2009)
New Revision: 7444
Modified:
xfce4-notes-plugin/trunk/ChangeLog
xfce4-notes-plugin/trunk/panel-plugin/window.vala
Log:
Postpone the hide navigation timeout longer on button press events
Modified: xfce4-notes-plugin/trunk/ChangeLog
===================================================================
--- xfce4-notes-plugin/trunk/ChangeLog 2009-05-29 21:38:41 UTC (rev 7443)
+++ xfce4-notes-plugin/trunk/ChangeLog 2009-05-29 22:57:57 UTC (rev 7444)
@@ -1,3 +1,14 @@
+2009-05-30 Mike Massonnet <mmassonnet at xfce.org>
+
+Postpone the hide navigation timeout longer on button press events
+ * panel-plugin/window.vala:
+ - The leave event is emitted on button press events or by hovering
+ an unsensitive widget, instead of hidding the navigation bar in 2
+ seconds, it hides in 10 seconds. If we would keep it shown, another
+ bug would be introduced when popping up a menu, in that case the
+ menu can be closed while the pointer is outside the window and then
+ the navigation would be shown forever.
+
2009-05-29 Mike Massonnet <mmassonnet at xfce.org>
Generate an available name for a new window/note
Modified: xfce4-notes-plugin/trunk/panel-plugin/window.vala
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/window.vala 2009-05-29 21:38:41 UTC (rev 7443)
+++ xfce4-notes-plugin/trunk/panel-plugin/window.vala 2009-05-29 22:57:57 UTC (rev 7444)
@@ -246,24 +246,8 @@
hide_cb ();
return true;
};
- leave_notify_event += () => {
- /* Hide the navigation when the mouse pointer is leaving the window */
- navigation_timeout = Timeout.add_seconds (2, () => {
- navigation_box.hide ();
- navigation_timeout = 0;
- return false;
- });
- return false;
- };
- motion_notify_event += () => {
- /* Show the navigation when the mouse pointer is hovering the window */
- if (navigation_timeout != 0) {
- Source.remove (navigation_timeout);
- navigation_timeout = 0;
- }
- navigation_box.show ();
- return false;
- };
+ leave_notify_event += navigation_leaved_cb;
+ motion_notify_event += navigation_motion_cb;
leave_notify_event += window_leaved_cb;
motion_notify_event += window_motion_cb;
button_press_event += window_pressed_cb;
@@ -306,53 +290,52 @@
*/
/**
- * menu_box_pressed_cb:
+ * hide_cb:
*
- * Popup the window menu.
+ * Save position before hidding.
*/
- private bool menu_box_pressed_cb (Gtk.EventBox box, Gdk.EventButton event) {
- this.menu.popup (null, null, menu_position, 0, Gtk.get_current_event_time ());
- return false;
+ private void hide_cb () {
+ int winx, winy;
+ get_position (out winx, out winy);
+ hide ();
+ unshade ();
+ move (winx, winy);
}
/**
- * menu_position:
+ * navigation_leaved_cb:
*
- * Menu position function for the window menu.
+ * Hide the navigation when the mouse pointer is leaving the window.
*/
- private void menu_position (Gtk.Menu menu, out int x, out int y, out bool push_in) {
- int winx, winy, width, height, depth;
- Gtk.Requisition requisition;
- window.get_geometry (out winx, out winy, out width, out height, out depth);
- window.get_origin (out x, out y);
- menu.size_request (out requisition);
-
- if (y + content_box.allocation.y + requisition.height > Gdk.Screen.height ()) {
- /* Show menu above */
- y -= requisition.height;
+ private bool navigation_leaved_cb () {
+ int timeout = 2;
+ if (is_active) {
+ int x, y;
+ get_pointer (out x, out y);
+ if (x >= 0 && x < allocation.width && y >= 0 && y < allocation.height) {
+ timeout = 10;
+ }
}
- else {
- /* Show menu below */
- y += content_box.allocation.y;
- }
- if (x + requisition.width > Gdk.Screen.width ()) {
- /* Adjust menu left */
- debug ("%d %d", Gdk.Screen.width (), x);
- x = x - menu.requisition.width + content_box.allocation.y;
- }
+ navigation_timeout = Timeout.add_seconds (timeout, () => {
+ navigation_box.hide ();
+ navigation_timeout = 0;
+ return false;
+ });
+ return false;
}
/**
- * hide_cb:
+ * navigation_motion_cb:
*
- * Save position before hidding.
+ * Show the navigation when the mouse pointer is hovering the window.
*/
- private void hide_cb () {
- int winx, winy;
- get_position (out winx, out winy);
- hide ();
- unshade ();
- move (winx, winy);
+ private bool navigation_motion_cb () {
+ if (navigation_timeout != 0) {
+ Source.remove (navigation_timeout);
+ navigation_timeout = 0;
+ }
+ navigation_box.show ();
+ return false;
}
/**
@@ -591,6 +574,43 @@
*/
/**
+ * menu_box_pressed_cb:
+ *
+ * Popup the window menu.
+ */
+ private bool menu_box_pressed_cb (Gtk.EventBox box, Gdk.EventButton event) {
+ this.menu.popup (null, null, menu_position, 0, Gtk.get_current_event_time ());
+ return false;
+ }
+
+ /**
+ * menu_position:
+ *
+ * Menu position function for the window menu.
+ */
+ private void menu_position (Gtk.Menu menu, out int x, out int y, out bool push_in) {
+ int winx, winy, width, height, depth;
+ Gtk.Requisition requisition;
+ window.get_geometry (out winx, out winy, out width, out height, out depth);
+ window.get_origin (out x, out y);
+ menu.size_request (out requisition);
+
+ if (y + content_box.allocation.y + requisition.height > Gdk.Screen.height ()) {
+ /* Show menu above */
+ y -= requisition.height;
+ }
+ else {
+ /* Show menu below */
+ y += content_box.allocation.y;
+ }
+ if (x + requisition.width > Gdk.Screen.width ()) {
+ /* Adjust menu left */
+ debug ("%d %d", Gdk.Screen.width (), x);
+ x = x - menu.requisition.width + content_box.allocation.y;
+ }
+ }
+
+ /**
* build_menu:
*
* Build the window menu.
More information about the Goodies-commits
mailing list