forked from AuroraMiddleware/gtk
API: remove gtk_window_set_visual()
gtk_widget_set_visual() exists now and can be used instead.
This reverts commit 59b227e123
.
This commit is contained in:
parent
bf81be51eb
commit
948768c708
@ -4963,7 +4963,6 @@ gtk_window_get_gravity
|
||||
gtk_window_set_position
|
||||
gtk_window_set_transient_for
|
||||
gtk_window_set_destroy_with_parent
|
||||
gtk_window_set_visual
|
||||
gtk_window_set_screen
|
||||
gtk_window_get_screen
|
||||
gtk_window_is_active
|
||||
|
@ -4468,7 +4468,6 @@ gtk_window_set_urgency_hint
|
||||
gtk_window_set_title
|
||||
gtk_window_set_transient_for
|
||||
gtk_window_set_type_hint
|
||||
gtk_window_set_visual
|
||||
gtk_window_set_wmclass
|
||||
gtk_window_stick
|
||||
gtk_window_unfullscreen
|
||||
|
131
gtk/gtkwindow.c
131
gtk/gtkwindow.c
@ -98,7 +98,7 @@ struct _GtkWindowPrivate
|
||||
GtkWindowGroup *group;
|
||||
|
||||
GdkModifierType mnemonic_modifier;
|
||||
GdkVisual *visual;
|
||||
GdkScreen *screen;
|
||||
GdkWindow *frame;
|
||||
GdkWindowTypeHint gdk_type_hint;
|
||||
|
||||
@ -189,7 +189,6 @@ enum {
|
||||
PROP_ICON,
|
||||
PROP_ICON_NAME,
|
||||
PROP_SCREEN,
|
||||
PROP_VISUAL,
|
||||
PROP_TYPE_HINT,
|
||||
PROP_SKIP_TASKBAR_HINT,
|
||||
PROP_SKIP_PAGER_HINT,
|
||||
@ -696,20 +695,6 @@ gtk_window_class_init (GtkWindowClass *klass)
|
||||
GDK_TYPE_SCREEN,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkWindow:visual:
|
||||
*
|
||||
* Specifies the visual used to create the window with. See gtk_window_set_visual()
|
||||
* for more details.
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_VISUAL,
|
||||
g_param_spec_object ("visual",
|
||||
P_("Visual"),
|
||||
P_("The visual this window is created from"),
|
||||
GDK_TYPE_VISUAL,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_IS_ACTIVE,
|
||||
g_param_spec_boolean ("is-active",
|
||||
@ -1018,7 +1003,7 @@ gtk_window_init (GtkWindow *window)
|
||||
priv->gravity = GDK_GRAVITY_NORTH_WEST;
|
||||
priv->decorated = TRUE;
|
||||
priv->mnemonic_modifier = GDK_MOD1_MASK;
|
||||
priv->visual = gdk_screen_get_system_visual (gdk_screen_get_default ());
|
||||
priv->screen = gdk_screen_get_default ();
|
||||
|
||||
priv->accept_focus = TRUE;
|
||||
priv->focus_on_map = TRUE;
|
||||
@ -1034,7 +1019,7 @@ gtk_window_init (GtkWindow *window)
|
||||
|
||||
gtk_decorated_window_init (window);
|
||||
|
||||
g_signal_connect (gdk_screen_get_default (), "composited-changed",
|
||||
g_signal_connect (priv->screen, "composited-changed",
|
||||
G_CALLBACK (gtk_window_on_composited_changed), window);
|
||||
}
|
||||
|
||||
@ -1094,9 +1079,6 @@ gtk_window_set_property (GObject *object,
|
||||
case PROP_SCREEN:
|
||||
gtk_window_set_screen (window, g_value_get_object (value));
|
||||
break;
|
||||
case PROP_VISUAL:
|
||||
gtk_window_set_visual (window, g_value_get_object (value));
|
||||
break;
|
||||
case PROP_TYPE_HINT:
|
||||
gtk_window_set_type_hint (window,
|
||||
g_value_get_enum (value));
|
||||
@ -1199,10 +1181,7 @@ gtk_window_get_property (GObject *object,
|
||||
g_value_set_string (value, gtk_window_get_icon_name (window));
|
||||
break;
|
||||
case PROP_SCREEN:
|
||||
g_value_set_object (value, gdk_visual_get_screen (priv->visual));
|
||||
break;
|
||||
case PROP_VISUAL:
|
||||
g_value_set_object (value, priv->visual);
|
||||
g_value_set_object (value, priv->screen);
|
||||
break;
|
||||
case PROP_IS_ACTIVE:
|
||||
g_value_set_boolean (value, priv->is_active);
|
||||
@ -2322,7 +2301,7 @@ gtk_window_transient_parent_screen_changed (GtkWindow *parent,
|
||||
GParamSpec *pspec,
|
||||
GtkWindow *window)
|
||||
{
|
||||
gtk_window_set_screen (window, gtk_window_get_screen (parent));
|
||||
gtk_window_set_screen (window, parent->priv->screen);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2416,8 +2395,8 @@ gtk_window_set_transient_for (GtkWindow *window,
|
||||
g_signal_connect (parent, "notify::screen",
|
||||
G_CALLBACK (gtk_window_transient_parent_screen_changed),
|
||||
window);
|
||||
|
||||
gtk_window_set_screen (window, gtk_window_get_screen (parent));
|
||||
|
||||
gtk_window_set_screen (window, parent->priv->screen);
|
||||
|
||||
if (priv->destroy_with_parent)
|
||||
connect_parent_destroyed (window);
|
||||
@ -4365,8 +4344,8 @@ gtk_window_finalize (GObject *object)
|
||||
priv->keys_changed_handler = 0;
|
||||
}
|
||||
|
||||
if (priv->visual)
|
||||
g_signal_handlers_disconnect_by_func (gdk_visual_get_screen (priv->visual),
|
||||
if (priv->screen)
|
||||
g_signal_handlers_disconnect_by_func (priv->screen,
|
||||
gtk_window_on_composited_changed, window);
|
||||
|
||||
g_free (priv->startup_id);
|
||||
@ -7507,62 +7486,48 @@ gtk_window_begin_move_drag (GtkWindow *window,
|
||||
timestamp);
|
||||
}
|
||||
|
||||
GdkVisual *
|
||||
_gtk_window_get_visual (GtkWindow *window)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_WINDOW (window), NULL);
|
||||
|
||||
return window->priv->visual;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_window_set_visual:
|
||||
* @window: window to set the visual from
|
||||
* @visual: the new visual to use
|
||||
/**
|
||||
* gtk_window_set_screen:
|
||||
* @window: a #GtkWindow.
|
||||
* @screen: a #GdkScreen.
|
||||
*
|
||||
* Sets the #GdkVisual used to display @window; if the window
|
||||
* is already mapped, it will be unmapped, and then remapped
|
||||
* with the new visual. It is fine if @visual is on a
|
||||
* different #GdkScreen.
|
||||
* Sets the #GdkScreen where the @window is displayed; if
|
||||
* the window is already mapped, it will be unmapped, and
|
||||
* then remapped on the new screen.
|
||||
*
|
||||
* By default, a window's visual is set to the system visual
|
||||
* of the default screen.
|
||||
**/
|
||||
* Since: 2.2
|
||||
*/
|
||||
void
|
||||
gtk_window_set_visual (GtkWindow *window,
|
||||
GdkVisual *visual)
|
||||
gtk_window_set_screen (GtkWindow *window,
|
||||
GdkScreen *screen)
|
||||
{
|
||||
GtkWindowPrivate *priv;
|
||||
GtkWidget *widget;
|
||||
GdkVisual *previous_visual;
|
||||
GdkScreen *previous_screen, *screen;
|
||||
GdkScreen *previous_screen;
|
||||
gboolean was_mapped;
|
||||
|
||||
g_return_if_fail (GTK_IS_WINDOW (window));
|
||||
g_return_if_fail (GDK_IS_VISUAL (visual));
|
||||
g_return_if_fail (GDK_IS_SCREEN (screen));
|
||||
|
||||
priv = window->priv;
|
||||
|
||||
if (priv->visual == visual)
|
||||
if (screen == priv->screen)
|
||||
return;
|
||||
|
||||
widget = GTK_WIDGET (window);
|
||||
|
||||
previous_visual = priv->visual;
|
||||
previous_screen = gdk_visual_get_screen (previous_visual);
|
||||
screen = gdk_visual_get_screen (visual);
|
||||
previous_screen = priv->screen;
|
||||
was_mapped = gtk_widget_get_mapped (widget);
|
||||
|
||||
if (was_mapped)
|
||||
gtk_widget_unmap (widget);
|
||||
if (gtk_widget_get_realized (widget))
|
||||
gtk_widget_unrealize (widget);
|
||||
g_object_freeze_notify (G_OBJECT (window));
|
||||
|
||||
|
||||
gtk_window_free_key_hash (window);
|
||||
priv->visual = visual;
|
||||
priv->screen = screen;
|
||||
gtk_widget_reset_rc_styles (widget);
|
||||
if (previous_screen != screen)
|
||||
if (screen != previous_screen)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (previous_screen,
|
||||
gtk_window_on_composited_changed, window);
|
||||
@ -7571,47 +7536,13 @@ gtk_window_set_visual (GtkWindow *window,
|
||||
|
||||
_gtk_widget_propagate_screen_changed (widget, previous_screen);
|
||||
_gtk_widget_propagate_composited_changed (widget);
|
||||
g_object_notify (G_OBJECT (window), "screen");
|
||||
}
|
||||
g_object_notify (G_OBJECT (window), "visual");
|
||||
g_object_notify (G_OBJECT (window), "screen");
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (window));
|
||||
if (was_mapped)
|
||||
gtk_widget_map (widget);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_window_set_screen:
|
||||
* @window: a #GtkWindow.
|
||||
* @screen: a #GdkScreen.
|
||||
*
|
||||
* Sets the #GdkScreen where the @window is displayed. If
|
||||
* the @screen is equal to @window's current screen, this
|
||||
* function does nothing. If it is not and the window is
|
||||
* already mapped, it will be unmapped, and then remapped
|
||||
* on the new screen.
|
||||
*
|
||||
* This function resets @window's visual to the system
|
||||
* visual of the given @screen. If you want to use a
|
||||
* different visual, consider using gtk_window_set_visual()
|
||||
* instead.
|
||||
*
|
||||
* Since: 2.2
|
||||
*/
|
||||
void
|
||||
gtk_window_set_screen (GtkWindow *window,
|
||||
GdkScreen *screen)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_WINDOW (window));
|
||||
g_return_if_fail (GDK_IS_SCREEN (screen));
|
||||
|
||||
if (screen == gdk_visual_get_screen (window->priv->visual))
|
||||
return;
|
||||
|
||||
gtk_window_set_visual (window,
|
||||
gdk_screen_get_system_visual (screen));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_window_on_composited_changed (GdkScreen *screen,
|
||||
GtkWindow *window)
|
||||
@ -7626,8 +7557,8 @@ gtk_window_check_screen (GtkWindow *window)
|
||||
{
|
||||
GtkWindowPrivate *priv = window->priv;
|
||||
|
||||
if (priv->visual)
|
||||
return gdk_visual_get_screen (priv->visual);
|
||||
if (priv->screen)
|
||||
return priv->screen;
|
||||
else
|
||||
{
|
||||
g_warning ("Screen for GtkWindow not set; you must always set\n"
|
||||
@ -7651,7 +7582,7 @@ gtk_window_get_screen (GtkWindow *window)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_WINDOW (window), NULL);
|
||||
|
||||
return gdk_visual_get_screen (window->priv->visual);
|
||||
return window->priv->screen;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -191,8 +191,6 @@ void gtk_window_set_geometry_hints (GtkWindow *window,
|
||||
void gtk_window_set_screen (GtkWindow *window,
|
||||
GdkScreen *screen);
|
||||
GdkScreen* gtk_window_get_screen (GtkWindow *window);
|
||||
void gtk_window_set_visual (GtkWindow *window,
|
||||
GdkVisual *visual);
|
||||
|
||||
gboolean gtk_window_is_active (GtkWindow *window);
|
||||
gboolean gtk_window_has_toplevel_focus (GtkWindow *window);
|
||||
@ -382,7 +380,6 @@ void _gtk_window_set_is_toplevel (GtkWindow *window,
|
||||
void _gtk_window_get_wmclass (GtkWindow *window,
|
||||
gchar **wmclass_name,
|
||||
gchar **wmclass_class);
|
||||
GdkVisual * _gtk_window_get_visual (GtkWindow *window);
|
||||
|
||||
typedef void (*GtkWindowKeysForeachFunc) (GtkWindow *window,
|
||||
guint keyval,
|
||||
|
Loading…
Reference in New Issue
Block a user