⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gdkwindow-x11.c

📁 linux下电话本所依赖的一些图形库
💻 C
📖 第 1 页 / 共 5 页
字号:
  GdkToplevelX11 *toplevel;    g_return_if_fail (GDK_IS_WINDOW (window));    private = (GdkWindowObject*) window;  if (!private->destroyed)    {      GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (private->impl);      Display *xdisplay = GDK_WINDOW_XDISPLAY (window);      Window xwindow = GDK_WINDOW_XID (window);            if (raise)        XRaiseWindow (xdisplay, xwindow);      if (!GDK_WINDOW_IS_MAPPED (window))        {          set_initial_hints (window);                    gdk_synthesize_window_state (window,                                       GDK_WINDOW_STATE_WITHDRAWN,                                       0);        }            g_assert (GDK_WINDOW_IS_MAPPED (window));      if (WINDOW_IS_TOPLEVEL (window))	{	  display = gdk_drawable_get_display (window);	  display_x11 = GDK_DISPLAY_X11 (display);	  toplevel = _gdk_x11_window_get_toplevel (window);          if (toplevel->user_time != 0 &&	      display_x11->user_time != 0 &&	      XSERVER_TIME_IS_LATER (display_x11->user_time, toplevel->user_time))	    gdk_x11_window_set_user_time (window, display_x11->user_time);	}      if (impl->position_info.mapped)	{	  gboolean unset_bg = !private->input_only &&	    (private->window_type == GDK_WINDOW_CHILD ||	     impl->override_redirect) &&	    gdk_window_is_viewable (window);	  if (unset_bg)	    _gdk_x11_window_tmp_unset_bg (window, TRUE);	  	  XMapWindow (xdisplay, xwindow);	  if (unset_bg)	    {	      _gdk_x11_window_tmp_reset_bg (window, TRUE);	      gdk_window_invalidate_rect (window, NULL, TRUE);	    }	}    }}/** * gdk_window_show_unraised: * @window: a #GdkWindow * * Shows a #GdkWindow onscreen, but does not modify its stacking * order. In contrast, gdk_window_show() will raise the window * to the top of the window stack. * * On the X11 platform, in Xlib terms, this function calls * XMapWindow() (it also updates some internal GDK state, which means * that you can't really use XMapWindow() directly on a GDK window). *  **/voidgdk_window_show_unraised (GdkWindow *window){  g_return_if_fail (GDK_IS_WINDOW (window));    show_window_internal (window, FALSE);}/** * gdk_window_show: * @window: a #GdkWindow * * Like gdk_window_show_unraised(), but also raises the window to the * top of the window stack (moves the window to the front of the * Z-order). * * This function maps a window so it's visible onscreen. Its opposite * is gdk_window_hide(). * * When implementing a #GtkWidget, you should call this function on the widget's * #GdkWindow as part of the "map" method. *  **/voidgdk_window_show (GdkWindow *window){  g_return_if_fail (GDK_IS_WINDOW (window));  show_window_internal (window, TRUE);}static voidpre_unmap (GdkWindow *window){  GdkWindow *start_window = NULL;  GdkWindowObject *private = (GdkWindowObject *)window;  if (private->input_only)    return;  if (private->window_type == GDK_WINDOW_CHILD)    start_window = (GdkWindow *)private->parent;  else if (private->window_type == GDK_WINDOW_TEMP)    start_window = get_root (window);  if (start_window)    _gdk_x11_window_tmp_unset_bg (start_window, TRUE);}static voidpost_unmap (GdkWindow *window){  GdkWindow *start_window = NULL;  GdkWindowObject *private = (GdkWindowObject *)window;    if (private->input_only)    return;  if (private->window_type == GDK_WINDOW_CHILD)    start_window = (GdkWindow *)private->parent;  else if (private->window_type == GDK_WINDOW_TEMP)    start_window = get_root (window);  if (start_window)    {      _gdk_x11_window_tmp_reset_bg (start_window, TRUE);      if (private->window_type == GDK_WINDOW_CHILD && private->parent)	{	  GdkRectangle invalid_rect;      	  gdk_window_get_position (window, &invalid_rect.x, &invalid_rect.y);	  gdk_drawable_get_size (GDK_DRAWABLE (window),				 &invalid_rect.width, &invalid_rect.height);	  gdk_window_invalidate_rect ((GdkWindow *)private->parent,				      &invalid_rect, TRUE);	}    }}/** * gdk_window_hide: * @window: a #GdkWindow * * For toplevel windows, withdraws them, so they will no longer be * known to the window manager; for all windows, unmaps them, so * they won't be displayed. Normally done automatically as * part of gtk_widget_hide(). *  **/voidgdk_window_hide (GdkWindow *window){  GdkWindowObject *private;    g_return_if_fail (window != NULL);  private = (GdkWindowObject*) window;  /* We'll get the unmap notify eventually, and handle it then,   * but checking here makes things more consistent if we are   * just doing stuff ourself.   */  _gdk_xgrab_check_unmap (window,			  NextRequest (GDK_WINDOW_XDISPLAY (window)));  /* You can't simply unmap toplevel windows. */  switch (private->window_type)    {    case GDK_WINDOW_TOPLEVEL:    case GDK_WINDOW_DIALOG:    case GDK_WINDOW_TEMP: /* ? */      gdk_window_withdraw (window);      return;      break;          case GDK_WINDOW_FOREIGN:    case GDK_WINDOW_ROOT:    case GDK_WINDOW_CHILD:      break;    }    if (!private->destroyed)    {      if (GDK_WINDOW_IS_MAPPED (window))        gdk_synthesize_window_state (window,                                     0,                                     GDK_WINDOW_STATE_WITHDRAWN);      g_assert (!GDK_WINDOW_IS_MAPPED (window));            _gdk_window_clear_update_area (window);      pre_unmap (window);            XUnmapWindow (GDK_WINDOW_XDISPLAY (window),                    GDK_WINDOW_XID (window));      post_unmap (window);    }}/** * gdk_window_withdraw: * @window: a toplevel #GdkWindow *  * Withdraws a window (unmaps it and asks the window manager to forget about it). * This function is not really useful as gdk_window_hide() automatically * withdraws toplevel windows before hiding them. *  **/voidgdk_window_withdraw (GdkWindow *window){  GdkWindowObject *private;    g_return_if_fail (window != NULL);    private = (GdkWindowObject*) window;  if (!private->destroyed)    {      if (GDK_WINDOW_IS_MAPPED (window))        gdk_synthesize_window_state (window,                                     0,                                     GDK_WINDOW_STATE_WITHDRAWN);      g_assert (!GDK_WINDOW_IS_MAPPED (window));      pre_unmap (window);            XWithdrawWindow (GDK_WINDOW_XDISPLAY (window),                       GDK_WINDOW_XID (window), 0);      post_unmap (window);    }}/** * gdk_window_move: * @window: a #GdkWindow * @x: X coordinate relative to window's parent * @y: Y coordinate relative to window's parent * * Repositions a window relative to its parent window. * For toplevel windows, window managers may ignore or modify the move; * you should probably use gtk_window_move() on a #GtkWindow widget * anyway, instead of using GDK functions. For child windows, * the move will reliably succeed. * * 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. **/voidgdk_window_move (GdkWindow *window,		 gint       x,		 gint       y){  GdkWindowObject *private = (GdkWindowObject *)window;  GdkWindowImplX11 *impl;  g_return_if_fail (window != NULL);  g_return_if_fail (GDK_IS_WINDOW (window));  impl = GDK_WINDOW_IMPL_X11 (private->impl);	    if (!GDK_WINDOW_DESTROYED (window))    {      if (GDK_WINDOW_TYPE (private) == GDK_WINDOW_CHILD)	{	  _gdk_window_move_resize_child (window, x, y,					 impl->width, impl->height);	}      else	{	  XMoveWindow (GDK_WINDOW_XDISPLAY (window),		       GDK_WINDOW_XID (window),		       x, y);	  if (impl->override_redirect)	    {	      private->x = x;	      private->y = y;	    }	}    }}/** * gdk_window_resize: * @window: a #GdkWindow * @width: new width of the window * @height: new height of the window * * Resizes @window; for toplevel windows, asks the window manager to resize * the window. The window manager may not allow the resize. When using GTK+, * use gtk_window_resize() instead of this low-level GDK function. * * Windows may not be resized below 1x1. *  * 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. **/voidgdk_window_resize (GdkWindow *window,		   gint       width,		   gint       height){  GdkWindowObject *private;    g_return_if_fail (window != NULL);  g_return_if_fail (GDK_IS_WINDOW (window));    if (width < 1)    width = 1;  if (height < 1)    height = 1;  private = (GdkWindowObject*) window;    if (!GDK_WINDOW_DESTROYED (window))    {      if (GDK_WINDOW_TYPE (private) == GDK_WINDOW_CHILD)	{	  _gdk_window_move_resize_child (window, private->x, private->y,					 width, height);	}      else	{	  GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (private->impl);	  XResizeWindow (GDK_WINDOW_XDISPLAY (window),			 GDK_WINDOW_XID (window),			 width, height);	  if (impl->override_redirect)	    {	      impl->width = width;	      impl->height = height;	    }	  else	    {	      if (width != impl->width || height != impl->height)		private->resize_count += 1;	    }	}    }}/** * gdk_window_move_resize: * @window: a #GdkWindow * @x: new X position relative to window's parent * @y: new Y position relative to window's parent * @width: new width * @height: new height * * Equivalent to calling gdk_window_move() and gdk_window_resize(), * 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().) **/voidgdk_window_move_resize (GdkWindow *window,			gint       x,			gint       y,			gint       width,			gint       height){  GdkWindowObject *private;    g_return_if_fail (window != NULL);  g_return_if_fail (GDK_IS_WINDOW (window));  if (width < 1)    width = 1;  if (height < 1)    height = 1;    private = (GdkWindowObject*) window;  if (!GDK_WINDOW_DESTROYED (window))    {      if (GDK_WINDOW_TYPE (private) == GDK_WINDOW_CHILD)	{	  _gdk_window_move_resize_child (window, x, y, width, height);	}      else	{	  GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (private->impl);	  XMoveResizeWindow (GDK_WINDOW_XDISPLAY (window),			     GDK_WINDOW_XID (window),			     x, y, width, height);	  if (impl->override_redirect)	    {	      private->x = x;	      private->y = y;	      impl->width = width;	      impl->height = height;	    }	  else	    {	      if (width != impl->width || height != impl->height)		private->resize_count += 1;	    }	}    }}/** * gdk_window_reparent: * @window: a #GdkWindow * @new_parent: new parent to move @window into * @x: X location inside the new parent * @y: Y location inside the new parent * * Reparents @window into the given @new_parent. The window being * reparented will be unmapped as a side effect. *  **/voidgdk_window_reparent (GdkWindow *window,		     GdkWindow *new_parent,		     gint       x,		     gint       y){  GdkDisplay *display;  GdkWindowObject *window_private;  GdkWindowObject *parent_private;  GdkWindowObject *old_parent_private;  GdkWindowImplX11 *impl;  gboolean was_toplevel;    g_return_if_fail (window != NULL);  g_return_if_fail (GDK_IS_WINDOW (window));  g_return_if_fail (new_parent == NULL || GDK_IS_WINDOW (new_parent));  g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_ROOT);  if (GDK_WINDOW_DESTROYED (window) ||      (new_parent && GDK_WINDOW_DESTROYED (new_parent)))    {      return;    }    if (!new_parent)    new_parent = gdk_screen_get_root_window (GDK_WINDOW_SCREEN (window));  display = GDK_WINDOW_DISPLAY (window);    window_private = (GdkWindowObject*) window;  old_parent_private = (GdkWindowObject*)window_private->parent;  parent_private = (GdkWindowObject*) new_parent;  impl = GDK_WINDOW_IMPL_X11 (window_private->impl);    XReparentWindow (GDK_WINDOW_XDISPLAY (window),		   GDK_WINDOW_XID (window),		   GDK_WINDOW_XID (new_parent),

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -