mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-24 12:41:16 +00:00
New demo for window migration between different displays and screens.
Thu Aug 1 19:09:39 2002 Owen Taylor <otaylor@redhat.com> * demos/gtk-demo/changedisplay.c: New demo for window migration between different displays and screens. * gtk/gtkrc.c gtkstyle.[ch]: Add _gtk_style_init_for_settings(), so that gtkrc.c can initialize the styles it creates for the right display. * gdk/gdkdisplaymanager.c (gdk_screen_get_default) * gtk/gtksettings.c (gtk_settings_get_default) * gtk/gtkstyle.c (gtk_style_init): Handle absence of a default screen. * gdk/x11/gdkmain-x11.c (_gdk_windowing_set_default_display): Handle display == NULL.x * gdk/gdkdisplay.c (gdk_display_dispose): Free the event queue. * gdk/x11/gdkevents-x11.c gdk/x11/gdkdisplay-x11.c: Remove the event source when closing a display. * gdk/gdkdisplay.[ch]: Add a ::closed signal, dispose() isn't convenient enough by itself. * gdk/x11/gdkevents-x11.c (gdk_xsettings_watch_cb): Create foreign windows for watch windows if there isn't an existing window, instead of installing a global filter. * gdk/x11/gdkscreen-x11.c gdk/x11/gdkprivate-x11.h gdk/x11/gdkevents-x11.c (_gdk_x11_events_uninit_screen): Clean up the xsettings_client when we are done with it. * gdk/x11/gdkevents-x11.c (_gdk_events_init): Remove excess call to _gdk_x11_events_init_screen()
This commit is contained in:
parent
615deb3e4a
commit
63489392e6
39
ChangeLog
39
ChangeLog
@ -1,3 +1,42 @@
|
||||
Thu Aug 1 19:09:39 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* demos/gtk-demo/changedisplay.c: New demo for
|
||||
window migration between different displays and screens.
|
||||
|
||||
* gtk/gtkrc.c gtkstyle.[ch]: Add
|
||||
_gtk_style_init_for_settings(), so that gtkrc.c
|
||||
can initialize the styles it creates for the
|
||||
right display.
|
||||
|
||||
* gdk/gdkdisplaymanager.c (gdk_screen_get_default)
|
||||
* gtk/gtksettings.c (gtk_settings_get_default)
|
||||
* gtk/gtkstyle.c (gtk_style_init): Handle absence of
|
||||
a default screen.
|
||||
|
||||
* gdk/x11/gdkmain-x11.c (_gdk_windowing_set_default_display):
|
||||
Handle display == NULL.x
|
||||
|
||||
* gdk/gdkdisplay.c (gdk_display_dispose): Free the
|
||||
event queue.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c gdk/x11/gdkdisplay-x11.c:
|
||||
Remove the event source when closing a display.
|
||||
|
||||
* gdk/gdkdisplay.[ch]: Add a ::closed signal, dispose()
|
||||
isn't convenient enough by itself.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c (gdk_xsettings_watch_cb):
|
||||
Create foreign windows for watch windows if there isn't
|
||||
an existing window, instead of installing a global filter.
|
||||
|
||||
* gdk/x11/gdkscreen-x11.c gdk/x11/gdkprivate-x11.h
|
||||
gdk/x11/gdkevents-x11.c (_gdk_x11_events_uninit_screen):
|
||||
Clean up the xsettings_client when we are done with
|
||||
it.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c (_gdk_events_init): Remove
|
||||
excess call to _gdk_x11_events_init_screen()
|
||||
|
||||
2002-08-01 Sven Neumann <sven@gimp.org>
|
||||
|
||||
Merge from stable:
|
||||
|
@ -1,3 +1,42 @@
|
||||
Thu Aug 1 19:09:39 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* demos/gtk-demo/changedisplay.c: New demo for
|
||||
window migration between different displays and screens.
|
||||
|
||||
* gtk/gtkrc.c gtkstyle.[ch]: Add
|
||||
_gtk_style_init_for_settings(), so that gtkrc.c
|
||||
can initialize the styles it creates for the
|
||||
right display.
|
||||
|
||||
* gdk/gdkdisplaymanager.c (gdk_screen_get_default)
|
||||
* gtk/gtksettings.c (gtk_settings_get_default)
|
||||
* gtk/gtkstyle.c (gtk_style_init): Handle absence of
|
||||
a default screen.
|
||||
|
||||
* gdk/x11/gdkmain-x11.c (_gdk_windowing_set_default_display):
|
||||
Handle display == NULL.x
|
||||
|
||||
* gdk/gdkdisplay.c (gdk_display_dispose): Free the
|
||||
event queue.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c gdk/x11/gdkdisplay-x11.c:
|
||||
Remove the event source when closing a display.
|
||||
|
||||
* gdk/gdkdisplay.[ch]: Add a ::closed signal, dispose()
|
||||
isn't convenient enough by itself.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c (gdk_xsettings_watch_cb):
|
||||
Create foreign windows for watch windows if there isn't
|
||||
an existing window, instead of installing a global filter.
|
||||
|
||||
* gdk/x11/gdkscreen-x11.c gdk/x11/gdkprivate-x11.h
|
||||
gdk/x11/gdkevents-x11.c (_gdk_x11_events_uninit_screen):
|
||||
Clean up the xsettings_client when we are done with
|
||||
it.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c (_gdk_events_init): Remove
|
||||
excess call to _gdk_x11_events_init_screen()
|
||||
|
||||
2002-08-01 Sven Neumann <sven@gimp.org>
|
||||
|
||||
Merge from stable:
|
||||
|
@ -1,3 +1,42 @@
|
||||
Thu Aug 1 19:09:39 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* demos/gtk-demo/changedisplay.c: New demo for
|
||||
window migration between different displays and screens.
|
||||
|
||||
* gtk/gtkrc.c gtkstyle.[ch]: Add
|
||||
_gtk_style_init_for_settings(), so that gtkrc.c
|
||||
can initialize the styles it creates for the
|
||||
right display.
|
||||
|
||||
* gdk/gdkdisplaymanager.c (gdk_screen_get_default)
|
||||
* gtk/gtksettings.c (gtk_settings_get_default)
|
||||
* gtk/gtkstyle.c (gtk_style_init): Handle absence of
|
||||
a default screen.
|
||||
|
||||
* gdk/x11/gdkmain-x11.c (_gdk_windowing_set_default_display):
|
||||
Handle display == NULL.x
|
||||
|
||||
* gdk/gdkdisplay.c (gdk_display_dispose): Free the
|
||||
event queue.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c gdk/x11/gdkdisplay-x11.c:
|
||||
Remove the event source when closing a display.
|
||||
|
||||
* gdk/gdkdisplay.[ch]: Add a ::closed signal, dispose()
|
||||
isn't convenient enough by itself.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c (gdk_xsettings_watch_cb):
|
||||
Create foreign windows for watch windows if there isn't
|
||||
an existing window, instead of installing a global filter.
|
||||
|
||||
* gdk/x11/gdkscreen-x11.c gdk/x11/gdkprivate-x11.h
|
||||
gdk/x11/gdkevents-x11.c (_gdk_x11_events_uninit_screen):
|
||||
Clean up the xsettings_client when we are done with
|
||||
it.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c (_gdk_events_init): Remove
|
||||
excess call to _gdk_x11_events_init_screen()
|
||||
|
||||
2002-08-01 Sven Neumann <sven@gimp.org>
|
||||
|
||||
Merge from stable:
|
||||
|
@ -1,3 +1,42 @@
|
||||
Thu Aug 1 19:09:39 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* demos/gtk-demo/changedisplay.c: New demo for
|
||||
window migration between different displays and screens.
|
||||
|
||||
* gtk/gtkrc.c gtkstyle.[ch]: Add
|
||||
_gtk_style_init_for_settings(), so that gtkrc.c
|
||||
can initialize the styles it creates for the
|
||||
right display.
|
||||
|
||||
* gdk/gdkdisplaymanager.c (gdk_screen_get_default)
|
||||
* gtk/gtksettings.c (gtk_settings_get_default)
|
||||
* gtk/gtkstyle.c (gtk_style_init): Handle absence of
|
||||
a default screen.
|
||||
|
||||
* gdk/x11/gdkmain-x11.c (_gdk_windowing_set_default_display):
|
||||
Handle display == NULL.x
|
||||
|
||||
* gdk/gdkdisplay.c (gdk_display_dispose): Free the
|
||||
event queue.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c gdk/x11/gdkdisplay-x11.c:
|
||||
Remove the event source when closing a display.
|
||||
|
||||
* gdk/gdkdisplay.[ch]: Add a ::closed signal, dispose()
|
||||
isn't convenient enough by itself.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c (gdk_xsettings_watch_cb):
|
||||
Create foreign windows for watch windows if there isn't
|
||||
an existing window, instead of installing a global filter.
|
||||
|
||||
* gdk/x11/gdkscreen-x11.c gdk/x11/gdkprivate-x11.h
|
||||
gdk/x11/gdkevents-x11.c (_gdk_x11_events_uninit_screen):
|
||||
Clean up the xsettings_client when we are done with
|
||||
it.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c (_gdk_events_init): Remove
|
||||
excess call to _gdk_x11_events_init_screen()
|
||||
|
||||
2002-08-01 Sven Neumann <sven@gimp.org>
|
||||
|
||||
Merge from stable:
|
||||
|
@ -1,3 +1,42 @@
|
||||
Thu Aug 1 19:09:39 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* demos/gtk-demo/changedisplay.c: New demo for
|
||||
window migration between different displays and screens.
|
||||
|
||||
* gtk/gtkrc.c gtkstyle.[ch]: Add
|
||||
_gtk_style_init_for_settings(), so that gtkrc.c
|
||||
can initialize the styles it creates for the
|
||||
right display.
|
||||
|
||||
* gdk/gdkdisplaymanager.c (gdk_screen_get_default)
|
||||
* gtk/gtksettings.c (gtk_settings_get_default)
|
||||
* gtk/gtkstyle.c (gtk_style_init): Handle absence of
|
||||
a default screen.
|
||||
|
||||
* gdk/x11/gdkmain-x11.c (_gdk_windowing_set_default_display):
|
||||
Handle display == NULL.x
|
||||
|
||||
* gdk/gdkdisplay.c (gdk_display_dispose): Free the
|
||||
event queue.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c gdk/x11/gdkdisplay-x11.c:
|
||||
Remove the event source when closing a display.
|
||||
|
||||
* gdk/gdkdisplay.[ch]: Add a ::closed signal, dispose()
|
||||
isn't convenient enough by itself.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c (gdk_xsettings_watch_cb):
|
||||
Create foreign windows for watch windows if there isn't
|
||||
an existing window, instead of installing a global filter.
|
||||
|
||||
* gdk/x11/gdkscreen-x11.c gdk/x11/gdkprivate-x11.h
|
||||
gdk/x11/gdkevents-x11.c (_gdk_x11_events_uninit_screen):
|
||||
Clean up the xsettings_client when we are done with
|
||||
it.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c (_gdk_events_init): Remove
|
||||
excess call to _gdk_x11_events_init_screen()
|
||||
|
||||
2002-08-01 Sven Neumann <sven@gimp.org>
|
||||
|
||||
Merge from stable:
|
||||
|
@ -1,3 +1,42 @@
|
||||
Thu Aug 1 19:09:39 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* demos/gtk-demo/changedisplay.c: New demo for
|
||||
window migration between different displays and screens.
|
||||
|
||||
* gtk/gtkrc.c gtkstyle.[ch]: Add
|
||||
_gtk_style_init_for_settings(), so that gtkrc.c
|
||||
can initialize the styles it creates for the
|
||||
right display.
|
||||
|
||||
* gdk/gdkdisplaymanager.c (gdk_screen_get_default)
|
||||
* gtk/gtksettings.c (gtk_settings_get_default)
|
||||
* gtk/gtkstyle.c (gtk_style_init): Handle absence of
|
||||
a default screen.
|
||||
|
||||
* gdk/x11/gdkmain-x11.c (_gdk_windowing_set_default_display):
|
||||
Handle display == NULL.x
|
||||
|
||||
* gdk/gdkdisplay.c (gdk_display_dispose): Free the
|
||||
event queue.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c gdk/x11/gdkdisplay-x11.c:
|
||||
Remove the event source when closing a display.
|
||||
|
||||
* gdk/gdkdisplay.[ch]: Add a ::closed signal, dispose()
|
||||
isn't convenient enough by itself.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c (gdk_xsettings_watch_cb):
|
||||
Create foreign windows for watch windows if there isn't
|
||||
an existing window, instead of installing a global filter.
|
||||
|
||||
* gdk/x11/gdkscreen-x11.c gdk/x11/gdkprivate-x11.h
|
||||
gdk/x11/gdkevents-x11.c (_gdk_x11_events_uninit_screen):
|
||||
Clean up the xsettings_client when we are done with
|
||||
it.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c (_gdk_events_init): Remove
|
||||
excess call to _gdk_x11_events_init_screen()
|
||||
|
||||
2002-08-01 Sven Neumann <sven@gimp.org>
|
||||
|
||||
Merge from stable:
|
||||
|
@ -7,6 +7,7 @@ democodedir=$(datadir)/gtk-2.0/demo
|
||||
demos = @STRIP_BEGIN@ \
|
||||
appwindow.c \
|
||||
button_box.c \
|
||||
changedisplay.c \
|
||||
colorsel.c \
|
||||
dialog.c \
|
||||
drawingarea.c \
|
||||
|
@ -25,13 +25,21 @@
|
||||
#include "gdk.h" /* gdk_event_send_client_message() */
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkmarshalers.h"
|
||||
#include "gdkscreen.h"
|
||||
|
||||
enum {
|
||||
CLOSED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static void gdk_display_class_init (GdkDisplayClass *class);
|
||||
static void gdk_display_init (GdkDisplay *display);
|
||||
static void gdk_display_dispose (GObject *object);
|
||||
static void gdk_display_finalize (GObject *object);
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
static GObjectClass *parent_class;
|
||||
|
||||
GType
|
||||
@ -69,6 +77,17 @@ gdk_display_class_init (GdkDisplayClass *class)
|
||||
|
||||
object_class->finalize = gdk_display_finalize;
|
||||
object_class->dispose = gdk_display_dispose;
|
||||
|
||||
signals[CLOSED] =
|
||||
g_signal_new ("closed",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GdkDisplayClass, closed),
|
||||
NULL, NULL,
|
||||
gdk_marshal_VOID__BOOLEAN,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
G_TYPE_BOOLEAN);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -87,6 +106,16 @@ static void
|
||||
gdk_display_dispose (GObject *object)
|
||||
{
|
||||
GdkDisplay *display = GDK_DISPLAY_OBJECT (object);
|
||||
|
||||
g_list_foreach (display->queued_events, (GFunc)gdk_event_free, NULL);
|
||||
g_list_free (display->queued_events);
|
||||
display->queued_events = NULL;
|
||||
display->queued_tail = NULL;
|
||||
|
||||
_gdk_displays = g_slist_remove (_gdk_displays, object);
|
||||
|
||||
if (gdk_display_get_default() == display)
|
||||
gdk_display_manager_set_default_display (gdk_display_manager_get(), NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -94,12 +123,6 @@ gdk_display_finalize (GObject *object)
|
||||
{
|
||||
GdkDisplay *display = GDK_DISPLAY_OBJECT (object);
|
||||
|
||||
_gdk_displays = g_slist_remove (_gdk_displays, display);
|
||||
|
||||
if (gdk_display_get_default() == display)
|
||||
gdk_display_manager_set_default_display (gdk_display_manager_get(),
|
||||
NULL);
|
||||
|
||||
parent_class->finalize (object);
|
||||
}
|
||||
|
||||
@ -118,7 +141,8 @@ gdk_display_close (GdkDisplay *display)
|
||||
if (!display->closed)
|
||||
{
|
||||
display->closed = TRUE;
|
||||
|
||||
|
||||
g_signal_emit (display, signals[CLOSED], 0, FALSE);
|
||||
g_object_run_dispose (G_OBJECT (display));
|
||||
|
||||
g_object_unref (G_OBJECT (display));
|
||||
|
@ -70,6 +70,11 @@ struct _GdkDisplayClass
|
||||
GdkScreen * (*get_screen) (GdkDisplay *display,
|
||||
gint screen_num);
|
||||
GdkScreen * (*get_default_screen) (GdkDisplay *display);
|
||||
|
||||
|
||||
/* Signals */
|
||||
void (*closed) (GdkDisplay *class,
|
||||
gboolean is_error);
|
||||
};
|
||||
|
||||
GType gdk_display_get_type (void);
|
||||
|
@ -214,12 +214,15 @@ gdk_display_get_default (void)
|
||||
* Gets the default screen for the default display. (See
|
||||
* gdk_display_get_default ()).
|
||||
*
|
||||
* Returns: a #GdkScreen.
|
||||
* Returns: a #GdkScreen, or %NULL if there is no default display.
|
||||
*/
|
||||
GdkScreen *
|
||||
gdk_screen_get_default (void)
|
||||
{
|
||||
return gdk_display_get_default_screen (default_display);
|
||||
if (default_display)
|
||||
return gdk_display_get_default_screen (default_display);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1 +1,2 @@
|
||||
VOID:OBJECT
|
||||
VOID:BOOLEAN
|
||||
|
@ -132,6 +132,12 @@ gdk_display_open (const gchar *display_name)
|
||||
for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
|
||||
display_x11->screens[i] = _gdk_x11_screen_new (display, i);
|
||||
|
||||
/* We need to initialize events after we have the screen
|
||||
* structures in places
|
||||
*/
|
||||
for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
|
||||
_gdk_x11_events_init_screen (display_x11->screens[i]);
|
||||
|
||||
/*set the default screen */
|
||||
display_x11->default_screen = display_x11->screens[DefaultScreen (display_x11->xdisplay)];
|
||||
display_x11->leader_window = XCreateSimpleWindow (display_x11->xdisplay,
|
||||
@ -488,11 +494,13 @@ gdk_display_x11_dispose (GObject *object)
|
||||
GdkDisplayX11 *display_x11;
|
||||
gint i;
|
||||
|
||||
display_x11 = GDK_DISPLAY_X11 (object);;
|
||||
display_x11 = GDK_DISPLAY_X11 (object);
|
||||
|
||||
for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
|
||||
_gdk_screen_close (display_x11->screens[i]);
|
||||
|
||||
g_source_destroy (display_x11->event_source);
|
||||
|
||||
XCloseDisplay (display_x11->xdisplay);
|
||||
display_x11->xdisplay = NULL;
|
||||
|
||||
|
@ -58,6 +58,8 @@ struct _GdkDisplayX11
|
||||
GdkScreen *default_screen;
|
||||
GdkScreen **screens;
|
||||
|
||||
GSource *event_source;
|
||||
|
||||
gint grab_count;
|
||||
|
||||
/* Keyboard related information */
|
||||
|
@ -169,6 +169,15 @@ _gdk_x11_events_init_screen (GdkScreen *screen)
|
||||
screen);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_x11_events_uninit_screen (GdkScreen *screen)
|
||||
{
|
||||
GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen);
|
||||
|
||||
xsettings_client_destroy (screen_x11->xsettings_client);
|
||||
screen_x11->xsettings_client = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_events_init (GdkDisplay *display)
|
||||
{
|
||||
@ -180,7 +189,7 @@ _gdk_events_init (GdkDisplay *display)
|
||||
GDK_NOTE (MISC, g_message ("connection number: %d", connection_number));
|
||||
|
||||
|
||||
source = gdk_display_source_new (display);
|
||||
source = display_x11->event_source = gdk_display_source_new (display);
|
||||
display_source = (GdkDisplaySource*) source;
|
||||
g_source_set_priority (source, GDK_PRIORITY_EVENTS);
|
||||
|
||||
@ -198,8 +207,6 @@ _gdk_events_init (GdkDisplay *display)
|
||||
gdk_atom_intern ("WM_PROTOCOLS", FALSE),
|
||||
gdk_wm_protocols_filter,
|
||||
NULL);
|
||||
|
||||
_gdk_x11_events_init_screen (display_x11->default_screen);
|
||||
}
|
||||
|
||||
|
||||
@ -2371,17 +2378,29 @@ gdk_xsettings_client_event_filter (GdkXEvent *xevent,
|
||||
|
||||
static void
|
||||
gdk_xsettings_watch_cb (Window window,
|
||||
Bool is_start,
|
||||
long mask,
|
||||
void *cb_data)
|
||||
Bool is_start,
|
||||
long mask,
|
||||
void *cb_data)
|
||||
{
|
||||
GdkWindow *gdkwin;
|
||||
GdkScreen *screen = cb_data;
|
||||
GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen);
|
||||
|
||||
gdkwin = gdk_window_lookup_for_display (gdk_screen_get_display (screen), window);
|
||||
|
||||
|
||||
if (is_start)
|
||||
gdk_window_add_filter (gdkwin, gdk_xsettings_client_event_filter, screen);
|
||||
{
|
||||
if (!gdkwin)
|
||||
gdkwin = gdk_window_foreign_new_for_display (gdk_screen_get_display (screen), window);
|
||||
else
|
||||
g_object_ref (gdkwin);
|
||||
|
||||
gdk_window_add_filter (gdkwin, gdk_xsettings_client_event_filter, screen);
|
||||
}
|
||||
else
|
||||
gdk_window_remove_filter (gdkwin, gdk_xsettings_client_event_filter, screen);
|
||||
{
|
||||
g_assert (gdkwin);
|
||||
gdk_window_remove_filter (gdkwin, gdk_xsettings_client_event_filter, screen);
|
||||
g_object_unref (gdkwin);
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +110,10 @@ _gdk_windowing_init (gint *argc,
|
||||
void
|
||||
_gdk_windowing_set_default_display (GdkDisplay *display)
|
||||
{
|
||||
gdk_display = GDK_DISPLAY_XDISPLAY (display);
|
||||
if (display)
|
||||
gdk_display = GDK_DISPLAY_XDISPLAY (display);
|
||||
else
|
||||
gdk_display = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -168,7 +168,8 @@ void _gdk_xgrab_check_destroy (GdkWindow *window);
|
||||
gboolean _gdk_x11_display_is_root_window (GdkDisplay *display,
|
||||
Window xroot_window);
|
||||
|
||||
void _gdk_x11_events_init_screen (GdkScreen *screen);
|
||||
void _gdk_x11_events_init_screen (GdkScreen *screen);
|
||||
void _gdk_x11_events_uninit_screen (GdkScreen *screen);
|
||||
|
||||
void _gdk_events_init (GdkDisplay *display);
|
||||
void _gdk_windowing_window_init (GdkScreen *screen);
|
||||
|
@ -232,6 +232,8 @@ gdk_screen_x11_dispose (GObject *object)
|
||||
{
|
||||
GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (object);
|
||||
|
||||
_gdk_x11_events_uninit_screen (GDK_SCREEN (object));
|
||||
|
||||
screen_x11->root_window = NULL;
|
||||
|
||||
screen_x11->xdisplay = NULL;
|
||||
@ -356,7 +358,6 @@ _gdk_x11_screen_new (GdkDisplay *display,
|
||||
|
||||
_gdk_visual_init (screen);
|
||||
_gdk_windowing_window_init (screen);
|
||||
_gdk_x11_events_init_screen (screen);
|
||||
|
||||
return screen;
|
||||
}
|
||||
|
24
gtk/gtkrc.c
24
gtk/gtkrc.c
@ -119,8 +119,10 @@ static GSList * gtk_rc_styles_match (GSList *rc_styles
|
||||
guint path_length,
|
||||
const gchar *path,
|
||||
const gchar *path_reversed);
|
||||
static GtkStyle * gtk_rc_style_to_style (GtkRcStyle *rc_style);
|
||||
static GtkStyle* gtk_rc_init_style (GSList *rc_styles);
|
||||
static GtkStyle * gtk_rc_style_to_style (GtkRcContext *context,
|
||||
GtkRcStyle *rc_style);
|
||||
static GtkStyle* gtk_rc_init_style (GtkRcContext *context,
|
||||
GSList *rc_styles);
|
||||
static void gtk_rc_parse_default_files (GtkRcContext *context);
|
||||
static void gtk_rc_parse_named (GtkRcContext *context,
|
||||
const gchar *name,
|
||||
@ -1635,11 +1637,14 @@ gtk_rc_get_style (GtkWidget *widget)
|
||||
rc_styles = g_slist_prepend (rc_styles, widget_rc_style);
|
||||
|
||||
if (rc_styles)
|
||||
return gtk_rc_init_style (rc_styles);
|
||||
return gtk_rc_init_style (context, rc_styles);
|
||||
else
|
||||
{
|
||||
if (!context->default_style)
|
||||
context->default_style = gtk_style_new ();
|
||||
{
|
||||
context->default_style = gtk_style_new ();
|
||||
_gtk_style_init_for_settings (context->default_style, context->settings);
|
||||
}
|
||||
|
||||
return context->default_style;
|
||||
}
|
||||
@ -1741,7 +1746,7 @@ gtk_rc_get_style_by_paths (GtkSettings *settings,
|
||||
rc_styles = sort_and_dereference_sets (rc_styles);
|
||||
|
||||
if (rc_styles)
|
||||
return gtk_rc_init_style (rc_styles);
|
||||
return gtk_rc_init_style (context, rc_styles);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -1967,11 +1972,13 @@ gtk_rc_style_find (GtkRcContext *context,
|
||||
}
|
||||
|
||||
static GtkStyle *
|
||||
gtk_rc_style_to_style (GtkRcStyle *rc_style)
|
||||
gtk_rc_style_to_style (GtkRcContext *context,
|
||||
GtkRcStyle *rc_style)
|
||||
{
|
||||
GtkStyle *style;
|
||||
|
||||
style = GTK_RC_STYLE_GET_CLASS (rc_style)->create_style (rc_style);
|
||||
_gtk_style_init_for_settings (style, context->settings);
|
||||
|
||||
style->rc_style = rc_style;
|
||||
|
||||
@ -1984,7 +1991,8 @@ gtk_rc_style_to_style (GtkRcStyle *rc_style)
|
||||
|
||||
/* Reuses or frees rc_styles */
|
||||
static GtkStyle *
|
||||
gtk_rc_init_style (GSList *rc_styles)
|
||||
gtk_rc_init_style (GtkRcContext *context,
|
||||
GSList *rc_styles)
|
||||
{
|
||||
GtkStyle *style = NULL;
|
||||
gint i;
|
||||
@ -2069,7 +2077,7 @@ gtk_rc_init_style (GSList *rc_styles)
|
||||
proto_style->bg_pixmap_name[i] = NULL;
|
||||
}
|
||||
|
||||
style = gtk_rc_style_to_style (proto_style);
|
||||
style = gtk_rc_style_to_style (context, proto_style);
|
||||
gtk_rc_style_unref (proto_style);
|
||||
|
||||
g_hash_table_insert (realized_style_ht, rc_styles, style);
|
||||
|
@ -37,7 +37,6 @@ extern "C" {
|
||||
/* Forward declarations */
|
||||
typedef struct _GtkIconFactory GtkIconFactory;
|
||||
typedef struct _GtkRcContext GtkRcContext;
|
||||
typedef struct _GtkSettings GtkSettings;
|
||||
|
||||
typedef struct _GtkRcStyleClass GtkRcStyleClass;
|
||||
|
||||
|
@ -266,12 +266,18 @@ gtk_settings_get_for_screen (GdkScreen *screen)
|
||||
* Gets the #GtkSettings object for the default GDK screen, creating
|
||||
* it if necessary. See gtk_settings_get_for_screen().
|
||||
*
|
||||
* Return value: a #GtkSettings object
|
||||
* Return value: a #GtkSettings object. If there is no default
|
||||
* screen, then returns %NULL.
|
||||
**/
|
||||
GtkSettings*
|
||||
gtk_settings_get_default (void)
|
||||
{
|
||||
return gtk_settings_get_for_screen (gdk_screen_get_default ());
|
||||
GdkScreen *screen = gdk_screen_get_default ();
|
||||
|
||||
if (screen)
|
||||
return gtk_settings_get_for_screen (screen);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -481,14 +481,30 @@ gtk_style_get_type (void)
|
||||
return style_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_style_init (GtkStyle *style)
|
||||
/**
|
||||
* _gtk_style_init_for_settings:
|
||||
* @style: a #GtkStyle
|
||||
* @settings: a #GtkSettings
|
||||
*
|
||||
* Initializes the font description in @style accoridng to the default
|
||||
* font name of @settings. This is called for gtk_style_new() with
|
||||
* the settings for the default screen (if any); if we are creating
|
||||
* a style for a particular screen, we then call it again in a
|
||||
* location where we know the correct settings.
|
||||
* The reason for this is that gtk_rc_style_create_style() doesn't
|
||||
* take the screen for an argument.
|
||||
**/
|
||||
void
|
||||
_gtk_style_init_for_settings (GtkStyle *style,
|
||||
GtkSettings *settings)
|
||||
{
|
||||
gint i;
|
||||
const gchar *font_name = _gtk_rc_context_get_default_font_name (gtk_settings_get_default ());
|
||||
const gchar *font_name = _gtk_rc_context_get_default_font_name (settings);
|
||||
|
||||
if (style->font_desc)
|
||||
pango_font_description_free (style->font_desc);
|
||||
|
||||
style->font_desc = pango_font_description_from_string (font_name);
|
||||
|
||||
|
||||
if (!pango_font_description_get_family (style->font_desc))
|
||||
{
|
||||
g_warning ("Default font does not have a family set");
|
||||
@ -499,6 +515,19 @@ gtk_style_init (GtkStyle *style)
|
||||
g_warning ("Default font does not have a positive size");
|
||||
pango_font_description_set_size (style->font_desc, 10 * PANGO_SCALE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_style_init (GtkStyle *style)
|
||||
{
|
||||
gint i;
|
||||
|
||||
GtkSettings *settings = gtk_settings_get_default ();
|
||||
|
||||
if (settings)
|
||||
_gtk_style_init_for_settings (style, settings);
|
||||
else
|
||||
style->font_desc = pango_font_description_from_string ("Sans 10");
|
||||
|
||||
style->attach_count = 0;
|
||||
style->colormap = NULL;
|
||||
|
@ -56,6 +56,7 @@ typedef struct _GtkRcStyle GtkRcStyle;
|
||||
typedef struct _GtkIconSet GtkIconSet;
|
||||
typedef struct _GtkIconSource GtkIconSource;
|
||||
typedef struct _GtkRcProperty GtkRcProperty;
|
||||
typedef struct _GtkSettings GtkSettings;
|
||||
typedef gboolean (*GtkRcPropertyParser) (const GParamSpec *pspec,
|
||||
const GString *rc_string,
|
||||
GValue *property_value);
|
||||
@ -861,6 +862,8 @@ const GValue* _gtk_style_peek_property_value (GtkStyle *style,
|
||||
GParamSpec *pspec,
|
||||
GtkRcPropertyParser parser);
|
||||
|
||||
void _gtk_style_init_for_settings (GtkStyle *style,
|
||||
GtkSettings *settings);
|
||||
|
||||
/* deprecated */
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
|
Loading…
Reference in New Issue
Block a user