Make it work, even if the window is already realized or mapped.

Tue Apr 30 18:42:25 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkwindow.c (gtk_window_set_screen): Make it
        work, even if the window is already realized or
        mapped.

        * tests/testgtk.c: Erwann's multihead changes, slightly
        dumbed down. (Removed logic for pulling windows onto
        the current screen, people can click twice on the demo
        to destroy and create again.)

        * tests/prop-editor.c: Set the screen on the property
        editor if the edited object is a widget.
This commit is contained in:
Owen Taylor 2002-04-30 23:44:14 +00:00 committed by Owen Taylor
parent 6aa88ee1f4
commit 087fd22c50
10 changed files with 648 additions and 220 deletions

View File

@ -56,7 +56,6 @@ Tue Apr 30 14:15:14 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes. * gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes.
>>>>>>> 1.3389
2002-04-30 Erwann Chenede - <erwann.chenede@sun.com> 2002-04-30 Erwann Chenede - <erwann.chenede@sun.com>
* gdk/x11/gdkimage-x11.c : rationalized multihead code * gdk/x11/gdkimage-x11.c : rationalized multihead code

View File

@ -56,7 +56,6 @@ Tue Apr 30 14:15:14 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes. * gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes.
>>>>>>> 1.3389
2002-04-30 Erwann Chenede - <erwann.chenede@sun.com> 2002-04-30 Erwann Chenede - <erwann.chenede@sun.com>
* gdk/x11/gdkimage-x11.c : rationalized multihead code * gdk/x11/gdkimage-x11.c : rationalized multihead code

View File

@ -56,7 +56,6 @@ Tue Apr 30 14:15:14 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes. * gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes.
>>>>>>> 1.3389
2002-04-30 Erwann Chenede - <erwann.chenede@sun.com> 2002-04-30 Erwann Chenede - <erwann.chenede@sun.com>
* gdk/x11/gdkimage-x11.c : rationalized multihead code * gdk/x11/gdkimage-x11.c : rationalized multihead code

View File

@ -56,7 +56,6 @@ Tue Apr 30 14:15:14 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes. * gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes.
>>>>>>> 1.3389
2002-04-30 Erwann Chenede - <erwann.chenede@sun.com> 2002-04-30 Erwann Chenede - <erwann.chenede@sun.com>
* gdk/x11/gdkimage-x11.c : rationalized multihead code * gdk/x11/gdkimage-x11.c : rationalized multihead code

View File

@ -56,7 +56,6 @@ Tue Apr 30 14:15:14 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes. * gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes.
>>>>>>> 1.3389
2002-04-30 Erwann Chenede - <erwann.chenede@sun.com> 2002-04-30 Erwann Chenede - <erwann.chenede@sun.com>
* gdk/x11/gdkimage-x11.c : rationalized multihead code * gdk/x11/gdkimage-x11.c : rationalized multihead code

View File

@ -56,7 +56,6 @@ Tue Apr 30 14:15:14 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes. * gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes.
>>>>>>> 1.3389
2002-04-30 Erwann Chenede - <erwann.chenede@sun.com> 2002-04-30 Erwann Chenede - <erwann.chenede@sun.com>
* gdk/x11/gdkimage-x11.c : rationalized multihead code * gdk/x11/gdkimage-x11.c : rationalized multihead code

View File

@ -5386,26 +5386,41 @@ gtk_window_begin_move_drag (GtkWindow *window,
* @window: a #GtkWindow. * @window: a #GtkWindow.
* @screen: a #GtkScreen. * @screen: a #GtkScreen.
* *
* Sets the #GdkScreen where the @window will be displayed. * Sets the #GdkScreen where the @window is displayed; if
* This function has to be called before the @window * the window is already mapped, it will be unmapped, and
* object is realized otherwise it will fail. * then remapped on the new screen.
*/ */
void void
gtk_window_set_screen (GtkWindow *window, gtk_window_set_screen (GtkWindow *window,
GdkScreen *screen) GdkScreen *screen)
{ {
GtkWidget *widget;
gboolean was_mapped;
g_return_if_fail (GTK_IS_WINDOW (window)); g_return_if_fail (GTK_IS_WINDOW (window));
g_return_if_fail (GDK_IS_SCREEN (screen)); g_return_if_fail (GDK_IS_SCREEN (screen));
if (GTK_WIDGET_REALIZED (window)) if (screen == window->screen)
{ return;
g_warning ("Trying to change the window's screen while widget is visible");
return; widget = GTK_WIDGET (window);
}
was_mapped = GTK_WIDGET_MAPPED (widget);
if (was_mapped)
gtk_widget_unmap (widget);
if (GTK_WIDGET_REALIZED (widget))
gtk_widget_unrealize (widget);
gtk_window_free_key_hash (window); gtk_window_free_key_hash (window);
window->screen = screen; window->screen = screen;
gtk_widget_reset_rc_styles (widget);
g_object_notify (G_OBJECT (window), "screen");
if (was_mapped)
gtk_widget_map (widget);
} }
/** /**
* gtk_window_get_screen: * gtk_window_get_screen:
* @window: a #GtkWindow. * @window: a #GtkWindow.

View File

@ -735,7 +735,8 @@ properties_from_type (GObject *object,
/* Pass zero for type if you want all properties */ /* Pass zero for type if you want all properties */
GtkWidget* GtkWidget*
create_prop_editor (GObject *object, GType type) create_prop_editor (GObject *object,
GType type)
{ {
GtkWidget *win; GtkWidget *win;
GtkWidget *notebook; GtkWidget *notebook;
@ -751,7 +752,10 @@ create_prop_editor (GObject *object, GType type)
} }
win = gtk_window_new (GTK_WINDOW_TOPLEVEL); win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
if (GTK_IS_WIDGET (object))
gtk_window_set_screen (GTK_WINDOW (win),
gtk_widget_get_screen (GTK_WIDGET (object)));
tips = gtk_tooltips_new (); tips = gtk_tooltips_new ();
gtk_signal_connect_object (GTK_OBJECT (win), "destroy", gtk_signal_connect_object (GTK_OBJECT (win), "destroy",
GTK_SIGNAL_FUNC (gtk_object_destroy), GTK_OBJECT (tips)); GTK_SIGNAL_FUNC (gtk_object_destroy), GTK_OBJECT (tips));

View File

@ -23,8 +23,8 @@
G_BEGIN_DECLS G_BEGIN_DECLS
GtkWidget *create_prop_editor (GObject *object, GtkWidget *create_prop_editor (GObject *object,
GType type); GType type);
G_END_DECLS G_END_DECLS

File diff suppressed because it is too large Load Diff