gtk+ r22577 - in trunk: . modules/engines/ms-windows
- From: bratsche svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r22577 - in trunk: . modules/engines/ms-windows
- Date: Sat, 21 Mar 2009 13:58:12 +0000 (UTC)
Author: bratsche
Date: Sat Mar 21 13:58:12 2009
New Revision: 22577
URL: http://svn.gnome.org/viewvc/gtk+?rev=22577&view=rev
Log:
2009-03-21 Cody Russell <bratsche gnome org>
Bug 538840 â [Win32] GTK menu theming could be improved
* modules/engines/ms-windows/xp_theme.c
* modules/engines/ms-windows/msw_style.c: Use newer
menu styling API. This makes gtk+ look much better on
Windows Vista.
Modified:
trunk/ChangeLog
trunk/modules/engines/ms-windows/msw_style.c
trunk/modules/engines/ms-windows/xp_theme.c
Modified: trunk/modules/engines/ms-windows/msw_style.c
==============================================================================
--- trunk/modules/engines/ms-windows/msw_style.c (original)
+++ trunk/modules/engines/ms-windows/msw_style.c Sat Mar 21 13:58:12 2009
@@ -536,29 +536,42 @@
for now */
#define XP_THEME_CLASS_TEXT XP_THEME_CLASS_BUTTON
+#define WIN95_VERSION 0x400
+#define WIN2K_VERSION 0x500
+#define WINXP_VERSION 0x501
+#define WIN2K3_VERSION 0x502
+#define VISTA_VERSION 0x600
+
+static gint32
+get_windows_version ()
+{
+ static gint32 version = 0;
+ static gboolean have_version = FALSE;
+
+ if (!have_version)
+ {
+ have_version = TRUE;
+ OSVERSIONINFOEX osvi;
+
+ ZeroMemory (&osvi, sizeof (OSVERSIONINFOEX));
+ osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
+
+ GetVersionEx((OSVERSIONINFO*) &osvi);
+
+ version = (osvi.dwMajorVersion & 0xff) << 8 | (osvi.dwMinorVersion & 0xff);
+ }
+
+ return version;
+}
+
static void
setup_menu_settings (GtkSettings *settings)
{
int menu_delay;
- gboolean win95 = FALSE;
OSVERSIONINFOEX osvi;
GObjectClass *klazz = G_OBJECT_GET_CLASS (G_OBJECT (settings));
- ZeroMemory (&osvi, sizeof (OSVERSIONINFOEX));
- osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
-
- if (!GetVersionEx ((OSVERSIONINFO *) & osvi))
- win95 = TRUE; /* assume the worst */
-
- if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
- {
- if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
- {
- win95 = TRUE;
- }
- }
-
- if (!win95)
+ if (get_windows_version () > WIN95_VERSION)
{
if (SystemParametersInfo (SPI_GETMENUSHOWDELAY, 0, &menu_delay, 0))
{
@@ -685,7 +698,8 @@
GdkColor text_prelight;
/* Prelight */
- sys_color_to_gtk_color (XP_THEME_CLASS_TEXT, COLOR_HIGHLIGHTTEXT,
+ sys_color_to_gtk_color (XP_THEME_CLASS_TEXT,
+ get_windows_version () == VISTA_VERSION ? COLOR_MENUTEXT : COLOR_HIGHLIGHTTEXT,
&fg_prelight);
sys_color_to_gtk_color (XP_THEME_CLASS_TEXT, COLOR_HIGHLIGHT, &bg_prelight);
sys_color_to_gtk_color (XP_THEME_CLASS_TEXT, COLOR_HIGHLIGHT,
@@ -1810,6 +1824,12 @@
HDC dc;
RECT rect;
+ if (xp_theme_is_active ())
+ {
+ return (xp_theme_draw (window, XP_THEME_ELEMENT_MENU_ITEM, style,
+ x, y, width, height, state_type, area));
+ }
+
if ((parent = gtk_widget_get_parent (widget))
&& GTK_IS_MENU_BAR (parent) && !xp_theme_is_active ())
{
@@ -2964,7 +2984,7 @@
if (detail && !strcmp (detail, "frame"))
{
-
+
HDC dc;
RECT rect;
@@ -3079,7 +3099,7 @@
{
pos = gtk_handle_box_get_handle_position (GTK_HANDLE_BOX (widget));
/*
- If the handle box is at left side,
+ If the handle box is at left side,
we shouldn't draw its right border.
The same holds true for top, right, and bottom.
*/
Modified: trunk/modules/engines/ms-windows/xp_theme.c
==============================================================================
--- trunk/modules/engines/ms-windows/xp_theme.c (original)
+++ trunk/modules/engines/ms-windows/xp_theme.c Sat Mar 21 13:58:12 2009
@@ -79,6 +79,16 @@
#define TRS_NORMAL 1
+#define MBI_NORMAL 1
+#define MBI_HOT 2
+#define MBI_PUSHED 3
+#define MBI_DISABLED 4
+#define MBI_DISABLEDHOT 5
+#define MBI_DISABLEDPUSHED 6
+
+#define MENU_POPUPITEM 14
+#define MENU_POPUPSEPARATOR 15
+
static const LPCWSTR class_descriptors[] = {
L"Scrollbar", /* XP_THEME_CLASS_SCROLLBAR */
L"Button", /* XP_THEME_CLASS_BUTTON */
@@ -139,8 +149,8 @@
RP_GRIPPERVERT,
RP_CHEVRON,
TP_BUTTON,
- MP_MENUITEM,
- MP_SEPARATOR,
+ MENU_POPUPITEM, /*MP_MENUITEM,*/
+ MENU_POPUPSEPARATOR, /*MP_SEPARATOR,*/
SP_GRIPPER,
SP_PANE,
GP_LINEHORZ,
@@ -780,12 +790,16 @@
ret = MS_SELECTED;
break;
+ case GTK_STATE_PRELIGHT:
+ ret = MBI_HOT;
+ break;
+
case GTK_STATE_INSENSITIVE:
- ret = MS_DEMOTED;
+ ret = MBI_DISABLED;
break;
default:
- ret = MS_NORMAL;
+ ret = MBI_NORMAL;
}
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]