Commit f87ee7e5 authored by Tim Janik's avatar Tim Janik Committed by Tim Janik

added new flag GTK_EXCLUSIVE_GRAB. allow exclusive grabs.

Sun Mar 15 13:25:28 1998  Tim Janik  <timj@gimp.org>

        * gtk/gtkwidget.h: added new flag GTK_EXCLUSIVE_GRAB.
                * gtk/gtkmain.c: allow exclusive grabs.

                        * gtk/gtkmenu.c: grab exclusively.
                                * gtk/gtkmenushell.c: grab exclusively.

                                        * gtk/gtkmenushell.c: don't activate insensitive menu items when
                                                in click-selects mode.

                                                        * gtk/gtkmenushell.c (gtk_menu_shell_enter_notify): activate submenus
                                                                on popup.

                                                                        * gtk/gtkmenushell.c (gtk_menu_shell_button_release): don't take
                                                                                *additional* button presses into account.

                                                                                        * gtk/gtkmenushell.c (gtk_menu_shell_button_press): don't take
                                                                                                foreign button releases into account.


oh boy, please check this out people, hope i covered all cases.
parent 9ce0cb60
Sun Mar 15 13:25:28 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwidget.h: added new flag GTK_EXCLUSIVE_GRAB.
* gtk/gtkmain.c: allow exclusive grabs.
* gtk/gtkmenu.c: grab exclusively.
* gtk/gtkmenushell.c: grab exclusively.
* gtk/gtkmenushell.c: don't activate insensitive menu items when
in click-selects mode.
* gtk/gtkmenushell.c (gtk_menu_shell_enter_notify): activate submenus
on popup.
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): don't take
*additional* button presses into account.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): don't take
foreign button releases into account.
Sun Mar 15 08:27:06 1998 Tim Janik <timj@gimp.org>
* gtk/gtktipsquery.c (gtk_tips_query_set_labels): changed run type
......
Sun Mar 15 13:25:28 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwidget.h: added new flag GTK_EXCLUSIVE_GRAB.
* gtk/gtkmain.c: allow exclusive grabs.
* gtk/gtkmenu.c: grab exclusively.
* gtk/gtkmenushell.c: grab exclusively.
* gtk/gtkmenushell.c: don't activate insensitive menu items when
in click-selects mode.
* gtk/gtkmenushell.c (gtk_menu_shell_enter_notify): activate submenus
on popup.
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): don't take
*additional* button presses into account.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): don't take
foreign button releases into account.
Sun Mar 15 08:27:06 1998 Tim Janik <timj@gimp.org>
* gtk/gtktipsquery.c (gtk_tips_query_set_labels): changed run type
......
Sun Mar 15 13:25:28 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwidget.h: added new flag GTK_EXCLUSIVE_GRAB.
* gtk/gtkmain.c: allow exclusive grabs.
* gtk/gtkmenu.c: grab exclusively.
* gtk/gtkmenushell.c: grab exclusively.
* gtk/gtkmenushell.c: don't activate insensitive menu items when
in click-selects mode.
* gtk/gtkmenushell.c (gtk_menu_shell_enter_notify): activate submenus
on popup.
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): don't take
*additional* button presses into account.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): don't take
foreign button releases into account.
Sun Mar 15 08:27:06 1998 Tim Janik <timj@gimp.org>
* gtk/gtktipsquery.c (gtk_tips_query_set_labels): changed run type
......
Sun Mar 15 13:25:28 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwidget.h: added new flag GTK_EXCLUSIVE_GRAB.
* gtk/gtkmain.c: allow exclusive grabs.
* gtk/gtkmenu.c: grab exclusively.
* gtk/gtkmenushell.c: grab exclusively.
* gtk/gtkmenushell.c: don't activate insensitive menu items when
in click-selects mode.
* gtk/gtkmenushell.c (gtk_menu_shell_enter_notify): activate submenus
on popup.
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): don't take
*additional* button presses into account.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): don't take
foreign button releases into account.
Sun Mar 15 08:27:06 1998 Tim Janik <timj@gimp.org>
* gtk/gtktipsquery.c (gtk_tips_query_set_labels): changed run type
......
Sun Mar 15 13:25:28 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwidget.h: added new flag GTK_EXCLUSIVE_GRAB.
* gtk/gtkmain.c: allow exclusive grabs.
* gtk/gtkmenu.c: grab exclusively.
* gtk/gtkmenushell.c: grab exclusively.
* gtk/gtkmenushell.c: don't activate insensitive menu items when
in click-selects mode.
* gtk/gtkmenushell.c (gtk_menu_shell_enter_notify): activate submenus
on popup.
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): don't take
*additional* button presses into account.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): don't take
foreign button releases into account.
Sun Mar 15 08:27:06 1998 Tim Janik <timj@gimp.org>
* gtk/gtktipsquery.c (gtk_tips_query_set_labels): changed run type
......
Sun Mar 15 13:25:28 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwidget.h: added new flag GTK_EXCLUSIVE_GRAB.
* gtk/gtkmain.c: allow exclusive grabs.
* gtk/gtkmenu.c: grab exclusively.
* gtk/gtkmenushell.c: grab exclusively.
* gtk/gtkmenushell.c: don't activate insensitive menu items when
in click-selects mode.
* gtk/gtkmenushell.c (gtk_menu_shell_enter_notify): activate submenus
on popup.
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): don't take
*additional* button presses into account.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): don't take
foreign button releases into account.
Sun Mar 15 08:27:06 1998 Tim Janik <timj@gimp.org>
* gtk/gtktipsquery.c (gtk_tips_query_set_labels): changed run type
......
Sun Mar 15 13:25:28 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwidget.h: added new flag GTK_EXCLUSIVE_GRAB.
* gtk/gtkmain.c: allow exclusive grabs.
* gtk/gtkmenu.c: grab exclusively.
* gtk/gtkmenushell.c: grab exclusively.
* gtk/gtkmenushell.c: don't activate insensitive menu items when
in click-selects mode.
* gtk/gtkmenushell.c (gtk_menu_shell_enter_notify): activate submenus
on popup.
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): don't take
*additional* button presses into account.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): don't take
foreign button releases into account.
Sun Mar 15 08:27:06 1998 Tim Janik <timj@gimp.org>
* gtk/gtktipsquery.c (gtk_tips_query_set_labels): changed run type
......
......@@ -510,7 +510,8 @@ gtk_main_iteration_do (gboolean blocking)
* then we send the event to the original event widget.
* This is the key to implementing modality.
*/
if (gtk_widget_is_ancestor (event_widget, grab_widget))
if (!GTK_WIDGET_EXCLUSIVE_GRAB (grab_widget) &&
gtk_widget_is_ancestor (event_widget, grab_widget))
grab_widget = event_widget;
}
else
......
......@@ -293,6 +293,7 @@ gtk_menu_popup (GtkMenu *menu,
gtk_widget_show (GTK_WIDGET (menu));
gtk_grab_add (GTK_WIDGET (menu));
GTK_WIDGET_SET_FLAGS (menu, GTK_EXCLUSIVE_GRAB);
}
void
......@@ -317,6 +318,7 @@ gtk_menu_popdown (GtkMenu *menu)
gtk_widget_hide (GTK_WIDGET (menu));
gtk_grab_remove (GTK_WIDGET (menu));
GTK_WIDGET_SET_FLAGS (menu, GTK_EXCLUSIVE_GRAB);
}
GtkWidget*
......
......@@ -298,11 +298,17 @@ gtk_menu_shell_button_press (GtkWidget *widget,
if (!menu_shell->active)
{
gtk_grab_add (GTK_WIDGET (widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_EXCLUSIVE_GRAB);
menu_shell->have_grab = TRUE;
menu_shell->active = TRUE;
}
menu_shell->active = TRUE;
menu_shell->button = event->button;
menu_item = gtk_get_event_widget ((GdkEvent*) event);
if (!GTK_WIDGET_IS_SENSITIVE (menu_item))
return TRUE;
if (menu_item && GTK_IS_MENU_ITEM (menu_item) &&
gtk_menu_shell_is_item (menu_shell, menu_item))
{
......@@ -318,13 +324,6 @@ gtk_menu_shell_button_press (GtkWidget *widget,
gtk_menu_item_select (GTK_MENU_ITEM (menu_shell->active_menu_item));
}
}
else if (!menu_shell->button)
{
gtk_menu_shell_deactivate (menu_shell);
}
if (menu_shell->active)
menu_shell->button = event->button;
}
else
{
......@@ -351,16 +350,19 @@ gtk_menu_shell_button_release (GtkWidget *widget,
menu_shell = GTK_MENU_SHELL (widget);
if (menu_shell->active)
{
if (menu_shell->button && (event->button != menu_shell->button))
if (event->button != menu_shell->button)
{
menu_shell->button = 0;
if (menu_shell->parent_menu_shell)
gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event);
return TRUE;
}
menu_shell->button = 0;
menu_item = gtk_get_event_widget ((GdkEvent*) event);
if (!GTK_WIDGET_IS_SENSITIVE (menu_item))
return TRUE;
deactivate = TRUE;
if ((event->time - menu_shell->activate_time) > MENU_SHELL_TIMEOUT)
......@@ -437,6 +439,8 @@ gtk_menu_shell_enter_notify (GtkWidget *widget,
gtk_menu_item_set_placement (GTK_MENU_ITEM (menu_shell->active_menu_item),
MENU_SHELL_CLASS (menu_shell)->submenu_placement);
gtk_menu_item_select (GTK_MENU_ITEM (menu_shell->active_menu_item));
if (GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu)
gtk_widget_activate (menu_shell->active_menu_item);
}
}
else if (menu_shell->parent_menu_shell)
......@@ -574,6 +578,7 @@ gtk_real_menu_shell_deactivate (GtkMenuShell *menu_shell)
{
menu_shell->have_grab = FALSE;
gtk_grab_remove (GTK_WIDGET (menu_shell));
GTK_WIDGET_UNSET_FLAGS (menu_shell, GTK_EXCLUSIVE_GRAB);
}
if (menu_shell->have_xgrab)
{
......
......@@ -17,8 +17,6 @@
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id$
*/
#include "gtktipsquery.h"
#include "gtksignal.h"
......
......@@ -48,7 +48,7 @@ enum
GTK_HAS_DEFAULT = 1 << 14,
GTK_HAS_GRAB = 1 << 15,
GTK_BASIC = 1 << 16,
GTK_RESERVED_3 = 1 << 17,
GTK_EXCLUSIVE_GRAB = 1 << 17,
GTK_RC_STYLE = 1 << 18
};
......@@ -86,6 +86,7 @@ enum
#define GTK_WIDGET_HAS_DEFAULT(wid) (GTK_WIDGET_FLAGS (wid) & GTK_HAS_DEFAULT)
#define GTK_WIDGET_HAS_GRAB(wid) (GTK_WIDGET_FLAGS (wid) & GTK_HAS_GRAB)
#define GTK_WIDGET_BASIC(wid) (GTK_WIDGET_FLAGS (wid) & GTK_BASIC)
#define GTK_WIDGET_EXCLUSIVE_GRAB(wid) (GTK_WIDGET_FLAGS (wid) & GTK_EXCLUSIVE_GRAB)
#define GTK_WIDGET_RC_STYLE(wid) (GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE)
/* Macros for setting and clearing widget flags.
......
......@@ -1924,6 +1924,8 @@ create_menu (int depth)
gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (menuitem), TRUE);
gtk_menu_append (GTK_MENU (menu), menuitem);
gtk_widget_show (menuitem);
if (i == 3)
gtk_widget_set_sensitive (menuitem, FALSE);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (depth - 1));
}
......
......@@ -1924,6 +1924,8 @@ create_menu (int depth)
gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (menuitem), TRUE);
gtk_menu_append (GTK_MENU (menu), menuitem);
gtk_widget_show (menuitem);
if (i == 3)
gtk_widget_set_sensitive (menuitem, FALSE);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (depth - 1));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment