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

📄 gdkproperty-win32.c

📁 linux下电话本所依赖的一些图形库
💻 C
📖 第 1 页 / 共 2 页
字号:
		if (data[i] == '\n')		  size++;	      size++;	      GDK_NOTE (DND, g_print ("...as text: %.40s\n", data));	    }	  else if (G_WIN32_IS_NT_BASED ())	    {	      /* On NT, use CF_UNICODETEXT if any non-system codepage	       * char present.	       */	      method = UNICODE_TEXT;	      wcptr = g_utf8_to_utf16 (data, nelements, NULL, &wclen, NULL);	      wclen++;		/* Terminating 0 */	      size = wclen * 2;	      GDK_NOTE (DND, g_print ("...as Unicode\n"));	    }	  else if (find_common_locale (data, nelements, nchars, &lcid, &buf, &size))	    {	      /* On Win9x, if all chars are in the default code page	       * of some installed locale, use CF_TEXT and CF_LOCALE.	       */	      method = SINGLE_LOCALE;	      GDK_NOTE (DND, g_print ("...as text in locale %#lx %d bytes\n",				      (gulong) lcid, size));	    }	  else	    {	      /* On Win9x, otherwise use RTF */	      const guchar *p = data;	      method = RICH_TEXT;	      rtf = g_string_new ("{\\rtf1\\uc0 ");	      while (p < data + nelements)		{		  if (*p == '{' ||		      *p == '\\' ||		      *p == '}')		    {		      rtf = g_string_append_c (rtf, '\\');		      rtf = g_string_append_c (rtf, *p);		      p++;		    }		  else if (*p < 0200 && *p >= ' ')		    {		      rtf = g_string_append_c (rtf, *p);		      p++;		    }		  else		    {		      guchar *q;		      gint n;		      		      rtf = g_string_append (rtf, "\\uNNNNN ");		      rtf->len -= 6; /* five digits and a space */		      q = rtf->str + rtf->len;		      n = g_sprintf (q, "%d ", g_utf8_get_char (p));		      g_assert (n <= 6);		      rtf->len += n;		      		      p = g_utf8_next_char (p);		    }		}	      rtf = g_string_append (rtf, "}");	      size = rtf->len + 1;	      GDK_NOTE (DND, g_print ("...as RTF: %.40s\n", rtf->str));	    }	      	  if (!(hdata = GlobalAlloc (GMEM_MOVEABLE, size)))	    {	      WIN32_API_FAILED ("GlobalAlloc");	      if (!CloseClipboard ())		WIN32_API_FAILED ("CloseClipboard");	      if (buf != NULL)		g_free (buf);	      if (rtf != NULL)		g_string_free (rtf, TRUE);	      return;	    }	  ucptr = GlobalLock (hdata);	  switch (method)	    {	    case SYSTEM_CODEPAGE:	      cf = CF_TEXT;	      for (i = 0; i < nelements; i++)		{		  if (data[i] == '\n')		    *ucptr++ = '\r';		  *ucptr++ = data[i];		}	      *ucptr++ = '\0';	      break;	    case UNICODE_TEXT:	      cf = CF_UNICODETEXT;	      memmove (ucptr, wcptr, size);	      g_free (wcptr);	      break;	    case SINGLE_LOCALE:	      cf = CF_TEXT;	      memmove (ucptr, buf, size);	      g_free (buf);	      /* Set the CF_LOCALE clipboard data, too */	      if (!(hlcid = GlobalAlloc (GMEM_MOVEABLE, sizeof (LCID))))		WIN32_API_FAILED ("GlobalAlloc"), ok = FALSE;	      if (ok)		{		  lcidptr = GlobalLock (hlcid);		  *lcidptr = lcid;		  GlobalUnlock (hlcid);		  if (!SetClipboardData (CF_LOCALE, hlcid))		    WIN32_API_FAILED ("SetClipboardData (CF_LOCALE)"), ok = FALSE;		}	      break;	    case RICH_TEXT:	      cf = _cf_rtf;	      memmove (ucptr, rtf->str, size);	      g_string_free (rtf, TRUE);	      /* Set the UTF8_STRING clipboard data, too, for other	       * GTK+ apps to use (won't bother reading RTF).	       */	      if (!(hutf8 = GlobalAlloc (GMEM_MOVEABLE, nelements)))		WIN32_API_FAILED ("GlobalAlloc");	      else		{		  guchar *utf8ptr = GlobalLock (hutf8);		  memmove (utf8ptr, data, nelements);		  GlobalUnlock (hutf8);		  if (!SetClipboardData (_cf_utf8_string, hutf8))		    WIN32_API_FAILED ("SetClipboardData (UTF8_STRING)");		}	      break;	    default:	      g_assert_not_reached ();	    }	  GlobalUnlock (hdata);	  if (ok && !SetClipboardData (cf, hdata))	    WIN32_API_FAILED ("SetClipboardData"), ok = FALSE;	  if (!CloseClipboard ())	    WIN32_API_FAILED ("CloseClipboard");	}      else        {	  /* Delayed Rendering. We can't assign hdata to the clipboard	   * here as type may be "image/png", "image/jpg", etc.  In	   * this case there's a further conversion afterwards.	   */	  _delayed_rendering_data = NULL;	  if (!(hdata = GlobalAlloc (GMEM_MOVEABLE, nelements > 0 ? nelements : 1)))	    {	      WIN32_API_FAILED ("GlobalAlloc");	      return;	    }	  ucptr = GlobalLock (hdata);	  memcpy (ucptr, data, nelements);	  GlobalUnlock (hdata);	  _delayed_rendering_data = hdata;	}    }  else    g_warning ("gdk_property_change: General case not implemented");}voidgdk_property_delete (GdkWindow *window,		     GdkAtom    property){  gchar *prop_name;  g_return_if_fail (window != NULL);  g_return_if_fail (GDK_IS_WINDOW (window));  GDK_NOTE (DND,	    (prop_name = gdk_atom_name (property),	     g_print ("gdk_property_delete: %p %#x (%s)\n",		      GDK_WINDOW_HWND (window),		      (guint) property, prop_name),	     g_free (prop_name)));  if (property == _gdk_selection_property)    _gdk_selection_property_delete (window);  else if (property == _wm_transient_for)    gdk_window_set_transient_for (window, _gdk_parent_root);  else    {      prop_name = gdk_atom_name (property);      g_warning ("gdk_property_delete: General case (%s) not implemented",		 prop_name);      g_free (prop_name);    }}/*  for reference copied from gdk/x11/gdkevents-x11.c  { "Net/DoubleClickTime", "gtk-double-click-time" },  { "Net/DoubleClickDistance", "gtk-double-click-distance" },  { "Net/DndDragThreshold", "gtk-dnd-drag-threshold" },  { "Gtk/CanChangeAccels", "gtk-can-change-accels" },  { "Gtk/ColorPalette", "gtk-color-palette" },  { "Gtk/FontName", "gtk-font-name" },  { "Gtk/IconSizes", "gtk-icon-sizes" },  { "Gtk/KeyThemeName", "gtk-key-theme-name" },  { "Gtk/ToolbarStyle", "gtk-toolbar-style" },  { "Gtk/ToolbarIconSize", "gtk-toolbar-icon-size" },  { "Gtk/IMPreeditStyle", "gtk-im-preedit-style" },  { "Gtk/IMStatusStyle", "gtk-im-status-style" },  { "Net/CursorBlink", "gtk-cursor-blink" },  { "Net/CursorBlinkTime", "gtk-cursor-blink-time" },  { "Net/ThemeName", "gtk-theme-name" },  { "Net/IconThemeName", "gtk-icon-theme-name" },  { "Gtk/ButtonImages", "gtk-button-images" },  { "Gtk/MenuImages", "gtk-menu-images" },  { "Xft/Antialias", "gtk-xft-antialias" },  { "Xft/Hinting", "gtk-xft-hinting" },  { "Xft/HintStyle", "gtk-xft-hintstyle" },  { "Xft/RGBA", "gtk-xft-rgba" },  { "Xft/DPI", "gtk-xft-dpi" },  // more spread in gtk sources  gtk-entry-select-on-focus  gtk-cursor-blink  gtk-cursor-blink-time  gtk-split-cursor*/gbooleangdk_screen_get_setting (GdkScreen   *screen,                        const gchar *name,                        GValue      *value){  g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);  /*   * XXX : if these values get changed through the Windoze UI the   *       respective gdk_events are not generated yet.   */  if (strcmp ("gtk-theme-name", name) == 0)     {      g_value_set_string (value, "ms-windows");    }  else if (strcmp ("gtk-double-click-time", name) == 0)    {      gint i = GetDoubleClickTime ();      GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : %d\n", name, i));      g_value_set_int (value, i);      return TRUE;    }  else if (strcmp ("gtk-double-click-distance", name) == 0)    {      gint i = MAX(GetSystemMetrics (SM_CXDOUBLECLK), GetSystemMetrics (SM_CYDOUBLECLK));      GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : %d\n", name, i));      g_value_set_int (value, i);      return TRUE;    }  else if (strcmp ("gtk-dnd-drag-threshold", name) == 0)    {      gint i = MAX(GetSystemMetrics (SM_CXDRAG), GetSystemMetrics (SM_CYDRAG));      GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : %d\n", name, i));      g_value_set_int (value, i);      return TRUE;    }  else if (strcmp ("gtk-split-cursor", name) == 0)    {      GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : FALSE\n", name));      g_value_set_boolean (value, FALSE);      return TRUE;    }#if 0  /*   * With 'MS Sans Serif' as windows menu font (default on win98se) you'll get a    * bunch of :   *   WARNING **: Couldn't load font "MS Sans Serif 8" falling back to "Sans 8"   * at least with testfilechooser (regardless of the bitmap check below)   * so just disabling this code seems to be the best we can do --hb   */  else if (strcmp ("gtk-font-name", name) == 0)    {      NONCLIENTMETRICS ncm;      ncm.cbSize = sizeof(NONCLIENTMETRICS);      if (SystemParametersInfo (SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, FALSE))        {          /* Pango finally uses GetDeviceCaps to scale, we use simple	   * approximation here.	   */          int nHeight = (0 > ncm.lfMenuFont.lfHeight ? -3*ncm.lfMenuFont.lfHeight/4 : 10);          if (OUT_STRING_PRECIS == ncm.lfMenuFont.lfOutPrecision)            GDK_NOTE(MISC, g_print("gdk_screen_get_setting(%s) : ignoring bitmap font '%s'\n",                                    name, ncm.lfMenuFont.lfFaceName));          else if (ncm.lfMenuFont.lfFaceName && strlen(ncm.lfMenuFont.lfFaceName) > 0 &&                   /* Avoid issues like those described in bug #135098 */                   g_utf8_validate (ncm.lfMenuFont.lfFaceName, -1, NULL))            {              char* s = g_strdup_printf ("%s %d", ncm.lfMenuFont.lfFaceName, nHeight);              GDK_NOTE(MISC, g_print("gdk_screen_get_setting(%s) : %s\n", name, s));              g_value_set_string (value, s);              g_free(s);              return TRUE;            }        }    }#endif  GDK_NOTE(MISC, g_print("gdk_screen_get_setting(%s) not handled\n", name));  return FALSE;}

⌨️ 快捷键说明

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