hi, Chris
This is the newest patch for bug 49912, it can:
1) set a has_popup property for EText to trace the status of activated popup menu.
2) skip focus change event ptocess in e-minicard and e-minicard-label.
thx for your previous comments and suggestions.
can you review this patch?
regards
leon
______________________________________________________________________
Index: evolution/addressbook/ChangeLog
===================================================================
RCS file: /export/src/cvs/evolution/addressbook/ChangeLog,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ChangeLog
--- evolution/addressbook/ChangeLog 2003/09/26 06:34:28 1.1.1.1
+++ evolution/addressbook/ChangeLog 2003/10/29 01:11:46
@@ -1,3 +1,11 @@
+2003-10-28 Leon Zhang <leon zhang sun com>
+
+ * gui/widgets/e-minicard.c: (e_minicard_event): skip focus change
+ event if there is an activated popup menu.
+
+ * gui/widgets/e-minicard-label.c: (e_minicard_label_event):
+ skip focus change event if there is an activated popup menu.
+
2003-09-05 Dan Winship <danw ximian com>
* gui/component/select-names/Makefile.am: Make libeselectnames.la
Index: evolution/addressbook/gui/widgets/e-minicard.c
===================================================================
RCS file: /export/src/cvs/evolution/addressbook/gui/widgets/e-minicard.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 e-minicard.c
--- evolution/addressbook/gui/widgets/e-minicard.c 2003/09/26 06:34:28 1.1.1.1
+++ evolution/addressbook/gui/widgets/e-minicard.c 2003/10/29 01:11:46
@@ -552,6 +552,21 @@
switch( event->type ) {
case GDK_FOCUS_CHANGE:
{
+ /* if there is an activated popup menu, skip current event */
+ GList *list;
+ gboolean popup = FALSE;
+ for (list = e_minicard->fields; list; list = list->next) {
+ EMinicardField *field = E_MINICARD_FIELD(list->data);
+ EMinicardLabel *e_minicard_label = E_MINICARD_LABEL(GTK_OBJECT(field->label));
+ if (e_minicard_label->has_focus){
+ g_object_get (e_minicard_label->field, "has_popup", &popup, NULL);
+ if (popup) break;
+ }
+ }
+
+ if (popup)
+ break;
+
GdkEventFocus *focus_event = (GdkEventFocus *) event;
d(g_print("%s: GDK_FOCUS_CHANGE: %s\n", G_GNUC_FUNCTION, focus_event->in?"in":"out"));
if (focus_event->in) {
Index: evolution/addressbook/gui/widgets/e-minicard-label.c
===================================================================
RCS file: /export/src/cvs/evolution/addressbook/gui/widgets/e-minicard-label.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 e-minicard-label.c
--- evolution/addressbook/gui/widgets/e-minicard-label.c 2003/09/26 06:34:28 1.1.1.1
+++ evolution/addressbook/gui/widgets/e-minicard-label.c 2003/10/29 01:11:46
@@ -364,6 +364,10 @@
}
break;
case GDK_FOCUS_CHANGE: {
+ gboolean popup;
+ g_object_get (e_minicard_label->field, "has_popup", &popup, NULL);
+ if (popup) break;
+
GdkEventFocus *focus_event = (GdkEventFocus *) event;
e_minicard_label->has_focus = focus_event->in;
Index: gal/ChangeLog
===================================================================
RCS file: /export/src/cvs/gal/ChangeLog,v
retrieving revision 1.3
diff -u -r1.3 ChangeLog
--- gal/ChangeLog 2003/09/28 08:42:27 1.3
+++ gal/ChangeLog 2003/10/29 01:11:46
@@ -1,3 +1,20 @@
+2003-10-28 Leon Zhang <leon zhang sun com>
+
+ * gal/e-text/e-text.h: add add "has_popup" field for user to trace
+ the status of popup menu.
+
+ * gal/e-text/e-text.c:
+ (e_text_get_property): add getter for has_popup.
+ (popup_targets_received): set "has_popup" of EText before popup menu
+ appear, and support signal "deactivate".
+ (e_text_popup_deactivated): callback of signal "deactivate".
+ (e_text_init): init default has_popup to FALSE.
+ (e_text_class_init): install the has_popup property.
+
+2003-04-03 Chris Toshok <toshok ximian com>
+
+ * gal/e-text/e-text.c (e_text_commit_cb): emit a keypress signal.
+ yes, i know this might not correspond to a single keypress, but..
2003-09-28 Gilbert Fang <gilbert fang sun com>
* gal/a11y/Makefile.am: add e-table atk support to libgal a11y
Index: gal/gal/e-text/e-text.c
===================================================================
RCS file: /export/src/cvs/gal/gal/e-text/e-text.c,v
retrieving revision 1.2
diff -u -r1.2 e-text.c
--- gal/gal/e-text/e-text.c 2003/09/27 10:33:14 1.2
+++ gal/gal/e-text/e-text.c 2003/10/29 01:11:46
@@ -122,7 +122,8 @@
PROP_DRAW_BUTTON,
PROP_CURSOR_POS,
PROP_IM_CONTEXT,
- PROP_HANDLE_POPUP
+ PROP_HANDLE_POPUP,
+ PROP_HAS_POPUP
};
static void e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gpointer data);
@@ -1078,6 +1079,10 @@
g_value_set_boolean (value, text->handle_popup);
break;
+ case PROP_HAS_POPUP:
+ g_value_set_boolean (value, text->has_popup);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -2557,6 +2562,12 @@
}
static void
+e_text_popup_deactivated (EText *text)
+{
+ text->has_popup = FALSE;
+}
+
+static void
popup_targets_received (GtkClipboard *clipboard,
GtkSelectionData *data,
gpointer user_data)
@@ -2574,6 +2585,11 @@
GTK_WIDGET(GNOME_CANVAS_ITEM (text)->canvas),
popup_menu_detach);
+ text->has_popup = TRUE;
+
+ g_signal_connect_swapped(GTK_MENU_SHELL (popup_menu), "deactivate",
+ G_CALLBACK (e_text_popup_deactivated), text);
+
/* cut menu item */
menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_CUT, NULL);
gtk_widget_show (menuitem);
@@ -3596,6 +3612,13 @@
FALSE,
G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class, PROP_HAS_POPUP,
+ g_param_spec_boolean ("has_popup",
+ _( "Has Popup" ),
+ _( "Has Popup" ),
+ FALSE,
+ G_PARAM_READABLE));
+
if (!clipboard_atom)
clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
@@ -3691,6 +3714,7 @@
text->im_context_signals_registered = FALSE;
text->handle_popup = FALSE;
+ text->has_popup = FALSE;
e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(text), e_text_reflow);
Index: gal/gal/e-text/e-text.h
===================================================================
RCS file: /export/src/cvs/gal/gal/e-text/e-text.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 e-text.h
--- gal/gal/e-text/e-text.h 2003/09/26 06:37:14 1.1.1.1
+++ gal/gal/e-text/e-text.h 2003/10/29 01:11:46
@@ -214,6 +214,7 @@
gboolean im_context_signals_registered;
gboolean handle_popup;
+ gboolean has_popup;
};
struct _ETextClass {