forked from AuroraMiddleware/gtk
Patch from Frederic Crozat, test code from Jean-Philippe Chancelier. Fixes
Tue Mar 2 21:23:30 2004 Soeren Sandmann <sandmann@daimi.au.dk> Patch from Frederic Crozat, test code from Jean-Philippe Chancelier. Fixes bug #120479. * gtk/gtkcombo.c (gtk_combo_popup_list): Make sure popup belongs to the right window group. * gtk/gtkmenu.c (gtk_menu_popup): Same * tests/testsocket.c (main): Pack the plugs into an hbox instead of a vbox. * tests/testsocket_common.c: Add a GtkMenuBar, a GtkCombo and a GtkComboBox to the children.
This commit is contained in:
parent
f05cb42db9
commit
cddfd994ef
17
ChangeLog
17
ChangeLog
@ -1,3 +1,19 @@
|
||||
Tue Mar 2 21:23:30 2004 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
Patch from Frederic Crozat, test code from Jean-Philippe
|
||||
Chancelier. Fixes bug #120479.
|
||||
|
||||
* gtk/gtkcombo.c (gtk_combo_popup_list): Make sure popup belongs
|
||||
to the right window group.
|
||||
|
||||
* gtk/gtkmenu.c (gtk_menu_popup): Same
|
||||
|
||||
* tests/testsocket.c (main): Pack the plugs into an hbox instead
|
||||
of a vbox.
|
||||
|
||||
* tests/testsocket_common.c: Add a GtkMenuBar, a GtkCombo and a
|
||||
GtkComboBox to the children.
|
||||
|
||||
Tue Mar 2 14:38:23 2004 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkcombobox.c (gtk_combo_box_model_row_inserted):
|
||||
@ -89,6 +105,7 @@ Tue Mar 2 17:55:31 2004 Matthias Clasen <maclas@gmx.de>
|
||||
(gtk_file_chooser_default_get_resizable_hints): Test the
|
||||
resize_horizontally pointer, not the deferenced pointer.
|
||||
|
||||
>>>>>>> 1.5102
|
||||
2004-03-01 Federico Mena Quintero <federico@ximian.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (struct _GtkFileChooserDefault): New
|
||||
|
@ -1,3 +1,19 @@
|
||||
Tue Mar 2 21:23:30 2004 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
Patch from Frederic Crozat, test code from Jean-Philippe
|
||||
Chancelier. Fixes bug #120479.
|
||||
|
||||
* gtk/gtkcombo.c (gtk_combo_popup_list): Make sure popup belongs
|
||||
to the right window group.
|
||||
|
||||
* gtk/gtkmenu.c (gtk_menu_popup): Same
|
||||
|
||||
* tests/testsocket.c (main): Pack the plugs into an hbox instead
|
||||
of a vbox.
|
||||
|
||||
* tests/testsocket_common.c: Add a GtkMenuBar, a GtkCombo and a
|
||||
GtkComboBox to the children.
|
||||
|
||||
Tue Mar 2 14:38:23 2004 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkcombobox.c (gtk_combo_box_model_row_inserted):
|
||||
@ -89,6 +105,7 @@ Tue Mar 2 17:55:31 2004 Matthias Clasen <maclas@gmx.de>
|
||||
(gtk_file_chooser_default_get_resizable_hints): Test the
|
||||
resize_horizontally pointer, not the deferenced pointer.
|
||||
|
||||
>>>>>>> 1.5102
|
||||
2004-03-01 Federico Mena Quintero <federico@ximian.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (struct _GtkFileChooserDefault): New
|
||||
|
@ -1,3 +1,19 @@
|
||||
Tue Mar 2 21:23:30 2004 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
Patch from Frederic Crozat, test code from Jean-Philippe
|
||||
Chancelier. Fixes bug #120479.
|
||||
|
||||
* gtk/gtkcombo.c (gtk_combo_popup_list): Make sure popup belongs
|
||||
to the right window group.
|
||||
|
||||
* gtk/gtkmenu.c (gtk_menu_popup): Same
|
||||
|
||||
* tests/testsocket.c (main): Pack the plugs into an hbox instead
|
||||
of a vbox.
|
||||
|
||||
* tests/testsocket_common.c: Add a GtkMenuBar, a GtkCombo and a
|
||||
GtkComboBox to the children.
|
||||
|
||||
Tue Mar 2 14:38:23 2004 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkcombobox.c (gtk_combo_box_model_row_inserted):
|
||||
@ -89,6 +105,7 @@ Tue Mar 2 17:55:31 2004 Matthias Clasen <maclas@gmx.de>
|
||||
(gtk_file_chooser_default_get_resizable_hints): Test the
|
||||
resize_horizontally pointer, not the deferenced pointer.
|
||||
|
||||
>>>>>>> 1.5102
|
||||
2004-03-01 Federico Mena Quintero <federico@ximian.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (struct _GtkFileChooserDefault): New
|
||||
|
@ -1,3 +1,19 @@
|
||||
Tue Mar 2 21:23:30 2004 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
Patch from Frederic Crozat, test code from Jean-Philippe
|
||||
Chancelier. Fixes bug #120479.
|
||||
|
||||
* gtk/gtkcombo.c (gtk_combo_popup_list): Make sure popup belongs
|
||||
to the right window group.
|
||||
|
||||
* gtk/gtkmenu.c (gtk_menu_popup): Same
|
||||
|
||||
* tests/testsocket.c (main): Pack the plugs into an hbox instead
|
||||
of a vbox.
|
||||
|
||||
* tests/testsocket_common.c: Add a GtkMenuBar, a GtkCombo and a
|
||||
GtkComboBox to the children.
|
||||
|
||||
Tue Mar 2 14:38:23 2004 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkcombobox.c (gtk_combo_box_model_row_inserted):
|
||||
@ -89,6 +105,7 @@ Tue Mar 2 17:55:31 2004 Matthias Clasen <maclas@gmx.de>
|
||||
(gtk_file_chooser_default_get_resizable_hints): Test the
|
||||
resize_horizontally pointer, not the deferenced pointer.
|
||||
|
||||
>>>>>>> 1.5102
|
||||
2004-03-01 Federico Mena Quintero <federico@ximian.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (struct _GtkFileChooserDefault): New
|
||||
|
@ -1,3 +1,19 @@
|
||||
Tue Mar 2 21:23:30 2004 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
Patch from Frederic Crozat, test code from Jean-Philippe
|
||||
Chancelier. Fixes bug #120479.
|
||||
|
||||
* gtk/gtkcombo.c (gtk_combo_popup_list): Make sure popup belongs
|
||||
to the right window group.
|
||||
|
||||
* gtk/gtkmenu.c (gtk_menu_popup): Same
|
||||
|
||||
* tests/testsocket.c (main): Pack the plugs into an hbox instead
|
||||
of a vbox.
|
||||
|
||||
* tests/testsocket_common.c: Add a GtkMenuBar, a GtkCombo and a
|
||||
GtkComboBox to the children.
|
||||
|
||||
Tue Mar 2 14:38:23 2004 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkcombobox.c (gtk_combo_box_model_row_inserted):
|
||||
@ -89,6 +105,7 @@ Tue Mar 2 17:55:31 2004 Matthias Clasen <maclas@gmx.de>
|
||||
(gtk_file_chooser_default_get_resizable_hints): Test the
|
||||
resize_horizontally pointer, not the deferenced pointer.
|
||||
|
||||
>>>>>>> 1.5102
|
||||
2004-03-01 Federico Mena Quintero <federico@ximian.com>
|
||||
|
||||
* gtk/gtkfilechooserdefault.c (struct _GtkFileChooserDefault): New
|
||||
|
@ -515,6 +515,7 @@ gtk_combo_get_pos (GtkCombo * combo, gint * x, gint * y, gint * height, gint * w
|
||||
static void
|
||||
gtk_combo_popup_list (GtkCombo * combo)
|
||||
{
|
||||
GtkWidget *toplevel;
|
||||
GtkList *list;
|
||||
gint height, width, x, y;
|
||||
gint old_width, old_height;
|
||||
@ -553,6 +554,15 @@ gtk_combo_popup_list (GtkCombo * combo)
|
||||
}
|
||||
|
||||
gtk_window_move (GTK_WINDOW (combo->popwin), x, y);
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (combo);
|
||||
|
||||
if (GTK_IS_WINDOW (toplevel))
|
||||
{
|
||||
gtk_window_group_add_window (_gtk_window_get_group (GTK_WINDOW (toplevel)),
|
||||
GTK_WINDOW (combo->popwin));
|
||||
}
|
||||
|
||||
gtk_widget_set_size_request (combo->popwin, width, height);
|
||||
gtk_widget_show (combo->popwin);
|
||||
|
||||
@ -580,6 +590,8 @@ gtk_combo_popdown_list (GtkCombo *combo)
|
||||
}
|
||||
|
||||
gtk_widget_hide (combo->popwin);
|
||||
|
||||
gtk_window_group_add_window (_gtk_window_get_group (NULL), GTK_WINDOW (combo->popwin));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -1268,6 +1268,16 @@ gtk_menu_popup (GtkMenu *menu,
|
||||
|
||||
gtk_menu_reparent (menu, menu->toplevel, FALSE);
|
||||
}
|
||||
|
||||
if (parent_menu_shell)
|
||||
{
|
||||
GtkWidget *toplevel;
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (parent_menu_shell);
|
||||
if (GTK_IS_WINDOW (toplevel))
|
||||
gtk_window_group_add_window (_gtk_window_get_group (GTK_WINDOW (toplevel)),
|
||||
GTK_WINDOW (menu->toplevel));
|
||||
}
|
||||
|
||||
menu->parent_menu_item = parent_menu_item;
|
||||
menu->position_func = func;
|
||||
@ -1347,6 +1357,7 @@ gtk_menu_popdown (GtkMenu *menu)
|
||||
/* The X Grab, if present, will automatically be removed when we hide
|
||||
* the window */
|
||||
gtk_widget_hide (menu->toplevel);
|
||||
gtk_window_group_add_window (_gtk_window_get_group (NULL), GTK_WINDOW (menu->toplevel));
|
||||
|
||||
if (menu->torn_off)
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ int n_children = 0;
|
||||
GSList *sockets = NULL;
|
||||
|
||||
GtkWidget *window;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *box;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -129,7 +129,7 @@ steal (GtkWidget *window, GtkEntry *entry)
|
||||
}
|
||||
|
||||
socket = create_socket ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), socket->box, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box), socket->box, TRUE, TRUE, 0);
|
||||
gtk_widget_show (socket->box);
|
||||
|
||||
gtk_socket_steal (GTK_SOCKET (socket->socket), xid);
|
||||
@ -167,7 +167,7 @@ child_read_watch (GIOChannel *channel, GIOCondition cond, gpointer data)
|
||||
else
|
||||
{
|
||||
Socket *socket = create_socket ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), socket->box, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box), socket->box, TRUE, TRUE, 0);
|
||||
gtk_widget_show (socket->box);
|
||||
|
||||
gtk_socket_add_id (GTK_SOCKET (socket->socket), xid);
|
||||
@ -204,7 +204,7 @@ add_child (GtkWidget *window,
|
||||
if (active)
|
||||
{
|
||||
socket = create_socket ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), socket->box, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box), socket->box, TRUE, TRUE, 0);
|
||||
gtk_widget_show (socket->box);
|
||||
sprintf(buffer, "%#lx", (gulong) gtk_socket_get_id (GTK_SOCKET (socket->socket)));
|
||||
argv[1] = buffer;
|
||||
@ -248,7 +248,7 @@ add_local_active_child (GtkWidget *window)
|
||||
Socket *socket;
|
||||
|
||||
socket = create_socket ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), socket->box, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box), socket->box, TRUE, TRUE, 0);
|
||||
gtk_widget_show (socket->box);
|
||||
|
||||
create_child_plug (gtk_socket_get_id (GTK_SOCKET (socket->socket)), TRUE);
|
||||
@ -261,7 +261,7 @@ add_local_passive_child (GtkWidget *window)
|
||||
GdkNativeWindow xid;
|
||||
|
||||
socket = create_socket ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), socket->box, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box), socket->box, TRUE, TRUE, 0);
|
||||
gtk_widget_show (socket->box);
|
||||
|
||||
xid = create_child_plug (0, TRUE);
|
||||
@ -273,6 +273,7 @@ main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *button;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *entry;
|
||||
GtkAccelGroup *accel_group;
|
||||
GtkItemFactory *item_factory;
|
||||
@ -345,6 +346,11 @@ main (int argc, char *argv[])
|
||||
G_CALLBACK (steal),
|
||||
entry);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
box = hbox;
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
gtk_main ();
|
||||
|
@ -1,6 +1,25 @@
|
||||
#undef GTK_DISABLE_DEPRECATED
|
||||
|
||||
#include "x11/gdkx.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
print_hello (GtkWidget *w, gpointer data)
|
||||
{
|
||||
g_message (data);
|
||||
}
|
||||
|
||||
static GtkItemFactoryEntry menu_items[] = {
|
||||
{ "/_File", NULL, NULL, 0, "<Branch>" },
|
||||
{ "/File/_New", "<control>N", print_hello, GPOINTER_TO_INT("File New activated"), "<Item>" },
|
||||
{ "/File/_Open", "<control>O", print_hello, GPOINTER_TO_INT("File Open activated"), "<Item>" },
|
||||
{ "/File/sep1", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/File/Quit", "<control>Q", gtk_main_quit, 0, "<Item>" },
|
||||
{ "/O_K", "<control>K",print_hello, GPOINTER_TO_INT("OK activated"), "<Item>" },
|
||||
{ "/_Help", NULL, NULL, 0, "<LastBranch>" },
|
||||
{ "/_Help/About", NULL, print_hello, GPOINTER_TO_INT("Help About activated "), "<Item>" },
|
||||
};
|
||||
|
||||
static void
|
||||
remove_buttons (GtkWidget *widget, GtkWidget *other_button)
|
||||
{
|
||||
@ -72,15 +91,116 @@ add_buttons (GtkWidget *widget, GtkWidget *box)
|
||||
add_button);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_combo (void)
|
||||
{
|
||||
GList *cbitems;
|
||||
GtkCombo *combo;
|
||||
|
||||
cbitems = NULL;
|
||||
cbitems = g_list_append (cbitems, "item0");
|
||||
cbitems = g_list_append (cbitems, "item1 item1");
|
||||
cbitems = g_list_append (cbitems, "item2 item2 item2");
|
||||
cbitems = g_list_append (cbitems, "item3 item3 item3 item3");
|
||||
cbitems = g_list_append (cbitems, "item4 item4 item4 item4 item4");
|
||||
cbitems = g_list_append (cbitems, "item5 item5 item5 item5 item5 item5");
|
||||
cbitems = g_list_append (cbitems, "item6 item6 item6 item6 item6");
|
||||
cbitems = g_list_append (cbitems, "item7 item7 item7 item7");
|
||||
cbitems = g_list_append (cbitems, "item8 item8 item8");
|
||||
cbitems = g_list_append (cbitems, "item9 item9");
|
||||
|
||||
combo = GTK_COMBO (gtk_combo_new ());
|
||||
gtk_combo_set_popdown_strings (combo, cbitems);
|
||||
gtk_entry_set_text (GTK_ENTRY (combo->entry), "hello world");
|
||||
gtk_editable_select_region (GTK_EDITABLE (combo->entry), 0, -1);
|
||||
|
||||
return GTK_WIDGET (combo);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_menubar (GtkWindow *window)
|
||||
{
|
||||
GtkItemFactory *item_factory;
|
||||
GtkAccelGroup *accel_group=NULL;
|
||||
GtkWidget *menubar;
|
||||
|
||||
accel_group = gtk_accel_group_new ();
|
||||
item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>",
|
||||
accel_group);
|
||||
gtk_item_factory_create_items (item_factory,
|
||||
G_N_ELEMENTS (menu_items),
|
||||
menu_items, NULL);
|
||||
|
||||
gtk_window_add_accel_group (window, accel_group);
|
||||
menubar = gtk_item_factory_get_widget (item_factory, "<main>");
|
||||
|
||||
return menubar;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_combo_box (void)
|
||||
{
|
||||
GtkComboBox *combo_box = GTK_COMBO_BOX (gtk_combo_box_new_text ());
|
||||
|
||||
gtk_combo_box_append_text (combo_box, "This");
|
||||
gtk_combo_box_append_text (combo_box, "Is");
|
||||
gtk_combo_box_append_text (combo_box, "A");
|
||||
gtk_combo_box_append_text (combo_box, "ComboBox");
|
||||
|
||||
return GTK_WIDGET (combo_box);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_content (GtkWindow *window, gboolean local)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *button;
|
||||
GtkWidget *frame;
|
||||
|
||||
frame = gtk_frame_new (local? "Local" : "Remote");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 3);
|
||||
vbox = gtk_vbox_new (TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 3);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||
|
||||
/* Combo */
|
||||
gtk_box_pack_start (GTK_BOX (vbox), create_combo(), TRUE, TRUE, 0);
|
||||
|
||||
/* Entry */
|
||||
gtk_box_pack_start (GTK_BOX (vbox), gtk_entry_new(), TRUE, TRUE, 0);
|
||||
|
||||
/* Close Button */
|
||||
button = gtk_button_new_with_mnemonic ("_Close");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||
g_signal_connect_swapped (button, "clicked",
|
||||
G_CALLBACK (gtk_widget_destroy), window);
|
||||
|
||||
/* Blink Button */
|
||||
button = gtk_button_new_with_mnemonic ("_Blink");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (blink),
|
||||
window);
|
||||
|
||||
/* Menubar */
|
||||
gtk_box_pack_start (GTK_BOX (vbox), create_menubar (GTK_WINDOW (window)),
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
/* Combo Box */
|
||||
gtk_box_pack_start (GTK_BOX (vbox), create_combo_box (), TRUE, TRUE, 0);
|
||||
|
||||
add_buttons (NULL, vbox);
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
guint32
|
||||
create_child_plug (guint32 xid,
|
||||
gboolean local)
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *button;
|
||||
GtkWidget *label;
|
||||
GtkWidget *content;
|
||||
|
||||
window = gtk_plug_new (xid);
|
||||
|
||||
@ -90,30 +210,10 @@ create_child_plug (guint32 xid,
|
||||
NULL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), hbox);
|
||||
|
||||
label = gtk_label_new (local ? "Local:" : "Remote:");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
|
||||
content = create_content (GTK_WINDOW (window), local);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), content);
|
||||
|
||||
button = gtk_button_new_with_mnemonic ("_Close");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
|
||||
g_signal_connect_swapped (button, "clicked",
|
||||
G_CALLBACK (gtk_widget_destroy), window);
|
||||
|
||||
button = gtk_button_new_with_mnemonic ("_Blink");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (blink),
|
||||
window);
|
||||
|
||||
add_buttons (NULL, hbox);
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
if (GTK_WIDGET_REALIZED (window))
|
||||
|
Loading…
Reference in New Issue
Block a user