]> Pileus Git - ~andy/gtk/blobdiff - gdk/x11/gdkwindow-x11.c
docs/reference/gtk/tmpl/gtkfontseldlg.sgml, gdk/gdkwindow.c,
[~andy/gtk] / gdk / x11 / gdkwindow-x11.c
index 1d9689c039ccda9ea823575467e089bba2ba8086..221f97d4eec4b13c28cfe7c593aac2ac6b6c2acd 100644 (file)
@@ -133,7 +133,7 @@ _gdk_window_impl_get_type (void)
 
 static void
 gdk_window_impl_x11_init (GdkWindowImplX11 *impl)
-{
+{  
   impl->width = 1;
   impl->height = 1;
 }
@@ -313,6 +313,8 @@ _gdk_windowing_window_init (GdkScreen * screen)
   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);
@@ -827,8 +829,13 @@ _gdk_windowing_window_destroy (GdkWindow *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 */  
 
@@ -900,7 +907,7 @@ static void
 set_initial_hints (GdkWindow *window)
 {
   GdkWindowObject *private;
-  Atom atoms[5];
+  Atom atoms[6];
   gint i;
   
   private = (GdkWindowObject*) window;
@@ -946,6 +953,13 @@ set_initial_hints (GdkWindow *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),
@@ -1112,7 +1126,8 @@ gdk_window_hide (GdkWindow *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
@@ -1151,7 +1166,6 @@ gdk_window_withdraw (GdkWindow *window)
  *
  * 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,
@@ -1194,7 +1208,6 @@ 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,
@@ -1244,7 +1257,6 @@ 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,
@@ -1411,6 +1423,8 @@ _gdk_windowing_window_clear_area_e (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.
@@ -1432,6 +1446,8 @@ gdk_window_raise (GdkWindow *window)
  * 
  * 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.
@@ -1574,7 +1590,7 @@ gdk_window_set_hints (GdkWindow *window,
 
 /**
  * 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
@@ -1610,6 +1626,18 @@ gdk_window_set_type_hint (GdkWindow        *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_SPLASHSCREEN");
+      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 */
@@ -1655,7 +1683,7 @@ gdk_wmspec_change_state (gboolean   add,
 
 /**
  * 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
@@ -1688,16 +1716,107 @@ gdk_window_set_modal_hint (GdkWindow *window,
                             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_taskbar: %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,
@@ -1925,7 +2044,7 @@ set_text_property (GdkWindow   *window,
 
 /**
  * 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.
@@ -1973,7 +2092,7 @@ gdk_window_set_title (GdkWindow   *window,
 
 /**
  * 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
@@ -2302,7 +2421,7 @@ gdk_window_get_origin (GdkWindow *window,
 
 /**
  * gdk_window_get_deskrelative_origin:
- * @window: a #GdkWindow
+ * @window: a toplevel #GdkWindow
  * @x: return location for X coordinate
  * @y: return location for Y coordinate
  * 
@@ -2382,7 +2501,7 @@ gdk_window_get_deskrelative_origin (GdkWindow *window,
 
 /**
  * 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
  *
@@ -2410,7 +2529,7 @@ gdk_window_get_root_origin (GdkWindow *window,
 
 /**
  * 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
@@ -2721,6 +2840,8 @@ gdk_window_have_shape_ext (GdkDisplay *display)
  * 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
@@ -2789,6 +2910,8 @@ gdk_window_shape_combine_mask (GdkWindow *window,
  * 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
@@ -2845,7 +2968,7 @@ gdk_window_shape_combine_region (GdkWindow *window,
 
 /**
  * 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.
@@ -2990,7 +3113,7 @@ gdk_window_set_icon_list (GdkWindow *window,
 
 /**
  * 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
@@ -3053,7 +3176,7 @@ gdk_window_icon_name_set (GdkWindow *window)
 
 /**
  * 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
@@ -3092,12 +3215,14 @@ gdk_window_set_icon_name (GdkWindow   *window,
 
 /**
  * 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)
@@ -3129,14 +3254,14 @@ 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)
@@ -3295,15 +3420,19 @@ gdk_window_unstick (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
@@ -3326,15 +3455,19 @@ gdk_window_maximize (GdkWindow *window)
 
 /**
  * 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
@@ -3355,9 +3488,83 @@ gdk_window_unmaximize (GdkWindow *window)
                                 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,
@@ -3480,7 +3687,7 @@ gdk_window_set_mwm_hints (GdkWindow *window,
 
 /**
  * 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.
@@ -3516,7 +3723,7 @@ gdk_window_set_decorations (GdkWindow      *window,
 
 /**
  * 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
@@ -3550,7 +3757,7 @@ gdk_window_get_decorations(GdkWindow       *window,
 
 /**
  * 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
@@ -4531,7 +4738,7 @@ emulate_move_drag (GdkWindow     *window,
 
 /**
  * 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
@@ -4568,7 +4775,7 @@ gdk_window_begin_resize_drag (GdkWindow     *window,
 
 /**
  * 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