Skip to content

Commit

Permalink
workaround for IupFontDlg in Windows 8
Browse files Browse the repository at this point in the history
  • Loading branch information
scuri committed Nov 12, 2012
1 parent 733bf49 commit 1bf3f0a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/win/iupwin_fontdlg.c
Expand Up @@ -98,9 +98,14 @@ static int winFontDlgPopup(Ihandle* ih, int x, int y)

choosefont.hwndOwner = parent;
choosefont.lpLogFont = &logfont;
choosefont.Flags = CF_SCREENFONTS | CF_EFFECTS | CF_INITTOLOGFONTSTRUCT | CF_ENABLEHOOK;
choosefont.Flags = CF_SCREENFONTS | CF_EFFECTS | CF_INITTOLOGFONTSTRUCT;
choosefont.lCustData = (LPARAM)ih;
choosefont.lpfnHook = (LPCFHOOKPROC)winFontDlgHookProc;

if (!iupwinIs8OrNew() || iupAttribGetBoolean(ih, "WIN8_FONT_HOOK"))
{
choosefont.lpfnHook = (LPCFHOOKPROC)winFontDlgHookProc;
choosefont.Flags |= CF_ENABLEHOOK;
}

if (IupGetCallback(ih, "HELP_CB"))
choosefont.Flags |= CF_SHOWHELP;
Expand Down
13 changes: 13 additions & 0 deletions src/win/iupwin_info.c
Expand Up @@ -43,6 +43,19 @@ int iupwinIs7OrNew(void)
return 0;
}

int iupwinIs8OrNew(void)
{
OSVERSIONINFO osvi;
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osvi);

if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT &&
(osvi.dwMajorVersion > 6 || (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion >= 2)))
return 1;

return 0;
}

int iupwinGetSystemMajorVersion(void)
{
OSVERSIONINFO osvi;
Expand Down
1 change: 1 addition & 0 deletions src/win/iupwin_info.h
Expand Up @@ -18,6 +18,7 @@ char* iupwinGetSystemLanguage(void);
int iupwinIsAppThemed(void);
int iupwinIsVistaOrNew(void);
int iupwinIs7OrNew(void);
int iupwinIs8OrNew(void);

/* color */
void iupwinGetSysColor(char* color, int wincolor);
Expand Down

0 comments on commit 1bf3f0a

Please sign in to comment.