Mercurial > projects > dwt-linux
diff dwt/widgets/Menu.d @ 240:ce446666f5a2
Update to SWT 3.4M7
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 12 May 2008 19:13:01 +0200 |
parents | 380bad9f6852 |
children | 5a30aa9820f3 |
line wrap: on
line diff
--- a/dwt/widgets/Menu.d Mon May 12 15:36:37 2008 +0200 +++ b/dwt/widgets/Menu.d Mon May 12 19:13:01 2008 +0200 @@ -190,7 +190,15 @@ sendEvent (DWT.Show); if (getItemCount () !is 0) { if ((OS.GTK_VERSION >= OS.buildVERSION (2, 8, 0))) { - OS.gtk_menu_shell_set_take_focus (cast(GtkMenuShell*)handle, false); + /* + * Feature in GTK. ON_TOP shells will send out + * DWT.Deactivate whenever a context menu is shown. + * The fix is to prevent the menu from taking focus + * when it is being shown in an ON_TOP shell. + */ + if ((parent._getShell ().style & DWT.ON_TOP) !is 0) { + OS.gtk_menu_shell_set_take_focus (cast(GtkMenuShell*)handle, false); + } } /* * Bug in GTK. The timestamp passed into gtk_menu_popup is used @@ -710,9 +718,9 @@ OS.gtk_widget_size_request (cast(GtkWidget*)menu, &requisition); int screenHeight = OS.gdk_screen_height (); int reqy = this.y; - if (reqy + requisition.height > screenHeight && reqy - requisition.height >= 0) { - reqy -= requisition.height; - } + if (reqy + requisition.height > screenHeight) { + reqy = Math.max (0, reqy - requisition.height); + } int screenWidth = OS.gdk_screen_width (); int reqx = this.x; if ((style & DWT.RIGHT_TO_LEFT) !is 0) {