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

📄 gdkwindow-win32.c

📁 linux下电话本所依赖的一些图形库
💻 C
📖 第 1 页 / 共 5 页
字号:
  impl->hint_flags = geom_mask;  impl->hints = *geometry;  if (geom_mask & GDK_HINT_POS)    ; /* even the X11 mplementation doesn't care */  if (geom_mask & GDK_HINT_MIN_SIZE)    {      GDK_NOTE (MISC, g_print ("... MIN_SIZE: %dx%d\n",			       geometry->min_width, geometry->min_height));#if 0      /* Check if the current size of the window is in bounds */      GetClientRect (GDK_WINDOW_HWND (window), &rect);      if (rect.right < geometry->min_width &&	  rect.bottom < geometry->min_height)	{	  new_width = geometry->min_width;	  new_height = geometry->min_height;	}      else if (rect.right < geometry->min_width)	{	  new_width = geometry->min_width;	  new_height = rect.bottom;	}      else if (rect.bottom < geometry->min_height)	{	  new_width = rect.right;	  new_height = geometry->min_height;	}#endif    }    if (geom_mask & GDK_HINT_MAX_SIZE)    {      GDK_NOTE (MISC, g_print ("... MAX_SIZE: %dx%d\n",			       geometry->max_width, geometry->max_height));#if 0      /* Check if the current size of the window is in bounds */      GetClientRect (GDK_WINDOW_HWND (window), &rect);      if (rect.right > geometry->max_width &&	  rect.bottom > geometry->max_height)	{	  new_width = geometry->max_width;	  new_height = geometry->max_height;	}      else if (rect.right > geometry->max_width)	{	  new_width = geometry->max_width;	  new_height = rect.bottom;	}      else if (rect.bottom > geometry->max_height)	{	  new_width = rect.right;	  new_height = geometry->max_height;	}#endif    }#if 0  /* Apply new size constraints */  if (new_width != 0 && new_height != 0)    gdk_window_resize (window, new_width, new_height);#endif  if (geom_mask & GDK_HINT_BASE_SIZE)    {      GDK_NOTE (MISC, g_print ("... BASE_SIZE: %dx%d\n",			       geometry->base_width, geometry->base_height));#if 0      size_hints.length = sizeof (size_hints);      if (API_CALL (GetWindowPlacement, (GDK_WINDOW_HWND (window), &size_hints)))	{	  GDK_NOTE (MISC,		    g_print ("... rcNormalPosition: (%ld,%ld)--(%ld,%ld)\n",			     size_hints.rcNormalPosition.left,			     size_hints.rcNormalPosition.top,			     size_hints.rcNormalPosition.right,			     size_hints.rcNormalPosition.bottom));	  size_hints.rcNormalPosition.right =	    size_hints.rcNormalPosition.left + geometry->base_width;	  size_hints.rcNormalPosition.bottom =	    size_hints.rcNormalPosition.top + geometry->base_height;	  GDK_NOTE (MISC, g_print ("...setting: rcNormal: (%ld,%ld)--(%ld,%ld)\n",				   size_hints.rcNormalPosition.left,				   size_hints.rcNormalPosition.top,				   size_hints.rcNormalPosition.right,				   size_hints.rcNormalPosition.bottom));	  API_CALL (SetWindowPlacement, (GDK_WINDOW_HWND (window), &size_hints));	}#endif    }    if (geom_mask & GDK_HINT_RESIZE_INC)    {      GDK_NOTE (MISC, g_print ("... RESIZE_INC: (%d,%d)\n",			       geometry->width_inc, geometry->height_inc));    }    if (geom_mask & GDK_HINT_ASPECT)    {      GDK_NOTE (MISC, g_print ("... ASPECT: %g--%g\n",			       geometry->min_aspect, geometry->max_aspect));    }  if (geom_mask & GDK_HINT_WIN_GRAVITY)    {      GDK_NOTE (MISC, g_print ("... GRAVITY: %d\n", geometry->win_gravity));    }}voidgdk_window_set_title (GdkWindow   *window,		      const gchar *title){  g_return_if_fail (GDK_IS_WINDOW (window));  g_return_if_fail (title != NULL);  if (GDK_WINDOW_DESTROYED (window))    return;  /* Empty window titles not allowed, so set it to just a period. */  if (!title[0])    title = ".";    GDK_NOTE (MISC, g_print ("gdk_window_set_title: %p: %s\n",			   GDK_WINDOW_HWND (window), title));    if (G_WIN32_HAVE_WIDECHAR_API ())    {      wchar_t *wtitle = g_utf8_to_utf16 (title, -1, NULL, NULL, NULL);      API_CALL (SetWindowTextW, (GDK_WINDOW_HWND (window), wtitle));      g_free (wtitle);    }  else    {      char *cptitle = g_locale_from_utf8 (title, -1, NULL, NULL, NULL);      API_CALL (SetWindowTextA, (GDK_WINDOW_HWND (window), cptitle));      g_free (cptitle);    }}void          gdk_window_set_role (GdkWindow   *window,		     const gchar *role){  g_return_if_fail (window != NULL);  g_return_if_fail (GDK_IS_WINDOW (window));    GDK_NOTE (MISC, g_print ("gdk_window_set_role: %p: %s\n",			   GDK_WINDOW_HWND (window),			   (role ? role : "NULL")));  /* XXX */}void          gdk_window_set_transient_for (GdkWindow *window, 			      GdkWindow *parent){  HWND window_id, parent_id;  g_return_if_fail (window != NULL);  g_return_if_fail (GDK_IS_WINDOW (window));    GDK_NOTE (MISC, g_print ("gdk_window_set_transient_for: %p: %p\n",			   GDK_WINDOW_HWND (window),			   GDK_WINDOW_HWND (parent)));  if (GDK_WINDOW_DESTROYED (window) || GDK_WINDOW_DESTROYED (parent))    return;  if (((GdkWindowObject *) window)->window_type == GDK_WINDOW_CHILD)    {      GDK_NOTE (MISC, g_print ("...a child window!\n"));      return;    }    window_id = GDK_WINDOW_HWND (window);  parent_id = GDK_WINDOW_HWND (parent);  /* This changes the *owner* of the window, despite the misleading   * name. (Owner and parent are unrelated concepts.) At least that's   * what people who seem to know what they talk about say on   * USENET. Search on Google.   */  SetLastError (0);  if (SetWindowLong (window_id, GWL_HWNDPARENT, (long) parent_id) == 0 &&      GetLastError () != 0)    WIN32_API_FAILED ("SetWindowLong");}voidgdk_window_set_background (GdkWindow      *window,			   const GdkColor *color){  GdkWindowObject *private = (GdkWindowObject *)window;    g_return_if_fail (window != NULL);  g_return_if_fail (GDK_IS_WINDOW (window));    GDK_NOTE (MISC, g_print ("gdk_window_set_background: %p: %s\n",			   GDK_WINDOW_HWND (window), 			   _gdk_win32_color_to_string (color)));  private->bg_color = *color;  if (private->bg_pixmap &&      private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&      private->bg_pixmap != GDK_NO_BG)    {      g_object_unref (private->bg_pixmap);      private->bg_pixmap = NULL;    }}voidgdk_window_set_back_pixmap (GdkWindow *window,			    GdkPixmap *pixmap,			    gint       parent_relative){  GdkWindowObject *private = (GdkWindowObject *)window;  g_return_if_fail (window != NULL);  g_return_if_fail (GDK_IS_WINDOW (window));  g_return_if_fail (pixmap == NULL || !parent_relative);  g_return_if_fail (pixmap == NULL || gdk_drawable_get_depth (window) == gdk_drawable_get_depth (pixmap));    if (private->bg_pixmap &&      private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&      private->bg_pixmap != GDK_NO_BG)    g_object_unref (private->bg_pixmap);  if (parent_relative)    {      private->bg_pixmap = GDK_PARENT_RELATIVE_BG;      GDK_NOTE (MISC, g_print (G_STRLOC ": setting background pixmap to parent_relative\n"));    }  else    {      if (pixmap)	{	  g_object_ref (pixmap);	  private->bg_pixmap = pixmap;	}      else	{	  private->bg_pixmap = GDK_NO_BG;	}    }}voidgdk_window_set_cursor (GdkWindow *window,		       GdkCursor *cursor){  GdkWindowImplWin32 *impl;  GdkCursorPrivate *cursor_private;  GdkWindowObject *parent_window;  HCURSOR hcursor;  HCURSOR hprevcursor;    g_return_if_fail (window != NULL);  g_return_if_fail (GDK_IS_WINDOW (window));    impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);  cursor_private = (GdkCursorPrivate*) cursor;    if (GDK_WINDOW_DESTROYED (window))    return;  if (!cursor)    hcursor = NULL;  else    hcursor = cursor_private->hcursor;    GDK_NOTE (MISC, g_print ("gdk_window_set_cursor: %p: %p\n",			   GDK_WINDOW_HWND (window),			   hcursor));  /* First get the old cursor, if any (we wait to free the old one   * since it may be the current cursor set in the Win32 API right   * now).   */  hprevcursor = impl->hcursor;  if (hcursor == NULL)    impl->hcursor = NULL;  else    {      /* We must copy the cursor as it is OK to destroy the GdkCursor       * while still in use for some window. See for instance       * gimp_change_win_cursor() which calls gdk_window_set_cursor       * (win, cursor), and immediately afterwards gdk_cursor_destroy       * (cursor).       */      if ((impl->hcursor = CopyCursor (hcursor)) == NULL)	WIN32_API_FAILED ("CopyCursor");      GDK_NOTE (MISC, g_print ("...CopyCursor (%p) = %p\n",			       hcursor, impl->hcursor));    }  if (impl->hcursor != NULL)    {      /* If the pointer is over our window, set new cursor */      GdkWindow *curr_window = gdk_window_get_pointer (window, NULL, NULL, NULL);      if (curr_window == window)        SetCursor (impl->hcursor);      else	{	  /* Climb up the tree and find whether our window is the	   * first ancestor that has cursor defined, and if so, set	   * new cursor.	   */	  GdkWindowObject *curr_window_obj = GDK_WINDOW_OBJECT (curr_window);	  while (curr_window_obj &&		 !GDK_WINDOW_IMPL_WIN32 (curr_window_obj->impl)->hcursor)	    {	      curr_window_obj = curr_window_obj->parent;	      if (curr_window_obj == GDK_WINDOW_OBJECT (window))		{	          SetCursor (impl->hcursor);		  break;		}	    }	}    }  /* Destroy the previous cursor: Need to make sure it's no longer in   * use before we destroy it, in case we're not over our window but   * the cursor is still set to our old one.   */  if (hprevcursor != NULL)    {      if (GetCursor() == hprevcursor)	{	  /* Look for a suitable cursor to use instead */	  hcursor = NULL;          parent_window = GDK_WINDOW_OBJECT (window)->parent;          while (hcursor == NULL)	    {	      if (parent_window)		{		  impl = GDK_WINDOW_IMPL_WIN32 (parent_window->impl);		  hcursor = impl->hcursor;		  parent_window = parent_window->parent;		}	      else		{		  hcursor = LoadCursor (NULL, IDC_ARROW);		}	    }          SetCursor (hcursor);        }      GDK_NOTE (MISC, g_print ("...DestroyCursor (%p)\n",			       hprevcursor));            API_CALL (DestroyCursor, (hprevcursor));    }}voidgdk_window_get_geometry (GdkWindow *window,			 gint      *x,			 gint      *y,			 gint      *width,			 gint      *height,			 gint      *depth){  g_return_if_fail (window == NULL || GDK_IS_WINDOW (window));    if (!window)    window = _gdk_parent_root;    if (!GDK_WINDOW_DESTROYED (window))    {      RECT rect;      API_CALL (GetClientRect, (GDK_WINDOW_HWND (window), &rect));      if (window != _gdk_parent_root)	{	  POINT pt;	  GdkWindow *parent = gdk_window_get_parent (window);	  pt.x = rect.left;	  pt.y = rect.top;	  ClientToScreen (GDK_WINDOW_HWND (window), &pt);	  ScreenToClient (GDK_WINDOW_HWND (parent), &pt);	  rect.left = pt.x;	  rect.top = pt.y;	  pt.x = rect.right;	  pt.y = rect.bottom;	  ClientToScreen (GDK_WINDOW_HWND (window), &pt);	  ScreenToClient (GDK_WINDOW_HWND (parent), &pt);	  rect.right = pt.x;	  rect.bottom = pt.y;	  if (parent == _gdk_parent_root)	    {	      rect.left += _gdk_offset_x;	      rect.top += _gdk_offset_y;	      rect.right += _gdk_offset_x;	      rect.bottom += _gdk_offset_y;	    }	}      if (x)	*x = rect.left;      if (y)	*y = rect.top;      if (width)	*width = rect.right - rect.left;      if (height)	*height = rect.bottom - rect.top;      if (depth)	*depth = gdk_drawable_get_visual (window)->depth;      GDK_NOTE (MISC, g_print ("gdk_window_get_geometry: %p: %ldx%ldx%d@+%ld+%ld\n",			       GDK_WINDOW_HWND (window),			       rect.right - rect.left, rect.bottom - rect.top,			       gdk_drawable_get_visual (window)->depth,			       rect.left, rect.top));    }}gintgdk_window_get_origin (GdkWindow *window,		       gint      *x,		       gint      *y){  gint return_val;  gint tx = 0;  gint ty = 0;  g_return_val_if_fail (window != NULL, 0);  if (!GDK_WINDOW_DESTROYED (window))    {      POINT pt;      pt.x = 0;      pt.y = 0;      ClientToScreen (GDK_WINDOW_HWND (window), &pt);      tx = pt.x;      ty = pt.y;      return_val = 1;    }  else    return_val = 0;    if (x)    *x = tx + _gdk_offset_x;  if (y)    *y = ty + _gdk_offset_y;  GDK_NOTE (MISC, g_print ("gdk_window_get_origin: %p: +%d+%d\n",			   GDK_WINDOW_HWND (window),			   tx, ty));  return return_val;}gbooleangdk_window_get_deskrelative_origin (GdkWindow *window,				    gint      *x,				    gint      *y){  return gdk_window_get_origin (window, x, y);}voidgdk_window_get_root_origin (GdkWindow *window,			    gint      *x,			    gint      *y){  GdkRectangle rect;  g_return_if_fail (GDK_IS_WINDOW (window));  gdk_window_get_frame_extents (window, &rect);  if (x)    *x = rect.x;  if (y)

⌨️ 快捷键说明

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