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

📄 gdkwindow.c

📁 gtk是linux一款强大的夸平台的图形化开发工具
💻 C
📖 第 1 页 / 共 5 页
字号:
  gdk_window_ref (window);  gdk_xid_table_insert (&private->xwindow, window);    return window;}/* Call this function when you want a window and all its children to * disappear.  When xdestroy is true, a request to destroy the XWindow * is sent out.  When it is false, it is assumed that the XWindow has * been or will be destroyed by destroying some ancestor of this * window. */static voidgdk_window_internal_destroy (GdkWindow *window,			     gboolean   xdestroy,			     gboolean   our_destroy){  GdkWindowPrivate *private;  GdkWindowPrivate *temp_private;  GdkWindow *temp_window;  GList *children;  GList *tmp;    g_return_if_fail (window != NULL);    private = (GdkWindowPrivate*) window;    switch (private->window_type)    {    case GDK_WINDOW_TOPLEVEL:    case GDK_WINDOW_CHILD:    case GDK_WINDOW_DIALOG:    case GDK_WINDOW_TEMP:    case GDK_WINDOW_FOREIGN:      if (!private->destroyed)	{	  if (private->parent)	    {	      GdkWindowPrivate *parent_private = (GdkWindowPrivate *)private->parent;	      if (parent_private->children)		parent_private->children = g_list_remove (parent_private->children, window);	    }	  	  if (private->window_type != GDK_WINDOW_FOREIGN)	    {	      children = tmp = private->children;	      private->children = NULL;	      	      while (tmp)		{		  temp_window = tmp->data;		  tmp = tmp->next;		  		  temp_private = (GdkWindowPrivate*) temp_window;		  if (temp_private)		    gdk_window_internal_destroy (temp_window, FALSE,						 our_destroy);		}	      	      g_list_free (children);	    }	  	  if (private->extension_events != 0)	    gdk_input_window_destroy (window);	  	  if (private->filters)	    {	      tmp = private->filters;	      	      while (tmp)		{		  g_free (tmp->data);		  tmp = tmp->next;		}	      	      g_list_free (private->filters);	      private->filters = NULL;	    }	  	  if (private->window_type == GDK_WINDOW_FOREIGN)	    {	      if (our_destroy && (private->parent != NULL))		{		  /* It's somebody elses window, but in our heirarchy,		   * so reparent it to the root window, and then send		   * it a delete event, as if we were a WM		   */		  XClientMessageEvent xevent;		  gdk_error_trap_push ();		  gdk_window_hide (window);		  gdk_window_reparent (window, NULL, 0, 0);		  		  xevent.type = ClientMessage;		  xevent.window = private->xwindow;		  xevent.message_type = gdk_wm_protocols;		  xevent.format = 32;		  xevent.data.l[0] = gdk_wm_delete_window;		  xevent.data.l[1] = CurrentTime;		  XSendEvent (private->xdisplay, private->xwindow,			      False, 0, (XEvent *)&xevent);		  gdk_flush ();		  gdk_error_trap_pop ();		}	    }	  else if (xdestroy)	    XDestroyWindow (private->xdisplay, private->xwindow);	  	  if (private->colormap)	    gdk_colormap_unref (private->colormap);	  	  private->mapped = FALSE;	  private->destroyed = TRUE;	}      break;          case GDK_WINDOW_ROOT:      g_error ("attempted to destroy root window");      break;          case GDK_WINDOW_PIXMAP:      g_error ("called gdk_window_destroy on a pixmap (use gdk_pixmap_unref)");      break;    }}/* Like internal_destroy, but also destroys the reference created by   gdk_window_new. */voidgdk_window_destroy (GdkWindow *window){  gdk_window_internal_destroy (window, TRUE, TRUE);  gdk_window_unref (window);}/* This function is called when the XWindow is really gone.  */voidgdk_window_destroy_notify (GdkWindow *window){  GdkWindowPrivate *private;    g_return_if_fail (window != NULL);    private = (GdkWindowPrivate*) window;    if (!private->destroyed)    {      if (private->window_type != GDK_WINDOW_FOREIGN)	g_warning ("GdkWindow %#lx unexpectedly destroyed", private->xwindow);      gdk_window_internal_destroy (window, FALSE, FALSE);    }    gdk_xid_table_remove (private->xwindow);  gdk_window_unref (window);}GdkWindow*gdk_window_ref (GdkWindow *window){  GdkWindowPrivate *private = (GdkWindowPrivate *)window;  g_return_val_if_fail (window != NULL, NULL);    private->ref_count += 1;  return window;}voidgdk_window_unref (GdkWindow *window){  GdkWindowPrivate *private = (GdkWindowPrivate *)window;  g_return_if_fail (window != NULL);  g_return_if_fail (private->ref_count > 0);    private->ref_count -= 1;  if (private->ref_count == 0)    {      if (!private->destroyed)	{	  if (private->window_type == GDK_WINDOW_FOREIGN)	    gdk_xid_table_remove (private->xwindow);	  else	    g_warning ("losing last reference to undestroyed window\n");	}      g_dataset_destroy (window);      g_free (window);    }}voidgdk_window_show (GdkWindow *window){  GdkWindowPrivate *private;    g_return_if_fail (window != NULL);    private = (GdkWindowPrivate*) window;  if (!private->destroyed)    {      private->mapped = TRUE;      XRaiseWindow (private->xdisplay, private->xwindow);      XMapWindow (private->xdisplay, private->xwindow);    }}voidgdk_window_hide (GdkWindow *window){  GdkWindowPrivate *private;    g_return_if_fail (window != NULL);    private = (GdkWindowPrivate*) window;  if (!private->destroyed)    {      private->mapped = FALSE;      XUnmapWindow (private->xdisplay, private->xwindow);    }}voidgdk_window_withdraw (GdkWindow *window){  GdkWindowPrivate *private;    g_return_if_fail (window != NULL);    private = (GdkWindowPrivate*) window;  if (!private->destroyed)    XWithdrawWindow (private->xdisplay, private->xwindow, 0);}voidgdk_window_move (GdkWindow *window,		 gint       x,		 gint       y){  GdkWindowPrivate *private;    g_return_if_fail (window != NULL);    private = (GdkWindowPrivate*) window;  if (!private->destroyed)    {      XMoveWindow (private->xdisplay, private->xwindow, x, y);            if (private->window_type == GDK_WINDOW_CHILD)	{	  private->x = x;	  private->y = y;	}    }}voidgdk_window_resize (GdkWindow *window,		   gint       width,		   gint       height){  GdkWindowPrivate *private;    g_return_if_fail (window != NULL);    if (width < 1)    width = 1;  if (height < 1)    height = 1;    private = (GdkWindowPrivate*) window;    if (!private->destroyed &&      ((private->resize_count > 0) ||       (private->width != (guint16) width) ||       (private->height != (guint16) height)))    {      XResizeWindow (private->xdisplay, private->xwindow, width, height);      private->resize_count += 1;            if (private->window_type == GDK_WINDOW_CHILD)	{	  private->width = width;	  private->height = height;	}    }}voidgdk_window_move_resize (GdkWindow *window,			gint       x,			gint       y,			gint       width,			gint       height){  GdkWindowPrivate *private;    g_return_if_fail (window != NULL);    if (width < 1)    width = 1;  if (height < 1)    height = 1;    private = (GdkWindowPrivate*) window;  if (!private->destroyed)    {      XMoveResizeWindow (private->xdisplay, private->xwindow, x, y, width, height);            if (private->guffaw_gravity)	{	  GList *tmp_list = private->children;	  while (tmp_list)	    {	      GdkWindowPrivate *child_private = tmp_list->data;	      	      child_private->x -= x - private->x;	      child_private->y -= y - private->y;	      	      tmp_list = tmp_list->next;	    }	}            if (private->window_type == GDK_WINDOW_CHILD)	{	  private->x = x;	  private->y = y;	  private->width = width;	  private->height = height;	}    }}voidgdk_window_reparent (GdkWindow *window,		     GdkWindow *new_parent,		     gint       x,		     gint       y){  GdkWindowPrivate *window_private;  GdkWindowPrivate *parent_private;  GdkWindowPrivate *old_parent_private;    g_return_if_fail (window != NULL);    if (!new_parent)    new_parent = (GdkWindow*) &gdk_root_parent;    window_private = (GdkWindowPrivate*) window;  old_parent_private = (GdkWindowPrivate*)window_private->parent;  parent_private = (GdkWindowPrivate*) new_parent;    if (!window_private->destroyed && !parent_private->destroyed)    XReparentWindow (window_private->xdisplay,		     window_private->xwindow,		     parent_private->xwindow,		     x, y);    window_private->parent = new_parent;    if (old_parent_private)    old_parent_private->children = g_list_remove (old_parent_private->children, window);    if ((old_parent_private &&       (!old_parent_private->guffaw_gravity != !parent_private->guffaw_gravity)) ||      (!old_parent_private && parent_private->guffaw_gravity))    gdk_window_set_static_win_gravity (window, parent_private->guffaw_gravity);    parent_private->children = g_list_prepend (parent_private->children, window);}voidgdk_window_clear (GdkWindow *window){  GdkWindowPrivate *private;    g_return_if_fail (window != NULL);    private = (GdkWindowPrivate*) window;    if (!private->destroyed)    XClearWindow (private->xdisplay, private->xwindow);}voidgdk_window_clear_area (GdkWindow *window,		       gint       x,		       gint       y,		       gint       width,		       gint       height){  GdkWindowPrivate *private;    g_return_if_fail (window != NULL);    private = (GdkWindowPrivate*) window;    if (!private->destroyed)    XClearArea (private->xdisplay, private->xwindow,		x, y, width, height, False);}voidgdk_window_clear_area_e (GdkWindow *window,		         gint       x,		         gint       y,		         gint       width,		         gint       height){  GdkWindowPrivate *private;    g_return_if_fail (window != NULL);    private = (GdkWindowPrivate*) window;    if (!private->destroyed)    XClearArea (private->xdisplay, private->xwindow,		x, y, width, height, True);}voidgdk_window_copy_area (GdkWindow    *window,		      GdkGC        *gc,		      gint          x,		      gint          y,		      GdkWindow    *source_window,		      gint          source_x,		      gint          source_y,		      gint          width,		      gint          height){  GdkWindowPrivate *src_private;  GdkWindowPrivate *dest_private;  GdkGCPrivate *gc_private;    g_return_if_fail (window != NULL);  g_return_if_fail (gc != NULL);    if (source_window == NULL)    source_window = window;    src_private = (GdkWindowPrivate*) source_window;  dest_private = (GdkWindowPrivate*) window;  gc_private = (GdkGCPrivate*) gc;    if (!src_private->destroyed && !dest_private->destroyed)    {      XCopyArea (dest_private->xdisplay, src_private->xwindow, dest_private->xwindow,		 gc_private->xgc,		 source_x, source_y,		 width, height,		 x, y);    }}voidgdk_window_raise (GdkWindow *window){  GdkWindowPrivate *private;    g_return_if_fail (window != NULL);    private = (GdkWindowPrivate*) window;    if (!private->destroyed)    XRaiseWindow (private->xdisplay, private->xwindow);}voidgdk_window_lower (GdkWindow *window){  GdkWindowPrivate *private;    g_return_if_fail (window != NULL);    private = (GdkWindowPrivate*) window;    if (!private->destroyed)    XLowerWindow (private->xdisplay, private->xwindow);}voidgdk_window_set_user_data (GdkWindow *window,			  gpointer   user_data){  g_return_if_fail (window != NULL);    window->user_data = user_data;}voidgdk_window_set_hints (GdkWindow *window,		      gint       x,		      gint       y,		      gint       min_width,		      gint       min_height,		      gint       max_width,		      gint       max_height,		      gint       flags){  GdkWindowPrivate *private;  XSizeHints size_hints;    g_return_if_fail (window != NULL);    private = (GdkWindowPrivate*) window;  if (private->destroyed)    return;    size_hints.flags = 0;    if (flags & GDK_HINT_POS)    {      size_hints.flags |= PPosition;      size_hints.x = x;      size_hints.y = y;    }    if (flags & GDK_HINT_MIN_SIZE)    {      size_hints.flags |= PMinSize;      size_hints.min_width = min_width;      size_hints.min_height = min_height;    }    if (flags & GDK_HINT_MAX_SIZE)    {      size_hints.flags |= PMaxSize;      size_hints.max_width = max_width;      size_hints.max_height = max_height;    }    /* FIXME: Would it be better to delete this property of   *        flags == 0? It would save space on the server   */  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)

⌨️ 快捷键说明

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