gboolean on);
static gboolean gdk_window_have_shape_ext (GdkDisplay *display);
static gboolean gdk_window_icon_name_set (GdkWindow *window);
+static void gdk_window_add_colormap_windows (GdkWindow *window);
+static void set_wm_name (GdkDisplay *display,
+ Window xwindow,
+ const gchar *name);
static GdkColormap* gdk_window_impl_x11_get_colormap (GdkDrawable *drawable);
static void gdk_window_impl_x11_set_colormap (GdkDrawable *drawable,
static void
gdk_window_impl_x11_init (GdkWindowImplX11 *impl)
-{
+{
impl->width = 1;
impl->height = 1;
}
drawable_impl->colormap == NULL)
{
XWindowAttributes window_attributes;
+ GdkVisual *visual;
XGetWindowAttributes (GDK_SCREEN_XDISPLAY (drawable_impl->screen),
drawable_impl->xid,
&window_attributes);
- drawable_impl->colormap =
- gdk_colormap_lookup (window_attributes.colormap);
+
+ visual = gdk_x11_screen_lookup_visual (drawable_impl->screen,
+ window_attributes.visual->visualid);
+ drawable_impl->colormap = gdk_x11_colormap_foreign_new (visual,
+ window_attributes.colormap);
}
return drawable_impl->colormap;
impl = GDK_WINDOW_IMPL_X11 (drawable);
draw_impl = GDK_DRAWABLE_IMPL_X11 (drawable);
- if (GDK_WINDOW_DESTROYED (draw_impl->wrapper))
+ if (cmap && GDK_WINDOW_DESTROYED (draw_impl->wrapper))
return;
/* chain up */
g_assert (screen_x11->root_window == NULL);
- screen_x11->default_colormap = gdk_screen_get_system_colormap (screen);
+ gdk_screen_set_default_colormap (screen,
+ gdk_screen_get_system_colormap (screen));
XGetGeometry (screen_x11->xdisplay, screen_x11->xroot_window,
&screen_x11->xroot_window, &x, &y, &width, &height, &border_width, &depth);
draw_impl->screen = screen;
draw_impl->xid = screen_x11->xroot_window;
draw_impl->wrapper = GDK_DRAWABLE (private);
+ draw_impl->colormap = gdk_screen_get_system_colormap (screen);
+ g_object_ref (draw_impl->colormap);
private->window_type = GDK_WINDOW_ROOT;
private->depth = depth;
+
impl->width = width;
impl->height = height;
+ _gdk_window_init_position (GDK_WINDOW (private));
+
_gdk_xid_table_insert (screen_x11->display,
&screen_x11->xroot_window,
screen_x11->root_window);
XSetWMProtocols (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), protocols, 3);
}
+static const gchar *
+get_default_title (void)
+{
+ const char *title;
+
+ title = g_get_application_name ();
+ if (!title)
+ title = g_get_prgname ();
+
+ return title;
+}
+
+static void
+check_leader_window_title (GdkDisplay *display)
+{
+ GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display);
+
+ if (!display_x11->leader_window_title_set)
+ {
+ set_wm_name (display,
+ display_x11->leader_window,
+ get_default_title ());
+
+ display_x11->leader_window_title_set = TRUE;
+ }
+}
+
/**
* gdk_window_new:
* @parent: a #GdkWindow, or %NULL to create the window as a child of
* @attributes_mask: mask indicating which fields in @attributes are valid
*
* Creates a new #GdkWindow using the attributes from
- * @attributes. Seep #GdkWindowAttr and #GdkWindowAttributesType for
+ * @attributes. See #GdkWindowAttr and #GdkWindowAttributesType for
* more details. Note: to use this on displays other than the default
* display, @parent must be specified.
*
int x, y, depth;
unsigned int class;
- char *title;
+ const char *title;
int i;
long pid;
if (attributes_mask & GDK_WA_COLORMAP)
{
draw_impl->colormap = attributes->colormap;
- gdk_colormap_ref (attributes->colormap);
+ g_object_ref (attributes->colormap);
}
else
{
if ((((GdkVisualPrivate *)gdk_screen_get_system_visual (screen))->xvisual) == xvisual)
{
draw_impl->colormap = gdk_screen_get_system_colormap (screen);
- gdk_colormap_ref (draw_impl->colormap);
+ g_object_ref (draw_impl->colormap);
}
else
{
class = InputOnly;
private->input_only = TRUE;
draw_impl->colormap = gdk_screen_get_system_colormap (screen);
- gdk_colormap_ref (draw_impl->colormap);
+ g_object_ref (draw_impl->colormap);
}
xid = draw_impl->xid = XCreateWindow (xdisplay, xparent,
0, depth, class, xvisual,
xattributes_mask, &xattributes);
- gdk_drawable_ref (window);
+ g_object_ref (window);
_gdk_xid_table_insert (screen_x11->display, &draw_impl->xid, window);
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
case GDK_WINDOW_CHILD:
if ((attributes->wclass == GDK_INPUT_OUTPUT) &&
(draw_impl->colormap != gdk_screen_get_system_colormap (screen)) &&
- (draw_impl->colormap != gdk_window_get_colormap (gdk_window_get_toplevel (window))))
+ (draw_impl->colormap != gdk_drawable_get_colormap (gdk_window_get_toplevel (window))))
{
GDK_NOTE (MISC, g_message ("adding colormap window\n"));
gdk_window_add_colormap_windows (window);
size_hints.flags = PSize;
size_hints.width = impl->width;
size_hints.height = impl->height;
+
+ check_leader_window_title (screen_x11->display);
wm_hints.flags = StateHint | WindowGroupHint;
wm_hints.window_group = GDK_DISPLAY_X11 (screen_x11->display)->leader_window;
if (attributes_mask & GDK_WA_TITLE)
title = attributes->title;
else
- title = g_get_prgname ();
+ title = get_default_title ();
gdk_window_set_title (window, title);
_gdk_window_init_position (GDK_WINDOW (private));
- gdk_drawable_ref (window);
+ g_object_ref (window);
_gdk_xid_table_insert (display, &GDK_WINDOW_XID (window), window);
return window;
}
{
GdkDrawableImplX11 *draw_impl = GDK_DRAWABLE_IMPL_X11 (private->impl);
+#ifdef HAVE_XFT2
if (draw_impl->xft_draw)
XftDrawDestroy (draw_impl->xft_draw);
+#else /* !HAVE_XFT2 */
+ if (draw_impl->picture)
+ XRenderFreePicture (GDK_DRAWABLE_XDISPLAY (window), draw_impl->picture);
+#endif /* HAVE_XFT2 */
}
#endif /* HAVE_XFT */
_gdk_xgrab_check_destroy (window);
- gdk_drawable_unref (window);
+ g_object_unref (window);
}
static void
set_initial_hints (GdkWindow *window)
{
GdkWindowObject *private;
- Atom atoms[5];
+ Atom atoms[6];
gint i;
private = (GdkWindowObject*) window;
++i;
}
+ if (private->state & GDK_WINDOW_STATE_FULLSCREEN)
+ {
+ atoms[i] = gdk_x11_get_xatom_by_name_for_display (GDK_WINDOW_DISPLAY (window),
+ "_NET_WM_STATE_FULLSCREEN");
+ ++i;
+ }
+
if (private->modal_hint)
{
atoms[i] = gdk_x11_get_xatom_by_name_for_display (GDK_WINDOW_DISPLAY (window),
* @window: a toplevel #GdkWindow
*
* Withdraws a window (unmaps it and asks the window manager to forget about it).
- * Normally done automatically by gtk_widget_hide() called on a #GtkWindow.
+ * This function is not really useful as gdk_window_hide() automatically
+ * withdraws toplevel windows before hiding them.
*
**/
void
*
* If you're also planning to resize the window, use gdk_window_move_resize()
* to both move and resize simultaneously, for a nicer visual effect.
- *
**/
void
gdk_window_move (GdkWindow *window,
*
* If you're also planning to move the window, use gdk_window_move_resize()
* to both move and resize simultaneously, for a nicer visual effect.
- *
**/
void
gdk_window_resize (GdkWindow *window,
* except that both operations are performed at once, avoiding strange
* visual effects. (i.e. the user may be able to see the window first
* move, then resize, if you don't use gdk_window_move_resize().)
- *
**/
void
gdk_window_move_resize (GdkWindow *window,
*
* Raises @window to the top of the Z-order (stacking order), so that
* other windows with the same parent window appear below @window.
+ * This is true whether or not the windows are visible.
+ *
* If @window is a toplevel, the window manager may choose to deny the
* request to move the window in the Z-order, gdk_window_raise() only
* requests the restack, does not guarantee it.
*
* Lowers @window to the bottom of the Z-order (stacking order), so that
* other windows with the same parent window appear above @window.
+ * This is true whether or not the other windows are visible.
+ *
* If @window is a toplevel, the window manager may choose to deny the
* request to move the window in the Z-order, gdk_window_lower() only
* requests the restack, does not guarantee it.
/**
* gdk_window_set_type_hint:
- * @window: A #GdkWindow
+ * @window: A toplevel #GdkWindow
* @hint: A hint of the function this window will have
*
* The application can use this call to provide a hint to the window
case GDK_WINDOW_TYPE_HINT_TOOLBAR:
atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_TOOLBAR");
break;
+ case GDK_WINDOW_TYPE_HINT_UTILITY:
+ atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_UTILITY");
+ break;
+ case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN:
+ atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_SPLASH");
+ break;
+ case GDK_WINDOW_TYPE_HINT_DOCK:
+ atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_DOCK");
+ break;
+ case GDK_WINDOW_TYPE_HINT_DESKTOP:
+ atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_DESKTOP");
+ break;
default:
g_warning ("Unknown hint %d passed to gdk_window_set_type_hint", hint);
/* Fall thru */
/**
* gdk_window_set_modal_hint:
- * @window: A #GdkWindow
+ * @window: A toplevel #GdkWindow
* @modal: TRUE if the window is modal, FALSE otherwise.
*
* The application can use this hint to tell the window manager
0);
}
+/**
+ * gdk_window_set_skip_taskbar_hint:
+ * @window: a toplevel #GdkWindow
+ * @skips_taskbar: %TRUE to skip the taskbar
+ *
+ * Toggles whether a window should appear in a task list or window
+ * list. If a window's semantic type as specified with
+ * gdk_window_set_type_hint() already fully describes the window, this
+ * function should NOT be called in addition, instead you should allow
+ * the window to be treated according to standard policy for its
+ * semantic type.
+ **/
+void
+gdk_window_set_skip_taskbar_hint (GdkWindow *window,
+ gboolean skips_taskbar)
+{
+ GdkWindowObject *private;
+ GdkWindowImplX11 *impl;
+
+ g_return_if_fail (window != NULL);
+ g_return_if_fail (GDK_IS_WINDOW (window));
+
+ if (GDK_WINDOW_DESTROYED (window))
+ return;
+
+ private = (GdkWindowObject*) window;
+ impl = GDK_WINDOW_IMPL_X11 (private->impl);
+
+ impl->skip_taskbar_hint = skips_taskbar;
+
+ if (GDK_WINDOW_IS_MAPPED (window))
+ gdk_wmspec_change_state (skips_taskbar, window,
+ gdk_atom_intern ("_NET_WM_STATE_SKIP_TASKBAR", FALSE),
+ 0);
+}
+
+/**
+ * gdk_window_set_skip_pager_hint:
+ * @window: a toplevel #GdkWindow
+ * @skips_pager: %TRUE to skip the pager
+ *
+ * Toggles whether a window should appear in a pager (workspace
+ * switcher, or other desktop utility program that displays a small
+ * thumbnail representation of the windows on the desktop). If a
+ * window's semantic type as specified with gdk_window_set_type_hint()
+ * already fully describes the window, this function should NOT be
+ * called in addition, instead you should allow the window to be
+ * treated according to standard policy for its semantic type.
+ **/
+void
+gdk_window_set_skip_pager_hint (GdkWindow *window,
+ gboolean skips_pager)
+{
+ GdkWindowObject *private;
+ GdkWindowImplX11 *impl;
+
+ g_return_if_fail (window != NULL);
+ g_return_if_fail (GDK_IS_WINDOW (window));
+
+ if (GDK_WINDOW_DESTROYED (window))
+ return;
+
+ private = (GdkWindowObject*) window;
+ impl = GDK_WINDOW_IMPL_X11 (private->impl);
+
+ impl->skip_pager_hint = skips_pager;
+
+ if (GDK_WINDOW_IS_MAPPED (window))
+ gdk_wmspec_change_state (skips_pager, window,
+ gdk_atom_intern ("_NET_WM_STATE_SKIP_PAGER", FALSE),
+ 0);
+}
+
/**
* gdk_window_set_geometry_hints:
- * @window: a #GdkWindow
+ * @window: a toplevel #GdkWindow
* @geometry: geometry hints
* @geom_mask: bitmask indicating fields of @geometry to pay attention to
*
* Sets the geometry hints for @window. Hints flagged in @geom_mask
* are set, hints not flagged in @geom_mask are unset.
* To unset all hints, use a @geom_mask of 0 and a @geometry of %NULL.
+ *
+ * This function provides hints to the windowing system about
+ * acceptable sizes for a toplevel window. The purpose of
+ * this is to constrain user resizing, but the windowing system
+ * will typically (but is not required to) also constrain the
+ * current size of the window to the provided values and
+ * constrain programatic resizing via gdk_window_resize() or
+ * gdk_window_move_resize().
*
+ * Note that on X11, this effect has no effect on windows
+ * of type GDK_WINDOW_TEMP or windows where override_redirect
+ * has been turned on via gdk_window_set_override_redirect()
+ * since these windows are not resizable by the user.
+ *
+ * Since you can't count on the windowing system doing the
+ * constraints for programmatic resizes, you should generally
+ * call gdk_window_constrain_size() yourself to determine
+ * appropriate sizes.
+ *
**/
void
gdk_window_set_geometry_hints (GdkWindow *window,
* convertable to STRING, otherwise, set it as compound text
*/
static void
-set_text_property (GdkWindow *window,
+set_text_property (GdkDisplay *display,
+ Window xwindow,
Atom property,
const gchar *utf8_str)
{
{
GdkAtom gdk_type;
- gdk_utf8_to_compound_text_for_display (gdk_drawable_get_display (window),
+ gdk_utf8_to_compound_text_for_display (display,
utf8_str, &gdk_type, &prop_format,
&prop_text, &prop_length);
- prop_type = gdk_x11_atom_to_xatom_for_display
- (GDK_WINDOW_DISPLAY (window), gdk_type);
+ prop_type = gdk_x11_atom_to_xatom_for_display (display, gdk_type);
}
if (prop_text)
{
- XChangeProperty (GDK_WINDOW_XDISPLAY (window),
- GDK_WINDOW_XID (window),
+ XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
+ xwindow,
property,
prop_type, prop_format,
PropModeReplace, prop_text,
}
}
+/* Set WM_NAME and _NET_WM_NAME
+ */
+static void
+set_wm_name (GdkDisplay *display,
+ Window xwindow,
+ const gchar *name)
+{
+ XChangeProperty (GDK_DISPLAY_XDISPLAY (display), xwindow,
+ gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_NAME"),
+ gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING"), 8,
+ PropModeReplace, name, strlen (name));
+
+ set_text_property (display, xwindow,
+ gdk_x11_get_xatom_by_name_for_display (display, "WM_NAME"),
+ name);
+}
+
/**
* gdk_window_set_title:
- * @window: a #GdkWindow
+ * @window: a toplevel #GdkWindow
* @title: title of @window
*
* Sets the title of a toplevel window, to be displayed in the titlebar.
const gchar *title)
{
GdkDisplay *display;
+ Display *xdisplay;
+ Window xwindow;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
return;
display = gdk_drawable_get_display (window);
+ xdisplay = GDK_DISPLAY_XDISPLAY (display);
+ xwindow = GDK_WINDOW_XID (window);
- XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window),
- gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_NAME"),
- gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING"), 8,
- PropModeReplace, title, strlen (title));
-
- set_text_property (window,
- gdk_x11_get_xatom_by_name_for_display (display, "WM_NAME"),
- title);
+ set_wm_name (display, xwindow, title);
if (!gdk_window_icon_name_set (window))
{
- XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window),
+ XChangeProperty (xdisplay, xwindow,
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_ICON_NAME"),
gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING"), 8,
PropModeReplace, title, strlen (title));
- set_text_property (window,
+ set_text_property (display, xwindow,
gdk_x11_get_xatom_by_name_for_display (display, "WM_ICON_NAME"),
title);
}
/**
* gdk_window_set_role:
- * @window: a #GdkWindow
+ * @window: a toplevel #GdkWindow
* @role: a string indicating its role
*
* When using GTK+, typically you should use gtk_window_set_role() instead
if (private->bg_pixmap &&
private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
private->bg_pixmap != GDK_NO_BG)
- gdk_pixmap_unref (private->bg_pixmap);
+ g_object_unref (private->bg_pixmap);
private->bg_pixmap = NULL;
}
if (private->bg_pixmap &&
private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
private->bg_pixmap != GDK_NO_BG)
- gdk_pixmap_unref (private->bg_pixmap);
+ g_object_unref (private->bg_pixmap);
if (parent_relative)
{
{
if (pixmap)
{
- gdk_pixmap_ref (pixmap);
+ g_object_ref (pixmap);
private->bg_pixmap = pixmap;
xpixmap = GDK_PIXMAP_XID (pixmap);
}
/**
* gdk_window_get_deskrelative_origin:
- * @window: a #GdkWindow
+ * @window: a toplevel #GdkWindow
* @x: return location for X coordinate
* @y: return location for Y coordinate
*
/**
* gdk_window_get_root_origin:
- * @window: a #GdkWindow
+ * @window: a toplevel #GdkWindow
* @x: return location for X position of window frame
* @y: return location for Y position of window frame
*
/**
* gdk_window_get_frame_extents:
- * @window: a #GdkWindow
+ * @window: a toplevel #GdkWindow
* @rect: rectangle to fill with bounding box of the window frame
*
* Obtains the bounding box of the window, including window manager
}
}
+void
+_gdk_windowing_get_pointer (GdkDisplay *display,
+ GdkScreen **screen,
+ gint *x,
+ gint *y,
+ GdkModifierType *mask)
+{
+ GdkScreen *default_screen;
+ Window root = None;
+ Window child;
+ int rootx, rooty;
+ int winx;
+ int winy;
+ unsigned int xmask;
+
+ if (display->closed)
+ return;
+
+ default_screen = gdk_display_get_default_screen (display);
+
+ XQueryPointer (GDK_SCREEN_XDISPLAY (default_screen),
+ GDK_SCREEN_XROOTWIN (default_screen),
+ &root, &child, &rootx, &rooty, &winx, &winy, &xmask);
+
+ if (root != None)
+ {
+ GdkWindow *gdk_root = gdk_window_lookup_for_display (display, root);
+ *screen = gdk_drawable_get_screen (gdk_root);
+ }
+
+ *x = rootx;
+ *y = rooty;
+ *mask = xmask;
+}
+
GdkWindow*
-_gdk_windowing_window_get_pointer (GdkWindow *window,
+_gdk_windowing_window_get_pointer (GdkDisplay *display,
+ GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask)
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
- if (!window)
- {
- GDK_NOTE (MULTIHEAD,
- g_message ("_gdk_windowing_window_get_pointer(): window arg is need for multihead safe operation"));
- window = gdk_screen_get_root_window (gdk_screen_get_default ());
- }
-
_gdk_windowing_window_get_offsets (window, &xoffset, &yoffset);
return_val = NULL;
return_val = gdk_window_lookup_for_display (GDK_WINDOW_DISPLAY (window), child);
}
- if (x)
- *x = winx + xoffset;
- if (y)
- *y = winy + yoffset;
- if (mask)
- *mask = xmask;
+ *x = winx + xoffset;
+ *y = winy + yoffset;
+ *mask = xmask;
return return_val;
}
GdkWindow*
-_gdk_windowing_window_at_pointer (GdkScreen *screen,
- gint *win_x,
- gint *win_y)
+_gdk_windowing_window_at_pointer (GdkDisplay *display,
+ gint *win_x,
+ gint *win_y)
{
GdkWindow *window;
+ GdkScreen *screen;
Window root;
Window xwindow;
+ Window child;
Window xwindow_last = 0;
Display *xdisplay;
int rootx = -1, rooty = -1;
int winx, winy;
unsigned int xmask;
+ screen = gdk_display_get_default_screen (display);
+
xwindow = GDK_SCREEN_XROOTWIN (screen);
xdisplay = GDK_SCREEN_XDISPLAY (screen);
+ /* This function really only works if the mouse pointer is held still
+ * during its operation. If it moves from one leaf window to another
+ * than we'll end up with inaccurate values for win_x, win_y
+ * and the result.
+ */
XGrabServer (xdisplay);
+ XQueryPointer (xdisplay, xwindow,
+ &root, &child, &rootx, &rooty, &winx, &winy, &xmask);
+
+ if (root == xwindow)
+ xwindow = child;
+ else
+ xwindow = root;
+
while (xwindow)
{
xwindow_last = xwindow;
window = gdk_window_lookup_for_display (GDK_SCREEN_DISPLAY(screen),
xwindow_last);
- if (win_x)
- *win_x = window ? winx : -1;
- if (win_y)
- *win_y = window ? winy : -1;
+ *win_x = window ? winx : -1;
+ *win_y = window ? winy : -1;
return window;
}
}
}
-void
+static void
gdk_window_add_colormap_windows (GdkWindow *window)
{
GdkWindow *toplevel;
* very old X servers, and occasionally the implementation will be
* buggy. On servers without the shape extension, this function
* will do nothing.
+ *
+ * This function works on both toplevel and child windows.
*
**/
void
* very old X servers, and occasionally the implementation will be
* buggy. On servers without the shape extension, this function
* will do nothing.
+ *
+ * This function works on both toplevel and child windows.
*
**/
void
/**
* gdk_window_set_override_redirect:
- * @window: a #GdkWindow
+ * @window: a toplevel #GdkWindow
* @override_redirect: %TRUE if window should be override redirect
*
* An override redirect window is not under the control of the window manager.
/**
* gdk_window_set_icon:
- * @window: a #GdkWindow
+ * @window: a toplevel #GdkWindow
* @icon_window: a #GdkWindow to use for the icon, or %NULL to unset
* @pixmap: a #GdkPixmap to use as the icon, or %NULL to unset
* @mask: a 1-bit pixmap (#GdkBitmap) to use as mask for @pixmap, or %NULL to have none
/**
* gdk_window_set_icon_name:
- * @window: a #GdkWindow
+ * @window: a toplevel #GdkWindow
* @name: name of window while iconified (minimized)
*
* Windows may have a name used while minimized, distinct from the
g_object_set_qdata (G_OBJECT (window), g_quark_from_static_string ("gdk-icon-name-set"),
GUINT_TO_POINTER (TRUE));
- XChangeProperty (GDK_WINDOW_XDISPLAY (window),
+ XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
GDK_WINDOW_XID (window),
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_ICON_NAME"),
gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING"), 8,
PropModeReplace, name, strlen (name));
- set_text_property (window,
+ set_text_property (display, GDK_WINDOW_XID (window),
gdk_x11_get_xatom_by_name_for_display (display, "WM_ICON_NAME"),
name);
}
/**
* gdk_window_iconify:
- * @window: a #GdkWindow
+ * @window: a toplevel #GdkWindow
*
* Asks to iconify (minimize) @window. The window manager may choose
* to ignore the request, but normally will honor it. Using
* gtk_window_iconify() is preferred, if you have a #GtkWindow widget.
- *
+ *
+ * This function only makes sense when @window is a toplevel window.
+ *
**/
void
gdk_window_iconify (GdkWindow *window)
/**
* gdk_window_deiconify:
- * @window: a #GdkWindow
+ * @window: a toplevel #GdkWindow
*
* Attempt to deiconify (unminimize) @window. On X11 the window manager may
* choose to ignore the request to deiconify. When using GTK+,
* use gtk_window_deiconify() instead of the #GdkWindow variant. Or better yet,
* you probably want to use gtk_window_present(), which raises the window, focuses it,
* unminimizes it, and puts it on the current desktop.
- *
+ *
**/
void
gdk_window_deiconify (GdkWindow *window)
/**
* gdk_window_maximize:
- * @window: a #GdkWindow
+ * @window: a toplevel #GdkWindow
*
- * Asks the window manager to maximize @window, if the window manager supports
- * this operation. Not all window managers support this, and some deliberately
- * ignore it or don't have a concept of "maximized"; so you can't rely on the
- * maximization actually happening. But it will happen with most standard
- * window managers, and GDK makes a best effort to get it to happen.
+ * Maximizes the window. If the window was already maximized, then
+ * this function does nothing.
+ *
+ * On X11, asks the window manager to maximize @window, if the window
+ * manager supports this operation. Not all window managers support
+ * this, and some deliberately ignore it or don't have a concept of
+ * "maximized"; so you can't rely on the maximization actually
+ * happening. But it will happen with most standard window managers,
+ * and GDK makes a best effort to get it to happen.
*
- * If the window was already maximized, then this function does nothing.
+ * On Windows, reliably maximizes the window.
*
**/
void
/**
* gdk_window_unmaximize:
- * @window: a #GdkWindow
+ * @window: a toplevel #GdkWindow
*
- * Asks the window manager to unmaximize @window, if the window manager supports
- * this operation. Not all window managers support this, and some deliberately
- * ignore it or don't have a concept of "maximized"; so you can't rely on the
- * unmaximization actually happening. But it will happen with most standard
- * window managers, and GDK makes a best effort to get it to happen.
+ * Unmaximizes the window. If the window wasn't maximized, then this
+ * function does nothing.
+ *
+ * On X11, asks the window manager to unmaximize @window, if the
+ * window manager supports this operation. Not all window managers
+ * support this, and some deliberately ignore it or don't have a
+ * concept of "maximized"; so you can't rely on the unmaximization
+ * actually happening. But it will happen with most standard window
+ * managers, and GDK makes a best effort to get it to happen.
*
- * If the window wasn't maximized, then this function does nothing.
+ * On Windows, reliably unmaximizes the window.
*
**/
void
0);
}
+/**
+ * gdk_window_fullscreen:
+ * @window: a toplevel #GdkWindow
+ *
+ * Moves the window into fullscreen mode. This means the
+ * window covers the entire screen and is above any panels
+ * or task bars.
+ *
+ * If the window was already fullscreen, then this function does nothing.
+ *
+ * On X11, asks the window manager to put @window in a fullscreen
+ * state, if the window manager supports this operation. Not all
+ * window managers support this, and some deliberately ignore it or
+ * don't have a concept of "fullscreen"; so you can't rely on the
+ * fullscreenification actually happening. But it will happen with
+ * most standard window managers, and GDK makes a best effort to get
+ * it to happen.
+ *
+ **/
+void
+gdk_window_fullscreen (GdkWindow *window)
+{
+ g_return_if_fail (GDK_IS_WINDOW (window));
+
+ if (GDK_WINDOW_DESTROYED (window))
+ return;
+
+ if (GDK_WINDOW_IS_MAPPED (window))
+ gdk_wmspec_change_state (TRUE, window,
+ gdk_atom_intern ("_NET_WM_STATE_FULLSCREEN", FALSE),
+ GDK_NONE);
+
+ else
+ gdk_synthesize_window_state (window,
+ 0,
+ GDK_WINDOW_STATE_FULLSCREEN);
+}
+
+/**
+ * gdk_window_unfullscreen:
+ * @window: a toplevel #GdkWindow
+ *
+ * Moves the window out of fullscreen mode. If the window was not
+ * fullscreen, does nothing.
+ *
+ * On X11, asks the window manager to move @window out of the fullscreen
+ * state, if the window manager supports this operation. Not all
+ * window managers support this, and some deliberately ignore it or
+ * don't have a concept of "fullscreen"; so you can't rely on the
+ * unfullscreenification actually happening. But it will happen with
+ * most standard window managers, and GDK makes a best effort to get
+ * it to happen.
+ *
+ **/
+void
+gdk_window_unfullscreen (GdkWindow *window)
+{
+ g_return_if_fail (GDK_IS_WINDOW (window));
+
+ if (GDK_WINDOW_DESTROYED (window))
+ return;
+
+ if (GDK_WINDOW_IS_MAPPED (window))
+ gdk_wmspec_change_state (FALSE, window,
+ gdk_atom_intern ("_NET_WM_STATE_FULLSCREEN", FALSE),
+ GDK_NONE);
+
+ else
+ gdk_synthesize_window_state (window,
+ GDK_WINDOW_STATE_FULLSCREEN,
+ 0);
+}
+
+
/**
* gdk_window_set_group:
- * @window: a #GdkWindow
+ * @window: a toplevel #GdkWindow
* @leader: group leader window
*
* Sets the group leader window for @window. By default,
/**
* gdk_window_set_decorations:
- * @window: a #GdkWindow
+ * @window: a toplevel #GdkWindow
* @decorations: decoration hint mask
*
* "Decorations" are the features the window manager adds to a toplevel #GdkWindow.
/**
* gdk_window_get_decorations:
- * @window: The #GdkWindow to get the decorations from
+ * @window: The toplevel #GdkWindow to get the decorations from
* @decorations: The window decorations will be written here
*
* Returns the decorations set on the GdkWindow with #gdk_window_set_decorations
/**
* gdk_window_set_functions:
- * @window: a #GdkWindow
+ * @window: a toplevel #GdkWindow
* @functions: bitmask of operations to allow on @window
*
* This function isn't really good for much. It sets the traditional
GdkDisplay *display= gdk_x11_lookup_xdisplay (event->xany.display);
MoveResizeData *mv_resize = get_move_resize_data (display, FALSE);
- if (!mv_resize || mv_resize->moveresize_window)
+ if (!mv_resize || !mv_resize->moveresize_window)
return FALSE;
window_private = (GdkWindowObject *) mv_resize->moveresize_window;
mv_resize->resize_edge = edge;
mv_resize->moveresize_x = root_x;
mv_resize->moveresize_y = root_y;
- mv_resize->moveresize_window = GDK_WINDOW (g_object_ref (G_OBJECT (window)));
+ mv_resize->moveresize_window = g_object_ref (window);
- gdk_window_get_size (window,
- &mv_resize->moveresize_orig_width,
- &mv_resize->moveresize_orig_height);
+ gdk_drawable_get_size (window,
+ &mv_resize->moveresize_orig_width,
+ &mv_resize->moveresize_orig_height);
mv_resize->moveresize_geom_mask = 0;
gdk_window_get_geometry_hints (window,
mv_resize->moveresize_x = root_x;
mv_resize->moveresize_y = root_y;
- mv_resize->moveresize_window =
- GDK_WINDOW (g_object_ref (G_OBJECT (window)));
+ mv_resize->moveresize_window = g_object_ref (window);
gdk_window_get_deskrelative_origin (mv_resize->moveresize_window,
&mv_resize->moveresize_orig_x,
/**
* gdk_window_begin_resize_drag:
- * @window: a #GdkWindow
+ * @window: a toplevel #GdkWindow
* @edge: the edge or corner from which the drag is started
* @button: the button being used to drag
* @root_x: root window X coordinate of mouse click that began the drag
/**
* gdk_window_begin_move_drag:
- * @window: a #GdkWindow
+ * @window: a toplevel #GdkWindow
* @button: the button being used to drag
* @root_x: root window X coordinate of mouse click that began the drag
* @root_y: root window Y coordinate of mouse click that began the drag