Commit 5411a3a1 authored by Dom Lachowicz's avatar Dom Lachowicz Committed by Dom Lachowicz
Browse files

Bug #313627. Make win32 theme's handling of toolbars, handleboxes, and

2005-11-12  Dom Lachowicz <cinamod@hotmail.com>

	* modules/engines/ms-windows/msw_style.c: Bug #313627. Make win32
	theme's handling of toolbars, handleboxes, and menubars more in-line
	with Microsoft's IE style.
	* modules/engines/ms-windows/*.c: Indentation cleanups
parent 82f12b61
2005-11-12 Dom Lachowicz <cinamod@hotmail.com>
* modules/engines/ms-windows/msw_style.c: Bug #313627. Make win32
theme's handling of toolbars, handleboxes, and menubars more in-line
with Microsoft's IE style.
* modules/engines/ms-windows/*.c: Indentation cleanups
2005-11-12 Matthias Clasen <mclasen@redhat.com>
Make builtin icons work in gtk_window_set_icon_name()
......
2005-11-12 Dom Lachowicz <cinamod@hotmail.com>
* modules/engines/ms-windows/msw_style.c: Bug #313627. Make win32
theme's handling of toolbars, handleboxes, and menubars more in-line
with Microsoft's IE style.
* modules/engines/ms-windows/*.c: Indentation cleanups
2005-11-12 Matthias Clasen <mclasen@redhat.com>
Make builtin icons work in gtk_window_set_icon_name()
......
......@@ -23,19 +23,18 @@
#include "msw_style.h"
#include "msw_rc_style.h"
static void msw_rc_style_init (MswRcStyle *style);
static void msw_rc_style_class_init (MswRcStyleClass *klass);
static GtkStyle *msw_rc_style_create_style (GtkRcStyle *rc_style);
static void msw_rc_style_init (MswRcStyle * style);
static void msw_rc_style_class_init (MswRcStyleClass * klass);
static GtkStyle *msw_rc_style_create_style (GtkRcStyle * rc_style);
static GtkRcStyleClass *parent_class;
GType msw_type_rc_style = 0;
void
msw_rc_style_register_type (GTypeModule *module)
msw_rc_style_register_type (GTypeModule * module)
{
static const GTypeInfo object_info =
{
static const GTypeInfo object_info = {
sizeof (MswRcStyleClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
......@@ -54,12 +53,12 @@ msw_rc_style_register_type (GTypeModule *module)
}
static void
msw_rc_style_init (MswRcStyle *style)
msw_rc_style_init (MswRcStyle * style)
{
}
static void
msw_rc_style_class_init (MswRcStyleClass *klass)
msw_rc_style_class_init (MswRcStyleClass * klass)
{
GtkRcStyleClass *rc_style_class = GTK_RC_STYLE_CLASS (klass);
......@@ -71,8 +70,7 @@ msw_rc_style_class_init (MswRcStyleClass *klass)
/* Create an empty style suitable to this RC style
*/
static GtkStyle *
msw_rc_style_create_style (GtkRcStyle *rc_style)
msw_rc_style_create_style (GtkRcStyle * rc_style)
{
return g_object_new (MSW_TYPE_STYLE, NULL);
}
......@@ -39,6 +39,7 @@
#include "gtk/gtk.h"
#include "gtk/gtk.h"
/* #include <gdk/gdkwin32.h> */
#include "gdk/win32/gdkwin32.h"
......@@ -49,7 +50,8 @@ static const GtkBorder default_option_indicator_spacing = { 7, 5, 2, 2 };
static GtkStyleClass *parent_class;
typedef enum {
typedef enum
{
CHECK_AA,
CHECK_BASE,
CHECK_BLACK,
......@@ -68,79 +70,109 @@ typedef enum {
#define PART_SIZE 13
static const guint8 check_aa_bits[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static const guint8 check_base_bits[] = {
0x00,0x00,0x00,0x00,0xfc,0x07,0xfc,0x07,0xfc,0x07,0xfc,0x07,0xfc,0x07,0xfc,
0x07,0xfc,0x07,0xfc,0x07,0xfc,0x07,0x00,0x00,0x00,0x00};
0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x07, 0xfc, 0x07, 0xfc, 0x07,
0xfc, 0x07, 0xfc,
0x07, 0xfc, 0x07, 0xfc, 0x07, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00
};
static const guint8 check_black_bits[] = {
0x00,0x00,0xfe,0x0f,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,
0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00};
0x00, 0x00, 0xfe, 0x0f, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00,
0x02, 0x00, 0x02,
0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00
};
static const guint8 check_dark_bits[] = {
0xff,0x1f,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,
0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00};
0xff, 0x1f, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
0x01, 0x00, 0x01,
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00
};
static const guint8 check_light_bits[] = {
0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,
0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0xfe,0x1f};
0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00,
0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0xfe, 0x1f
};
static const guint8 check_mid_bits[] = {
0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,
0x08,0x00,0x08,0x00,0x08,0x00,0x08,0xfc,0x0f,0x00,0x00};
0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08,
0x00, 0x08, 0x00,
0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0xfc, 0x0f, 0x00, 0x00
};
static const guint8 check_text_bits[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x03,0x88,0x03,0xd8,0x01,0xf8,
0x00,0x70,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x88, 0x03,
0xd8, 0x01, 0xf8,
0x00, 0x70, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static const guint8 radio_base_bits[] = {
0x00,0x00,0x00,0x00,0xf0,0x01,0xf8,0x03,0xfc,0x07,0xfc,0x07,0xfc,0x07,0xfc,
0x07,0xfc,0x07,0xf8,0x03,0xf0,0x01,0x00,0x00,0x00,0x00};
0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0xf8, 0x03, 0xfc, 0x07, 0xfc, 0x07,
0xfc, 0x07, 0xfc,
0x07, 0xfc, 0x07, 0xf8, 0x03, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x00
};
static const guint8 radio_black_bits[] = {
0x00,0x00,0xf0,0x01,0x0c,0x02,0x04,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,
0x00,0x02,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
0x00, 0x00, 0xf0, 0x01, 0x0c, 0x02, 0x04, 0x00, 0x02, 0x00, 0x02, 0x00,
0x02, 0x00, 0x02,
0x00, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static const guint8 radio_dark_bits[] = {
0xf0,0x01,0x0c,0x06,0x02,0x00,0x02,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,
0x00,0x01,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00};
0xf0, 0x01, 0x0c, 0x06, 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00,
0x01, 0x00, 0x01,
0x00, 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00
};
static const guint8 radio_light_bits[] = {
0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x10,0x00,0x10,0x00,
0x10,0x00,0x10,0x00,0x08,0x00,0x08,0x0c,0x06,0xf0,0x01};
0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00,
0x10, 0x00, 0x10, 0x00, 0x08, 0x00, 0x08, 0x0c, 0x06, 0xf0, 0x01
};
static const guint8 radio_mid_bits[] = {
0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x04,0x00,0x08,0x00,0x08,0x00,0x08,0x00,
0x08,0x00,0x08,0x00,0x04,0x0c,0x06,0xf0,0x01,0x00,0x00};
0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08,
0x00, 0x08, 0x00,
0x08, 0x00, 0x08, 0x00, 0x04, 0x0c, 0x06, 0xf0, 0x01, 0x00, 0x00
};
static const guint8 radio_text_bits[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0xf0,0x01,0xf0,0x01,0xf0,
0x01,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0xf0, 0x01,
0xf0, 0x01, 0xf0,
0x01, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static struct {
static struct
{
const guint8 *bits;
GdkBitmap *bmap;
} parts[] = {
{ check_aa_bits, NULL },
{ check_base_bits, NULL },
{ check_black_bits, NULL },
{ check_dark_bits, NULL },
{ check_light_bits, NULL },
{ check_mid_bits, NULL },
{ check_text_bits, NULL },
{ radio_base_bits, NULL },
{ radio_black_bits, NULL },
{ radio_dark_bits, NULL },
{ radio_light_bits, NULL },
{ radio_mid_bits, NULL },
{ radio_text_bits, NULL }
} parts[] =
{
{check_aa_bits, NULL},
{check_base_bits, NULL},
{check_black_bits, NULL},
{check_dark_bits, NULL},
{check_light_bits, NULL},
{check_mid_bits, NULL},
{check_text_bits, NULL},
{radio_base_bits, NULL},
{radio_black_bits, NULL},
{radio_dark_bits, NULL},
{radio_light_bits, NULL},
{radio_mid_bits, NULL},
{radio_text_bits, NULL}
};
static gboolean
get_system_font(XpThemeClass klazz, XpThemeFont type, LOGFONT *out_lf)
get_system_font (XpThemeClass klazz, XpThemeFont type, LOGFONT * out_lf)
{
#if 0
/* TODO: this causes crashes later because the font name is in UCS2, and the pango fns don't deal with that gracefully */
if (xp_theme_get_system_font(klazz, type, out_lf))
/* TODO: this causes crashes later because the font name is in UCS2, and
the pango fns don't deal with that gracefully */
if (xp_theme_get_system_font (klazz, type, out_lf))
return TRUE;
else
#endif
{
NONCLIENTMETRICS ncm;
ncm.cbSize = sizeof(NONCLIENTMETRICS);
if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
sizeof(NONCLIENTMETRICS), &ncm, 0))
ncm.cbSize = sizeof (NONCLIENTMETRICS);
if (SystemParametersInfo (SPI_GETNONCLIENTMETRICS,
sizeof (NONCLIENTMETRICS), &ncm, 0))
{
if (type == XP_THEME_FONT_CAPTION)
*out_lf = ncm.lfCaptionFont;
......@@ -210,22 +242,21 @@ struct name_record
};
static gboolean
pango_win32_get_name_header (HDC hdc,
struct name_header *header)
pango_win32_get_name_header (HDC hdc, struct name_header *header)
{
if (GetFontData (hdc, NAME, 0, header, sizeof (*header)) != sizeof (*header))
if (GetFontData (hdc, NAME, 0, header, sizeof (*header)) !=
sizeof (*header))
return FALSE;
header->num_records = GUINT16_FROM_BE (header->num_records);
header->string_storage_offset = GUINT16_FROM_BE (header->string_storage_offset);
header->string_storage_offset =
GUINT16_FROM_BE (header->string_storage_offset);
return TRUE;
}
static gboolean
pango_win32_get_name_record (HDC hdc,
gint i,
struct name_record *record)
pango_win32_get_name_record (HDC hdc, gint i, struct name_record *record)
{
if (GetFontData (hdc, NAME, 6 + i * sizeof (*record),
record, sizeof (*record)) != sizeof (*record))
......@@ -242,7 +273,7 @@ pango_win32_get_name_record (HDC hdc,
}
static gchar *
get_family_name (LOGFONT *lfp, HDC pango_win32_hdc)
get_family_name (LOGFONT * lfp, HDC pango_win32_hdc)
{
HFONT hfont;
HFONT oldhfont;
......@@ -259,11 +290,10 @@ get_family_name (LOGFONT *lfp, HDC pango_win32_hdc)
size_t i, l, nbytes;
/* If lfFaceName is ASCII, assume it is the common (English) name
* for the font. Is this valid? Do some TrueType fonts have
* different names in French, German, etc, and does the system
* return these if the locale is set to use French, German, etc?
*/
/* If lfFaceName is ASCII, assume it is the common (English) name for the
font. Is this valid? Do some TrueType fonts have different names in
French, German, etc, and does the system return these if the locale is
set to use French, German, etc? */
l = strlen (lfp->lfFaceName);
for (i = 0; i < l; i++)
if (lfp->lfFaceName[i] < ' ' || lfp->lfFaceName[i] > '~')
......@@ -275,7 +305,7 @@ get_family_name (LOGFONT *lfp, HDC pango_win32_hdc)
if ((hfont = CreateFontIndirect (lfp)) == NULL)
goto fail0;
if ((oldhfont = (HFONT)SelectObject (pango_win32_hdc, hfont)) == NULL)
if ((oldhfont = (HFONT) SelectObject (pango_win32_hdc, hfont)) == NULL)
goto fail1;
if (!pango_win32_get_name_header (pango_win32_hdc, &header))
......@@ -288,17 +318,19 @@ get_family_name (LOGFONT *lfp, HDC pango_win32_hdc)
if (!pango_win32_get_name_record (pango_win32_hdc, i, &record))
goto fail2;
if ((record.name_id != 1 && record.name_id != 16) || record.string_length <= 0)
if ((record.name_id != 1 && record.name_id != 16)
|| record.string_length <= 0)
continue;
PING(("platform:%d encoding:%d language:%04x name_id:%d",
record.platform_id, record.encoding_id, record.language_id, record.name_id));
PING (("platform:%d encoding:%d language:%04x name_id:%d",
record.platform_id, record.encoding_id, record.language_id,
record.name_id));
if (record.platform_id == APPLE_UNICODE_PLATFORM_ID ||
record.platform_id == ISO_PLATFORM_ID)
unicode_ix = i;
else if (record.platform_id == MACINTOSH_PLATFORM_ID &&
record.encoding_id == 0 && /* Roman */
else if (record.platform_id == MACINTOSH_PLATFORM_ID && record.encoding_id == 0 && /* Roman
*/
record.language_id == 0) /* English */
mac_ix = i;
else if (record.platform_id == MICROSOFT_PLATFORM_ID)
......@@ -341,12 +373,14 @@ get_family_name (LOGFONT *lfp, HDC pango_win32_hdc)
else /* name_ix == unicode_ix */
codeset = "UCS-4BE";
name = g_convert (string, record.string_length, "UTF-8", codeset, NULL, &nbytes, NULL);
name =
g_convert (string, record.string_length, "UTF-8", codeset, NULL,
&nbytes, NULL);
if (name == NULL)
goto fail2;
g_free (string);
PING(("%s", name));
PING (("%s", name));
SelectObject (pango_win32_hdc, oldhfont);
DeleteObject (hfont);
......@@ -367,19 +401,21 @@ get_family_name (LOGFONT *lfp, HDC pango_win32_hdc)
/***************************** END STOLEN FROM PANGO *****************************/
static char *
sys_font_to_pango_font (XpThemeClass klazz, XpThemeFont type, char * buf, size_t bufsiz)
sys_font_to_pango_font (XpThemeClass klazz, XpThemeFont type, char *buf,
size_t bufsiz)
{
HDC hDC;
HWND hwnd;
LOGFONT lf;
int pt_size;
const char * weight;
const char * style;
char * font;
const char *weight;
const char *style;
char *font;
if (get_system_font(klazz, type, &lf))
if (get_system_font (klazz, type, &lf))
{
switch (lf.lfWeight)
{
switch (lf.lfWeight) {
case FW_THIN:
case FW_EXTRALIGHT:
weight = "Ultra-Light";
......@@ -411,22 +447,25 @@ sys_font_to_pango_font (XpThemeClass klazz, XpThemeFont type, char * buf, size_t
}
if (lf.lfItalic)
style="Italic";
style = "Italic";
else
style = "";
hwnd = GetDesktopWindow ();
hDC = GetDC (hwnd);
if (hDC)
{
pt_size = -MulDiv (lf.lfHeight, 72,
GetDeviceCaps (hDC, LOGPIXELSY));
ReleaseDC (hwnd, hDC);
}
else
style="";
hwnd = GetDesktopWindow();
hDC = GetDC(hwnd);
if (hDC) {
pt_size = -MulDiv(lf.lfHeight, 72,
GetDeviceCaps(hDC,LOGPIXELSY));
ReleaseDC(hwnd, hDC);
} else
pt_size = 10;
font = get_family_name(&lf, hDC);
g_snprintf(buf, bufsiz, "%s %s %s %d", font, style, weight, pt_size);
g_free(font);
font = get_family_name (&lf, hDC);
g_snprintf (buf, bufsiz, "%s %s %s %d", font, style, weight,
pt_size);
g_free (font);
return buf;
}
......@@ -450,29 +489,45 @@ setup_menu_settings (GtkSettings * settings)
int menu_delay;
gboolean win95 = FALSE;
OSVERSIONINFOEX osvi;
GObjectClass * klazz = G_OBJECT_GET_CLASS(G_OBJECT(settings));
GObjectClass *klazz = G_OBJECT_GET_CLASS (G_OBJECT (settings));
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
ZeroMemory (&osvi, sizeof (OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
if (!GetVersionEx ( (OSVERSIONINFO *) &osvi))
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 (SystemParametersInfo (SPI_GETMENUSHOWDELAY, 0, &menu_delay, 0)) {
if (klazz) {
if (g_object_class_find_property (klazz, "gtk-menu-bar-popup-delay")) {
g_object_set (settings, "gtk-menu-bar-popup-delay", 0, NULL);
if (!win95)
{
if (SystemParametersInfo
(SPI_GETMENUSHOWDELAY, 0, &menu_delay, 0))
{
if (klazz)
{
if (g_object_class_find_property
(klazz, "gtk-menu-bar-popup-delay"))
{
g_object_set (settings,
"gtk-menu-bar-popup-delay",
0, NULL);
}
if (g_object_class_find_property (klazz, "gtk-menu-popup-delay")) {
g_object_set (settings, "gtk-menu-popup-delay", menu_delay, NULL);
if (g_object_class_find_property
(klazz, "gtk-menu-popup-delay"))
{
g_object_set (settings,
"gtk-menu-popup-delay",
menu_delay, NULL);
}
if (g_object_class_find_property (klazz, "gtk-menu-popdown-delay")) {
g_object_set (settings, "gtk-menu-popdown-delay", menu_delay, NULL);
if (g_object_class_find_property
(klazz, "gtk-menu-popdown-delay"))
{
g_object_set (settings,
"gtk-menu-popdown-delay",
menu_delay, NULL);
}
}
}
......@@ -482,7 +537,7 @@ setup_menu_settings (GtkSettings * settings)
void
msw_style_setup_system_settings (void)
{
GtkSettings * settings;
GtkSettings *settings;
int cursor_blink_time;
settings = gtk_settings_get_default ();
......@@ -493,65 +548,68 @@ msw_style_setup_system_settings (void)
g_object_set (settings, "gtk-cursor-blink", cursor_blink_time > 0, NULL);
if (cursor_blink_time > 0)
g_object_set (settings, "gtk-cursor-blink-time", 2*cursor_blink_time,
NULL);
g_object_set (settings, "gtk-cursor-blink-time",
2 * cursor_blink_time, NULL);
g_object_set (settings, "gtk-double-click-distance", GetSystemMetrics(SM_CXDOUBLECLK), NULL);
g_object_set (settings, "gtk-double-click-time", GetDoubleClickTime(), NULL);
g_object_set (settings, "gtk-dnd-drag-threshold", GetSystemMetrics(SM_CXDRAG), NULL);
g_object_set (settings, "gtk-double-click-distance",
GetSystemMetrics (SM_CXDOUBLECLK), NULL);
g_object_set (settings, "gtk-double-click-time", GetDoubleClickTime (),
NULL);
g_object_set (settings, "gtk-dnd-drag-threshold",
GetSystemMetrics (SM_CXDRAG), NULL);
setup_menu_settings (settings);
/*
http://developer.gnome.org/doc/API/2.0/gtk/GtkSettings.html
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/systemparametersinfo.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getsystemmetrics.asp
*/
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getsystemmetrics.asp */
}
static void
setup_system_font(GtkStyle *style)
setup_system_font (GtkStyle * style)
{
char buf[256], * font; /* It's okay, lfFaceName is smaller than 32 chars */
char buf[256], *font; /* It's okay, lfFaceName is smaller than 32
chars */
if ((font = sys_font_to_pango_font(XP_THEME_CLASS_TEXT,
if ((font = sys_font_to_pango_font (XP_THEME_CLASS_TEXT,
XP_THEME_FONT_MESSAGE,
buf, sizeof (buf))) != NULL)
{
if (style->font_desc)
pango_font_description_free (style->font_desc);
style->font_desc = pango_font_description_from_string(font);
style->font_desc = pango_font_description_from_string (font);
}
}
static void
sys_color_to_gtk_color(XpThemeClass klazz, int id, GdkColor *pcolor)
sys_color_to_gtk_color (XpThemeClass klazz, int id, GdkColor * pcolor)
{
DWORD color;
if (!xp_theme_get_system_color (klazz, id, &color))
color = GetSysColor(id);
color = GetSysColor (id);
pcolor->pixel = color;
pcolor->red = (GetRValue(color) << 8) | GetRValue(color);
pcolor->green = (GetGValue(color) << 8) | GetGValue(color);
pcolor->blue = (GetBValue(color) << 8) | GetBValue(color);
pcolor->red = (GetRValue (color) << 8) | GetRValue (color);
pcolor->green = (GetGValue (color) << 8) | GetGValue (color);
pcolor->blue = (GetBValue (color) << 8) | GetBValue (color);
}
static int
get_system_metric(XpThemeClass klazz, int id)
get_system_metric (XpThemeClass klazz, int id)
{
int rval;
if (!xp_theme_get_system_metric(klazz, id, &rval))
if (!xp_theme_get_system_metric (klazz, id, &rval))
rval = GetSystemMetrics (id);
return rval;
}
static void
setup_msw_rc_style(void)
setup_msw_rc_style (void)
{
char buf[1024], font_buf[256], *font_ptr;
......@@ -568,126 +626,115 @@ setup_msw_rc_style(void)
GdkColor base_prelight;
GdkColor text_prelight;
gboolean xp_theme = xp_theme_is_active();
/* Prelight */
sys_color_to_gtk_color(XP_THEME_CLASS_TEXT, 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, &base_prelight);
sys_color_to_gtk_color(XP_THEME_CLASS_TEXT, COLOR_HIGHLIGHTTEXT, &text_prelight);
sys_color_to_gtk_color(XP_THEME_CLASS_MENU, COLOR_MENUTEXT, &menu_text_color);
sys_color_to_gtk_color(XP_THEME_CLASS_MENU, COLOR_MENU, &menu_color);
sys_color_to_gtk_color (XP_THEME_CLASS_TEXT, 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,
&base_prelight);
sys_color_to_gtk_color (XP_THEME_CLASS_TEXT, COLOR_HIGHLIGHTTEXT,
&text_prelight);
sys_color_to_gtk_color (XP_THEME_CLASS_MENU, COLOR_MENUTEXT,
&menu_text_color);
sys_color_to_gtk_color (XP_THEME_CLASS_MENU, COLOR_MENU, &menu_color);