Mercurial > projects > dwt-linux
comparison 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 |
comparison
equal
deleted
inserted
replaced
239:06a1f6829310 | 240:ce446666f5a2 |
---|---|
188 if (visible is OS.GTK_WIDGET_MAPPED (handle)) return; | 188 if (visible is OS.GTK_WIDGET_MAPPED (handle)) return; |
189 if (visible) { | 189 if (visible) { |
190 sendEvent (DWT.Show); | 190 sendEvent (DWT.Show); |
191 if (getItemCount () !is 0) { | 191 if (getItemCount () !is 0) { |
192 if ((OS.GTK_VERSION >= OS.buildVERSION (2, 8, 0))) { | 192 if ((OS.GTK_VERSION >= OS.buildVERSION (2, 8, 0))) { |
193 OS.gtk_menu_shell_set_take_focus (cast(GtkMenuShell*)handle, false); | 193 /* |
194 * Feature in GTK. ON_TOP shells will send out | |
195 * DWT.Deactivate whenever a context menu is shown. | |
196 * The fix is to prevent the menu from taking focus | |
197 * when it is being shown in an ON_TOP shell. | |
198 */ | |
199 if ((parent._getShell ().style & DWT.ON_TOP) !is 0) { | |
200 OS.gtk_menu_shell_set_take_focus (cast(GtkMenuShell*)handle, false); | |
201 } | |
194 } | 202 } |
195 /* | 203 /* |
196 * Bug in GTK. The timestamp passed into gtk_menu_popup is used | 204 * Bug in GTK. The timestamp passed into gtk_menu_popup is used |
197 * to perform an X pointer grab. It cannot be zero, else the grab | 205 * to perform an X pointer grab. It cannot be zero, else the grab |
198 * will fail. The fix is to ensure that the timestamp of the last | 206 * will fail. The fix is to ensure that the timestamp of the last |
708 */ | 716 */ |
709 GtkRequisition requisition; | 717 GtkRequisition requisition; |
710 OS.gtk_widget_size_request (cast(GtkWidget*)menu, &requisition); | 718 OS.gtk_widget_size_request (cast(GtkWidget*)menu, &requisition); |
711 int screenHeight = OS.gdk_screen_height (); | 719 int screenHeight = OS.gdk_screen_height (); |
712 int reqy = this.y; | 720 int reqy = this.y; |
713 if (reqy + requisition.height > screenHeight && reqy - requisition.height >= 0) { | 721 if (reqy + requisition.height > screenHeight) { |
714 reqy -= requisition.height; | 722 reqy = Math.max (0, reqy - requisition.height); |
715 } | 723 } |
716 int screenWidth = OS.gdk_screen_width (); | 724 int screenWidth = OS.gdk_screen_width (); |
717 int reqx = this.x; | 725 int reqx = this.x; |
718 if ((style & DWT.RIGHT_TO_LEFT) !is 0) { | 726 if ((style & DWT.RIGHT_TO_LEFT) !is 0) { |
719 if (reqx - requisition.width >= 0) reqx -= requisition.width; | 727 if (reqx - requisition.width >= 0) reqx -= requisition.width; |
720 } else { | 728 } else { |