Commit 621beb8a authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

New functions gtk_window_set_transient_for() - set up a "transient for"

Mon Dec  7 01:29:27 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtkwindow.c: New functions
        gtk_window_set_transient_for() - set up a "transient for" relationship.
	gtk_window_set_default_size() - set the initial size of a window
	   distinct from its minimum size.
	gtk_window_set_geometry_hints() - Allow the user to set
	   minimum, maximum sizes, aspect rations, and gridded geometry,
	   possibly all with respect to a subwidget of the window.
	These interfaces are still a wee bit experimental.

	* gdk/gdk.c: Added gdk_window_set_transient_for(),
	gdk_window_set_geometry_hints(), and gdk_window_set_role().

	* gdk/gdktypes.h: Added new types for find-grained specification
	of WM hints.

	* gtk/testgtk.c: Various changes to tests to test the
	above new functions.

	* gtk/gtkfontsel.c: Squash a few 'const' warnings.

	* gtk/gtktogglebutton.c (gtk_toggle_button_realize): Restored
	call to gtk_style_set_background() to prevent egregious
	flashing to black.
parent fd7bdf03
Mon Dec 7 01:29:27 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkwindow.c: New functions
gtk_window_set_transient_for() - set up a "transient for" relationship.
gtk_window_set_default_size() - set the initial size of a window
distinct from its minimum size.
gtk_window_set_geometry_hints() - Allow the user to set
minimum, maximum sizes, aspect rations, and gridded geometry,
possibly all with respect to a subwidget of the window.
These interfaces are still a wee bit experimental.
* gdk/gdk.c: Added gdk_window_set_transient_for(),
gdk_window_set_geometry_hints(), and gdk_window_set_role().
* gdk/gdktypes.h: Added new types for find-grained specification
of WM hints.
* gtk/testgtk.c: Various changes to tests to test the
above new functions.
* gtk/gtkfontsel.c: Squash a few 'const' warnings.
* gtk/gtktogglebutton.c (gtk_toggle_button_realize): Restored
call to gtk_style_set_background() to prevent egregious
flashing to black.
Mon Dec 7 03:52:01 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_handlers_run): when marshalling connect_object
......@@ -7,7 +33,7 @@ Mon Dec 7 03:52:01 1998 Tim Janik <timj@gtk.org>
Mon Dec 7 03:08:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h:
* gtk/gtktypeutils.c: reverted marius change to expose the type systems
* gtk/gtktypeutils.c: reverted Marius's change to expose the type systems
internal type info data to the user. if such functionality is required
we should provide wrapping accessors, ala gtk_signal_query(). also the
GtkTypeInfo structures are dynamically allocated memory portions, so
......
Mon Dec 7 01:29:27 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkwindow.c: New functions
gtk_window_set_transient_for() - set up a "transient for" relationship.
gtk_window_set_default_size() - set the initial size of a window
distinct from its minimum size.
gtk_window_set_geometry_hints() - Allow the user to set
minimum, maximum sizes, aspect rations, and gridded geometry,
possibly all with respect to a subwidget of the window.
These interfaces are still a wee bit experimental.
* gdk/gdk.c: Added gdk_window_set_transient_for(),
gdk_window_set_geometry_hints(), and gdk_window_set_role().
* gdk/gdktypes.h: Added new types for find-grained specification
of WM hints.
* gtk/testgtk.c: Various changes to tests to test the
above new functions.
* gtk/gtkfontsel.c: Squash a few 'const' warnings.
* gtk/gtktogglebutton.c (gtk_toggle_button_realize): Restored
call to gtk_style_set_background() to prevent egregious
flashing to black.
Mon Dec 7 03:52:01 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_handlers_run): when marshalling connect_object
......@@ -7,7 +33,7 @@ Mon Dec 7 03:52:01 1998 Tim Janik <timj@gtk.org>
Mon Dec 7 03:08:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h:
* gtk/gtktypeutils.c: reverted marius change to expose the type systems
* gtk/gtktypeutils.c: reverted Marius's change to expose the type systems
internal type info data to the user. if such functionality is required
we should provide wrapping accessors, ala gtk_signal_query(). also the
GtkTypeInfo structures are dynamically allocated memory portions, so
......
Mon Dec 7 01:29:27 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkwindow.c: New functions
gtk_window_set_transient_for() - set up a "transient for" relationship.
gtk_window_set_default_size() - set the initial size of a window
distinct from its minimum size.
gtk_window_set_geometry_hints() - Allow the user to set
minimum, maximum sizes, aspect rations, and gridded geometry,
possibly all with respect to a subwidget of the window.
These interfaces are still a wee bit experimental.
* gdk/gdk.c: Added gdk_window_set_transient_for(),
gdk_window_set_geometry_hints(), and gdk_window_set_role().
* gdk/gdktypes.h: Added new types for find-grained specification
of WM hints.
* gtk/testgtk.c: Various changes to tests to test the
above new functions.
* gtk/gtkfontsel.c: Squash a few 'const' warnings.
* gtk/gtktogglebutton.c (gtk_toggle_button_realize): Restored
call to gtk_style_set_background() to prevent egregious
flashing to black.
Mon Dec 7 03:52:01 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_handlers_run): when marshalling connect_object
......@@ -7,7 +33,7 @@ Mon Dec 7 03:52:01 1998 Tim Janik <timj@gtk.org>
Mon Dec 7 03:08:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h:
* gtk/gtktypeutils.c: reverted marius change to expose the type systems
* gtk/gtktypeutils.c: reverted Marius's change to expose the type systems
internal type info data to the user. if such functionality is required
we should provide wrapping accessors, ala gtk_signal_query(). also the
GtkTypeInfo structures are dynamically allocated memory portions, so
......
Mon Dec 7 01:29:27 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkwindow.c: New functions
gtk_window_set_transient_for() - set up a "transient for" relationship.
gtk_window_set_default_size() - set the initial size of a window
distinct from its minimum size.
gtk_window_set_geometry_hints() - Allow the user to set
minimum, maximum sizes, aspect rations, and gridded geometry,
possibly all with respect to a subwidget of the window.
These interfaces are still a wee bit experimental.
* gdk/gdk.c: Added gdk_window_set_transient_for(),
gdk_window_set_geometry_hints(), and gdk_window_set_role().
* gdk/gdktypes.h: Added new types for find-grained specification
of WM hints.
* gtk/testgtk.c: Various changes to tests to test the
above new functions.
* gtk/gtkfontsel.c: Squash a few 'const' warnings.
* gtk/gtktogglebutton.c (gtk_toggle_button_realize): Restored
call to gtk_style_set_background() to prevent egregious
flashing to black.
Mon Dec 7 03:52:01 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_handlers_run): when marshalling connect_object
......@@ -7,7 +33,7 @@ Mon Dec 7 03:52:01 1998 Tim Janik <timj@gtk.org>
Mon Dec 7 03:08:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h:
* gtk/gtktypeutils.c: reverted marius change to expose the type systems
* gtk/gtktypeutils.c: reverted Marius's change to expose the type systems
internal type info data to the user. if such functionality is required
we should provide wrapping accessors, ala gtk_signal_query(). also the
GtkTypeInfo structures are dynamically allocated memory portions, so
......
Mon Dec 7 01:29:27 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkwindow.c: New functions
gtk_window_set_transient_for() - set up a "transient for" relationship.
gtk_window_set_default_size() - set the initial size of a window
distinct from its minimum size.
gtk_window_set_geometry_hints() - Allow the user to set
minimum, maximum sizes, aspect rations, and gridded geometry,
possibly all with respect to a subwidget of the window.
These interfaces are still a wee bit experimental.
* gdk/gdk.c: Added gdk_window_set_transient_for(),
gdk_window_set_geometry_hints(), and gdk_window_set_role().
* gdk/gdktypes.h: Added new types for find-grained specification
of WM hints.
* gtk/testgtk.c: Various changes to tests to test the
above new functions.
* gtk/gtkfontsel.c: Squash a few 'const' warnings.
* gtk/gtktogglebutton.c (gtk_toggle_button_realize): Restored
call to gtk_style_set_background() to prevent egregious
flashing to black.
Mon Dec 7 03:52:01 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_handlers_run): when marshalling connect_object
......@@ -7,7 +33,7 @@ Mon Dec 7 03:52:01 1998 Tim Janik <timj@gtk.org>
Mon Dec 7 03:08:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h:
* gtk/gtktypeutils.c: reverted marius change to expose the type systems
* gtk/gtktypeutils.c: reverted Marius's change to expose the type systems
internal type info data to the user. if such functionality is required
we should provide wrapping accessors, ala gtk_signal_query(). also the
GtkTypeInfo structures are dynamically allocated memory portions, so
......
Mon Dec 7 01:29:27 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkwindow.c: New functions
gtk_window_set_transient_for() - set up a "transient for" relationship.
gtk_window_set_default_size() - set the initial size of a window
distinct from its minimum size.
gtk_window_set_geometry_hints() - Allow the user to set
minimum, maximum sizes, aspect rations, and gridded geometry,
possibly all with respect to a subwidget of the window.
These interfaces are still a wee bit experimental.
* gdk/gdk.c: Added gdk_window_set_transient_for(),
gdk_window_set_geometry_hints(), and gdk_window_set_role().
* gdk/gdktypes.h: Added new types for find-grained specification
of WM hints.
* gtk/testgtk.c: Various changes to tests to test the
above new functions.
* gtk/gtkfontsel.c: Squash a few 'const' warnings.
* gtk/gtktogglebutton.c (gtk_toggle_button_realize): Restored
call to gtk_style_set_background() to prevent egregious
flashing to black.
Mon Dec 7 03:52:01 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_handlers_run): when marshalling connect_object
......@@ -7,7 +33,7 @@ Mon Dec 7 03:52:01 1998 Tim Janik <timj@gtk.org>
Mon Dec 7 03:08:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h:
* gtk/gtktypeutils.c: reverted marius change to expose the type systems
* gtk/gtktypeutils.c: reverted Marius's change to expose the type systems
internal type info data to the user. if such functionality is required
we should provide wrapping accessors, ala gtk_signal_query(). also the
GtkTypeInfo structures are dynamically allocated memory portions, so
......
Mon Dec 7 01:29:27 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkwindow.c: New functions
gtk_window_set_transient_for() - set up a "transient for" relationship.
gtk_window_set_default_size() - set the initial size of a window
distinct from its minimum size.
gtk_window_set_geometry_hints() - Allow the user to set
minimum, maximum sizes, aspect rations, and gridded geometry,
possibly all with respect to a subwidget of the window.
These interfaces are still a wee bit experimental.
* gdk/gdk.c: Added gdk_window_set_transient_for(),
gdk_window_set_geometry_hints(), and gdk_window_set_role().
* gdk/gdktypes.h: Added new types for find-grained specification
of WM hints.
* gtk/testgtk.c: Various changes to tests to test the
above new functions.
* gtk/gtkfontsel.c: Squash a few 'const' warnings.
* gtk/gtktogglebutton.c (gtk_toggle_button_realize): Restored
call to gtk_style_set_background() to prevent egregious
flashing to black.
Mon Dec 7 03:52:01 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_handlers_run): when marshalling connect_object
......@@ -7,7 +33,7 @@ Mon Dec 7 03:52:01 1998 Tim Janik <timj@gtk.org>
Mon Dec 7 03:08:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h:
* gtk/gtktypeutils.c: reverted marius change to expose the type systems
* gtk/gtktypeutils.c: reverted Marius's change to expose the type systems
internal type info data to the user. if such functionality is required
we should provide wrapping accessors, ala gtk_signal_query(). also the
GtkTypeInfo structures are dynamically allocated memory portions, so
......
......@@ -277,8 +277,18 @@ void gdk_window_set_hints (GdkWindow *window,
gint max_width,
gint max_height,
gint flags);
void gdk_window_set_title (GdkWindow *window,
const gchar *title);
void gdk_window_set_geometry_hints (GdkWindow *window,
GdkGeometry *geometry,
GdkWindowHints flags);
void gdk_set_sm_client_id (const gchar *id);
void gdk_window_set_title (GdkWindow *window,
const gchar *title);
void gdk_window_set_role (GdkWindow *window,
const gchar *role);
void gdk_window_set_transient_for (GdkWindow *window,
GdkWindow *leader);
void gdk_window_set_background (GdkWindow *window,
GdkColor *color);
void gdk_window_set_back_pixmap (GdkWindow *window,
......
......@@ -50,6 +50,7 @@ typedef struct _GdkWindow GdkWindow;
typedef struct _GdkWindow GdkPixmap;
typedef struct _GdkWindow GdkBitmap;
typedef struct _GdkWindow GdkDrawable;
typedef struct _GdkGeometry GdkGeometry;
typedef struct _GdkImage GdkImage;
typedef struct _GdkGCValues GdkGCValues;
typedef struct _GdkGC GdkGC;
......@@ -207,9 +208,12 @@ typedef enum
*/
typedef enum
{
GDK_HINT_POS = 1 << 0,
GDK_HINT_MIN_SIZE = 1 << 1,
GDK_HINT_MAX_SIZE = 1 << 2
GDK_HINT_POS = 1 << 0,
GDK_HINT_MIN_SIZE = 1 << 1,
GDK_HINT_MAX_SIZE = 1 << 2,
GDK_HINT_BASE_SIZE = 1 << 3,
GDK_HINT_ASPECT = 1 << 4,
GDK_HINT_RESIZE_INC = 1 << 5
} GdkWindowHints;
/* GC function types.
......@@ -773,6 +777,20 @@ struct _GdkWindow
gpointer user_data;
};
struct _GdkGeometry {
gint min_width;
gint min_height;
gint max_width;
gint max_height;
gint base_width;
gint base_height;
gint width_inc;
gint height_inc;
gdouble min_aspect;
gdouble max_aspect;
/* GdkGravity gravity; */
};
struct _GdkImage
{
GdkImageType type;
......
......@@ -1012,6 +1012,82 @@ gdk_window_set_hints (GdkWindow *window,
XSetWMNormalHints (private->xdisplay, private->xwindow, &size_hints);
}
void
gdk_window_set_geometry_hints (GdkWindow *window,
GdkGeometry *geometry,
GdkWindowHints geom_mask)
{
GdkWindowPrivate *private;
XSizeHints size_hints;
g_return_if_fail (window != NULL);
private = (GdkWindowPrivate*) window;
if (private->destroyed)
return;
size_hints.flags = 0;
if (geom_mask & GDK_HINT_POS)
size_hints.flags |= PPosition;
if (geom_mask & GDK_HINT_MIN_SIZE)
{
size_hints.flags |= PMinSize;
size_hints.min_width = geometry->min_width;
size_hints.min_height = geometry->min_height;
}
if (geom_mask & GDK_HINT_MAX_SIZE)
{
size_hints.flags |= PMaxSize;
size_hints.max_width = geometry->max_width;
size_hints.max_height = geometry->max_height;
}
if (geom_mask & GDK_HINT_BASE_SIZE)
{
size_hints.flags |= PBaseSize;
size_hints.base_width = geometry->base_width;
size_hints.base_height = geometry->base_height;
}
if (geom_mask & GDK_HINT_RESIZE_INC)
{
size_hints.flags |= PResizeInc;
size_hints.width_inc = geometry->width_inc;
size_hints.height_inc = geometry->height_inc;
}
if (geom_mask & GDK_HINT_ASPECT)
{
size_hints.flags |= PAspect;
if (geometry->min_aspect <= 1)
{
size_hints.min_aspect.x = G_MAXINT * geometry->min_aspect;
size_hints.min_aspect.y = G_MAXINT;
}
else
{
size_hints.min_aspect.x = G_MAXINT;
size_hints.min_aspect.y = G_MAXINT / geometry->min_aspect;;
}
if (geometry->max_aspect <= 1)
{
size_hints.max_aspect.x = G_MAXINT * geometry->max_aspect;
size_hints.max_aspect.y = G_MAXINT;
}
else
{
size_hints.max_aspect.x = G_MAXINT;
size_hints.max_aspect.y = G_MAXINT / geometry->max_aspect;;
}
}
if (geom_mask)
XSetWMNormalHints (private->xdisplay, private->xwindow, &size_hints);
}
void
gdk_window_set_title (GdkWindow *window,
const gchar *title)
......@@ -1026,6 +1102,42 @@ gdk_window_set_title (GdkWindow *window,
title, title, NULL, 0, NULL, NULL, NULL);
}
void
gdk_window_set_role (GdkWindow *window,
const gchar *role)
{
GdkWindowPrivate *private;
g_return_if_fail (window != NULL);
private = (GdkWindowPrivate*) window;
if (role)
XChangeProperty (private->xdisplay, private->xwindow,
gdk_atom_intern ("WM_WINDOW_ROLE", FALSE), XA_STRING,
8, PropModeReplace, role, strlen(role));
else
XDeleteProperty (private->xdisplay, private->xwindow,
gdk_atom_intern ("WM_WINDOW_ROLE", FALSE));
}
void
gdk_window_set_transient_for (GdkWindow *window,
GdkWindow *parent)
{
GdkWindowPrivate *private;
GdkWindowPrivate *parent_private;
g_return_if_fail (window != NULL);
private = (GdkWindowPrivate*) window;
parent_private = (GdkWindowPrivate*) parent;
if (!private->destroyed && !parent_private->destroyed)
XSetTransientForHint (private->xdisplay,
private->xwindow, parent_private->xwindow);
}
void
gdk_window_set_background (GdkWindow *window,
GdkColor *color)
......@@ -2350,3 +2462,4 @@ gdk_drawable_set_data (GdkDrawable *drawable,
{
g_dataset_set_data_full (drawable, key, data, destroy_func);
}
......@@ -1012,6 +1012,82 @@ gdk_window_set_hints (GdkWindow *window,
XSetWMNormalHints (private->xdisplay, private->xwindow, &size_hints);
}
void
gdk_window_set_geometry_hints (GdkWindow *window,
GdkGeometry *geometry,
GdkWindowHints geom_mask)
{
GdkWindowPrivate *private;
XSizeHints size_hints;
g_return_if_fail (window != NULL);
private = (GdkWindowPrivate*) window;
if (private->destroyed)
return;
size_hints.flags = 0;
if (geom_mask & GDK_HINT_POS)
size_hints.flags |= PPosition;
if (geom_mask & GDK_HINT_MIN_SIZE)
{
size_hints.flags |= PMinSize;
size_hints.min_width = geometry->min_width;
size_hints.min_height = geometry->min_height;
}
if (geom_mask & GDK_HINT_MAX_SIZE)
{
size_hints.flags |= PMaxSize;
size_hints.max_width = geometry->max_width;
size_hints.max_height = geometry->max_height;
}
if (geom_mask & GDK_HINT_BASE_SIZE)
{
size_hints.flags |= PBaseSize;
size_hints.base_width = geometry->base_width;
size_hints.base_height = geometry->base_height;
}
if (geom_mask & GDK_HINT_RESIZE_INC)
{
size_hints.flags |= PResizeInc;
size_hints.width_inc = geometry->width_inc;
size_hints.height_inc = geometry->height_inc;
}
if (geom_mask & GDK_HINT_ASPECT)
{
size_hints.flags |= PAspect;
if (geometry->min_aspect <= 1)
{
size_hints.min_aspect.x = G_MAXINT * geometry->min_aspect;
size_hints.min_aspect.y = G_MAXINT;
}
else
{
size_hints.min_aspect.x = G_MAXINT;
size_hints.min_aspect.y = G_MAXINT / geometry->min_aspect;;
}
if (geometry->max_aspect <= 1)
{
size_hints.max_aspect.x = G_MAXINT * geometry->max_aspect;
size_hints.max_aspect.y = G_MAXINT;
}
else
{
size_hints.max_aspect.x = G_MAXINT;
size_hints.max_aspect.y = G_MAXINT / geometry->max_aspect;;
}
}
if (geom_mask)
XSetWMNormalHints (private->xdisplay, private->xwindow, &size_hints);
}
void
gdk_window_set_title (GdkWindow *window,
const gchar *title)
......@@ -1026,6 +1102,42 @@ gdk_window_set_title (GdkWindow *window,
title, title, NULL, 0, NULL, NULL, NULL);
}
void
gdk_window_set_role (GdkWindow *window,
const gchar *role)
{
GdkWindowPrivate *private;
g_return_if_fail (window != NULL);
private = (GdkWindowPrivate*) window;
if (role)
XChangeProperty (private->xdisplay, private->xwindow,
gdk_atom_intern ("WM_WINDOW_ROLE", FALSE), XA_STRING,
8, PropModeReplace, role, strlen(role));
else
XDeleteProperty (private->xdisplay, private->xwindow,
gdk_atom_intern ("WM_WINDOW_ROLE", FALSE));
}
void
gdk_window_set_transient_for (GdkWindow *window,
GdkWindow *parent)
{
GdkWindowPrivate *private;
GdkWindowPrivate *parent_private;
g_return_if_fail (window != NULL);
private = (GdkWindowPrivate*) window;
parent_private = (GdkWindowPrivate*) parent;
if (!private->destroyed && !parent_private->destroyed)
XSetTransientForHint (private->xdisplay,
private->xwindow, parent_private->xwindow);
}
void
gdk_window_set_background (GdkWindow *window,
GdkColor *color)
......@@ -2350,3 +2462,4 @@ gdk_drawable_set_data (GdkDrawable *drawable,
{
g_dataset_set_data_full (drawable, key, data, destroy_func);
}
......@@ -441,7 +441,7 @@ gtk_font_selection_init(GtkFontSelection *fontsel)
gchar buffer[128];
gchar *size;
gint size_to_match;
gchar *row_text[3];
const gchar *row_text[3];
gchar *property, *text;
gboolean inserted;
......@@ -1316,7 +1316,8 @@ gtk_font_selection_show_available_sizes (GtkFontSelection *fontsel)
{
FontInfo *font;
FontStyle *styles, *style;
guint16 *standard_sizes, *bitmapped_sizes, bitmap_size;
const guint16 *standard_sizes;
guint16 *bitmapped_sizes, bitmap_size;
gint nstandard_sizes, nbitmapped_sizes;
gchar buffer[16], *size;
gfloat bitmap_size_float;
......
......@@ -538,7 +538,11 @@ gtk_toggle_button_realize (GtkWidget *widget)
gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gdk_window_set_user_data (widget->window, toggle_button);
}
widget->style = gtk_style_attach (widget->style, widget->window);
if (!toggle_button->draw_indicator)
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
}
static void
......
......@@ -42,6 +42,16 @@ enum {
ARG_WIN_POS
};
typedef struct {
GdkGeometry geometry;
GdkWindowHints mask;
GtkWidget *widget;
gint width;
gint height;
gint last_width;
gint last_height;
} GtkWindowGeometryInfo;
static void gtk_window_class_init (GtkWindowClass *klass);
static void gtk_window_init (GtkWindow *window);
static void gtk_window_set_arg (GtkObject *object,
......@@ -95,6 +105,15 @@ static gint gtk_window_expose (GtkWidget *widget,
GdkEventExpose *event);
static void gtk_window_style_set (GtkWidget *widget,
GtkStyle *previous_style);
static void gtk_window_unset_transient_for (GtkWindow *window);
static void gtk_window_transient_parent_realized (GtkWidget *parent,
GtkWidget *window);
static void gtk_window_transient_parent_unrealized (GtkWidget *parent,
GtkWidget *window);
static GtkWindowGeometryInfo* gtk_window_get_geometry_info (GtkWindow *window,
gboolean create);
static void gtk_window_geometry_destroy (GtkWindowGeometryInfo *info);
static GtkBinClass *parent_class = NULL;
static guint window_signals[LAST_SIGNAL] = { 0 };
......@@ -538,14 +557,177 @@ gtk_window_shutdown (GtkObject *object)
GTK_OBJECT_CLASS (parent_class)->shutdown (object);
}
static void
gtk_window_transient_parent_realized (GtkWidget *parent,
GtkWidget *window)
{
if (GTK_WIDGET_REALIZED (window))
gdk_window_set_transient_for (parent->window, window->window);
}
static void
gtk_window_transient_parent_unrealized (GtkWidget *parent,
GtkWidget *window)
{
if (GTK_WIDGET_REALIZED (window))
gdk_property_delete (window->window,
gdk_atom_intern ("WM_TRANSIENT_FOR", FALSE));
}
static void
gtk_window_unset_transient_for (GtkWindow *window)
{
if (window->transient_parent)
{
gtk_signal_disconnect_by_func (GTK_OBJECT (window->transient_parent),
GTK_SIGNAL_FUNC (gtk_window_transient_parent_realized),
window);
gtk_signal_disconnect_by_func (GTK_OBJECT (window->transient_parent),
GTK_SIGNAL_FUNC (gtk_window_transient_parent_unrealized),
window);
gtk_signal_disconnect_by_func (GTK_OBJECT (window->transient_parent),
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
&window->transient_parent);
window->transient_parent = NULL;
}
}
void
gtk_window_set_transient_for (GtkWindow *window,
GtkWindow *parent)
{
g_return_if_fail (window != 0);
if (window->transient_parent)
{
gtk_window_unset_transient_for (window);
if (GTK_WIDGET_REALIZED (window) &&
GTK_WIDGET_REALIZED (window->transient_parent) &&
(!parent || !GTK_WIDGET_REALIZED (parent)))
gtk_window_transient_parent_unrealized (GTK_WIDGET (window->transient_parent),
GTK_WIDGET (window));
}
window->transient_parent = parent;
if (parent)
{
gtk_signal_connect (GTK_OBJECT (parent), "destroy",
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
&window->transient_parent);
gtk_signal_connect (GTK_OBJECT (parent), "realize",
GTK_SIGNAL_FUNC (gtk_window_transient_parent_realized),
window);
gtk_signal_connect (GTK_OBJECT (parent), "unrealize",
GTK_SIGNAL_FUNC (gtk_window_transient_parent_unrealized),
window);
if (GTK_WIDGET_REALIZED (window) &&
GTK_WIDGET_REALIZED (parent))
gtk_window_transient_parent_realized (GTK_WIDGET (parent),
GTK_WIDGET (window));
}
}
static void
gtk_window_geometry_destroy (GtkWindowGeometryInfo *info)
{
if (info->widget)
gtk_signal_disconnect_by_func (GTK_OBJECT (info->widget),
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
&info->widget);
g_free (info);
}
static GtkWindowGeometryInfo *
gtk_window_get_geometry_info (GtkWindow *window, gboolean create)
{
GtkWindowGeometryInfo *info;
info = gtk_object_get_data (GTK_OBJECT (window), "gtk-window-geometry");