Add new keysyms from X11R6.4 (including EuroSign).

1999-10-31  Tor Lillqvist  <tml@iki.fi>

* gdk/gdkkeysyms.h: Add new keysyms from X11R6.4 (including
EuroSign).

* gdk/gdktypes.h: Add note about wchar_t not necessarily being the
same type as GdkWChar, especially on Win32.

* gdk/win32/*.c: Change gdk_root_parent to be a pointer.

* gdk/win32/*.c: Assume all strings are UTF-8. Convert to Unicode
before passing to Windows GDI for drawing etc. Convert to the
system default codepage before passing to Windows as window
titles.

* gdk/win32/gdkprivate.h: Add more fields to GdkWindowPrivate to
support changing input locale on the fly.

* gdk/win32/gdkevent.c: Support input language (keyboard locale)
on-the-fly changes. Convert incoming characters from the current
codepage to Unicode (and then to a UTF-8 multi-byte string) based
on the current input language. Use keysym<->Unicode mapping tables
and functions borrowed from xterm sources.

Support IMEs (Input Method Editors) for CJK languages. On non-CJK
editions of Win9x, use the ActiveX-based Active IMM (Input Method
Manager) if available. IMEs and the Active IMM are available under
the disguise of Chinese, Korean and Japanese support for IE and
Outlook Express from "Windows Update" for Win98. On Win2k, the CJK
support is present in all editions (as long as you install it).

Call DispatchMessage from gdk_events_queue() (and thus
gdk_WindowProc()), instead of duplicating the code in
gdk_WindowProc().

Reworked the grab handling and propagation code, factored out
duplicated code snippets into separate functions. Other cleanups,
too.

* gdk/win32/surrogate-dimm.h: Provide just the bits we need from
the <dimm.h> header describing the Active IMM.

* gdk/win32/gdkfont.c: Pretend to support fontsets, but so far
just do the same as for "single" fonts.

* gdk/win32/gdk.c: Call CoInitialize() (COM initialisation) from
gdk_init_check, and CoUninitialize() from gdk_exit_func. Handle
the new keysyms from gdkkeysyms.h.

* gtk/gtkfontsel.c (Win32): Load the font for the preview as a
fontset, so that gtkentry uses wide characters.

* gtk/gtkrc.c (Win32): Get the locale with gwin_getlocale(). Call
GTk+'s system directory "gtk+", not "gtk".
This commit is contained in:
Tor Lillqvist 1999-10-31 21:35:39 +00:00 committed by Tor Lillqvist
parent 241f9c9dab
commit 00c5e83871
45 changed files with 7169 additions and 2242 deletions

View File

@ -1,3 +1,58 @@
1999-10-31 Tor Lillqvist <tml@iki.fi>
* gdk/gdkkeysyms.h: Add new keysyms from X11R6.4 (including
EuroSign).
* gdk/gdktypes.h: Add note about wchar_t not necessarily being the
same type as GdkWChar, especially on Win32.
* gdk/win32/*.c: Change gdk_root_parent to be a pointer.
* gdk/win32/*.c: Assume all strings are UTF-8. Convert to Unicode
before passing to Windows GDI for drawing etc. Convert to the
system default codepage before passing to Windows as window
titles.
* gdk/win32/gdkprivate.h: Add more fields to GdkWindowPrivate to
support changing input locale on the fly.
* gdk/win32/gdkevent.c: Support input language (keyboard locale)
on-the-fly changes. Convert incoming characters from the current
codepage to Unicode (and then to a UTF-8 multi-byte string) based
on the current input language. Use keysym<->Unicode mapping tables
and functions borrowed from xterm sources.
Support IMEs (Input Method Editors) for CJK languages. On non-CJK
editions of Win9x, use the ActiveX-based Active IMM (Input Method
Manager) if available. IMEs and the Active IMM are available under
the disguise of Chinese, Korean and Japanese support for IE and
Outlook Express from "Windows Update" for Win98. On Win2k, the CJK
support is present in all editions (as long as you install it).
Call DispatchMessage from gdk_events_queue() (and thus
gdk_WindowProc()), instead of duplicating the code in
gdk_WindowProc().
Reworked the grab handling and propagation code, factored out
duplicated code snippets into separate functions. Other cleanups,
too.
* gdk/win32/surrogate-dimm.h: Provide just the bits we need from
the <dimm.h> header describing the Active IMM.
* gdk/win32/gdkfont.c: Pretend to support fontsets, but so far
just do the same as for "single" fonts.
* gdk/win32/gdk.c: Call CoInitialize() (COM initialisation) from
gdk_init_check, and CoUninitialize() from gdk_exit_func. Handle
the new keysyms from gdkkeysyms.h.
* gtk/gtkfontsel.c (Win32): Load the font for the preview as a
fontset, so that gtkentry uses wide characters.
* gtk/gtkrc.c (Win32): Get the locale with gwin_getlocale(). Call
GTk+'s system directory "gtk+", not "gtk".
Sat Oct 30 13:17:18 BST 1999 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: FAQ update

View File

@ -1,3 +1,58 @@
1999-10-31 Tor Lillqvist <tml@iki.fi>
* gdk/gdkkeysyms.h: Add new keysyms from X11R6.4 (including
EuroSign).
* gdk/gdktypes.h: Add note about wchar_t not necessarily being the
same type as GdkWChar, especially on Win32.
* gdk/win32/*.c: Change gdk_root_parent to be a pointer.
* gdk/win32/*.c: Assume all strings are UTF-8. Convert to Unicode
before passing to Windows GDI for drawing etc. Convert to the
system default codepage before passing to Windows as window
titles.
* gdk/win32/gdkprivate.h: Add more fields to GdkWindowPrivate to
support changing input locale on the fly.
* gdk/win32/gdkevent.c: Support input language (keyboard locale)
on-the-fly changes. Convert incoming characters from the current
codepage to Unicode (and then to a UTF-8 multi-byte string) based
on the current input language. Use keysym<->Unicode mapping tables
and functions borrowed from xterm sources.
Support IMEs (Input Method Editors) for CJK languages. On non-CJK
editions of Win9x, use the ActiveX-based Active IMM (Input Method
Manager) if available. IMEs and the Active IMM are available under
the disguise of Chinese, Korean and Japanese support for IE and
Outlook Express from "Windows Update" for Win98. On Win2k, the CJK
support is present in all editions (as long as you install it).
Call DispatchMessage from gdk_events_queue() (and thus
gdk_WindowProc()), instead of duplicating the code in
gdk_WindowProc().
Reworked the grab handling and propagation code, factored out
duplicated code snippets into separate functions. Other cleanups,
too.
* gdk/win32/surrogate-dimm.h: Provide just the bits we need from
the <dimm.h> header describing the Active IMM.
* gdk/win32/gdkfont.c: Pretend to support fontsets, but so far
just do the same as for "single" fonts.
* gdk/win32/gdk.c: Call CoInitialize() (COM initialisation) from
gdk_init_check, and CoUninitialize() from gdk_exit_func. Handle
the new keysyms from gdkkeysyms.h.
* gtk/gtkfontsel.c (Win32): Load the font for the preview as a
fontset, so that gtkentry uses wide characters.
* gtk/gtkrc.c (Win32): Get the locale with gwin_getlocale(). Call
GTk+'s system directory "gtk+", not "gtk".
Sat Oct 30 13:17:18 BST 1999 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: FAQ update

View File

@ -1,3 +1,58 @@
1999-10-31 Tor Lillqvist <tml@iki.fi>
* gdk/gdkkeysyms.h: Add new keysyms from X11R6.4 (including
EuroSign).
* gdk/gdktypes.h: Add note about wchar_t not necessarily being the
same type as GdkWChar, especially on Win32.
* gdk/win32/*.c: Change gdk_root_parent to be a pointer.
* gdk/win32/*.c: Assume all strings are UTF-8. Convert to Unicode
before passing to Windows GDI for drawing etc. Convert to the
system default codepage before passing to Windows as window
titles.
* gdk/win32/gdkprivate.h: Add more fields to GdkWindowPrivate to
support changing input locale on the fly.
* gdk/win32/gdkevent.c: Support input language (keyboard locale)
on-the-fly changes. Convert incoming characters from the current
codepage to Unicode (and then to a UTF-8 multi-byte string) based
on the current input language. Use keysym<->Unicode mapping tables
and functions borrowed from xterm sources.
Support IMEs (Input Method Editors) for CJK languages. On non-CJK
editions of Win9x, use the ActiveX-based Active IMM (Input Method
Manager) if available. IMEs and the Active IMM are available under
the disguise of Chinese, Korean and Japanese support for IE and
Outlook Express from "Windows Update" for Win98. On Win2k, the CJK
support is present in all editions (as long as you install it).
Call DispatchMessage from gdk_events_queue() (and thus
gdk_WindowProc()), instead of duplicating the code in
gdk_WindowProc().
Reworked the grab handling and propagation code, factored out
duplicated code snippets into separate functions. Other cleanups,
too.
* gdk/win32/surrogate-dimm.h: Provide just the bits we need from
the <dimm.h> header describing the Active IMM.
* gdk/win32/gdkfont.c: Pretend to support fontsets, but so far
just do the same as for "single" fonts.
* gdk/win32/gdk.c: Call CoInitialize() (COM initialisation) from
gdk_init_check, and CoUninitialize() from gdk_exit_func. Handle
the new keysyms from gdkkeysyms.h.
* gtk/gtkfontsel.c (Win32): Load the font for the preview as a
fontset, so that gtkentry uses wide characters.
* gtk/gtkrc.c (Win32): Get the locale with gwin_getlocale(). Call
GTk+'s system directory "gtk+", not "gtk".
Sat Oct 30 13:17:18 BST 1999 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: FAQ update

View File

@ -1,3 +1,58 @@
1999-10-31 Tor Lillqvist <tml@iki.fi>
* gdk/gdkkeysyms.h: Add new keysyms from X11R6.4 (including
EuroSign).
* gdk/gdktypes.h: Add note about wchar_t not necessarily being the
same type as GdkWChar, especially on Win32.
* gdk/win32/*.c: Change gdk_root_parent to be a pointer.
* gdk/win32/*.c: Assume all strings are UTF-8. Convert to Unicode
before passing to Windows GDI for drawing etc. Convert to the
system default codepage before passing to Windows as window
titles.
* gdk/win32/gdkprivate.h: Add more fields to GdkWindowPrivate to
support changing input locale on the fly.
* gdk/win32/gdkevent.c: Support input language (keyboard locale)
on-the-fly changes. Convert incoming characters from the current
codepage to Unicode (and then to a UTF-8 multi-byte string) based
on the current input language. Use keysym<->Unicode mapping tables
and functions borrowed from xterm sources.
Support IMEs (Input Method Editors) for CJK languages. On non-CJK
editions of Win9x, use the ActiveX-based Active IMM (Input Method
Manager) if available. IMEs and the Active IMM are available under
the disguise of Chinese, Korean and Japanese support for IE and
Outlook Express from "Windows Update" for Win98. On Win2k, the CJK
support is present in all editions (as long as you install it).
Call DispatchMessage from gdk_events_queue() (and thus
gdk_WindowProc()), instead of duplicating the code in
gdk_WindowProc().
Reworked the grab handling and propagation code, factored out
duplicated code snippets into separate functions. Other cleanups,
too.
* gdk/win32/surrogate-dimm.h: Provide just the bits we need from
the <dimm.h> header describing the Active IMM.
* gdk/win32/gdkfont.c: Pretend to support fontsets, but so far
just do the same as for "single" fonts.
* gdk/win32/gdk.c: Call CoInitialize() (COM initialisation) from
gdk_init_check, and CoUninitialize() from gdk_exit_func. Handle
the new keysyms from gdkkeysyms.h.
* gtk/gtkfontsel.c (Win32): Load the font for the preview as a
fontset, so that gtkentry uses wide characters.
* gtk/gtkrc.c (Win32): Get the locale with gwin_getlocale(). Call
GTk+'s system directory "gtk+", not "gtk".
Sat Oct 30 13:17:18 BST 1999 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: FAQ update

View File

@ -1,3 +1,58 @@
1999-10-31 Tor Lillqvist <tml@iki.fi>
* gdk/gdkkeysyms.h: Add new keysyms from X11R6.4 (including
EuroSign).
* gdk/gdktypes.h: Add note about wchar_t not necessarily being the
same type as GdkWChar, especially on Win32.
* gdk/win32/*.c: Change gdk_root_parent to be a pointer.
* gdk/win32/*.c: Assume all strings are UTF-8. Convert to Unicode
before passing to Windows GDI for drawing etc. Convert to the
system default codepage before passing to Windows as window
titles.
* gdk/win32/gdkprivate.h: Add more fields to GdkWindowPrivate to
support changing input locale on the fly.
* gdk/win32/gdkevent.c: Support input language (keyboard locale)
on-the-fly changes. Convert incoming characters from the current
codepage to Unicode (and then to a UTF-8 multi-byte string) based
on the current input language. Use keysym<->Unicode mapping tables
and functions borrowed from xterm sources.
Support IMEs (Input Method Editors) for CJK languages. On non-CJK
editions of Win9x, use the ActiveX-based Active IMM (Input Method
Manager) if available. IMEs and the Active IMM are available under
the disguise of Chinese, Korean and Japanese support for IE and
Outlook Express from "Windows Update" for Win98. On Win2k, the CJK
support is present in all editions (as long as you install it).
Call DispatchMessage from gdk_events_queue() (and thus
gdk_WindowProc()), instead of duplicating the code in
gdk_WindowProc().
Reworked the grab handling and propagation code, factored out
duplicated code snippets into separate functions. Other cleanups,
too.
* gdk/win32/surrogate-dimm.h: Provide just the bits we need from
the <dimm.h> header describing the Active IMM.
* gdk/win32/gdkfont.c: Pretend to support fontsets, but so far
just do the same as for "single" fonts.
* gdk/win32/gdk.c: Call CoInitialize() (COM initialisation) from
gdk_init_check, and CoUninitialize() from gdk_exit_func. Handle
the new keysyms from gdkkeysyms.h.
* gtk/gtkfontsel.c (Win32): Load the font for the preview as a
fontset, so that gtkentry uses wide characters.
* gtk/gtkrc.c (Win32): Get the locale with gwin_getlocale(). Call
GTk+'s system directory "gtk+", not "gtk".
Sat Oct 30 13:17:18 BST 1999 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: FAQ update

View File

@ -1,3 +1,58 @@
1999-10-31 Tor Lillqvist <tml@iki.fi>
* gdk/gdkkeysyms.h: Add new keysyms from X11R6.4 (including
EuroSign).
* gdk/gdktypes.h: Add note about wchar_t not necessarily being the
same type as GdkWChar, especially on Win32.
* gdk/win32/*.c: Change gdk_root_parent to be a pointer.
* gdk/win32/*.c: Assume all strings are UTF-8. Convert to Unicode
before passing to Windows GDI for drawing etc. Convert to the
system default codepage before passing to Windows as window
titles.
* gdk/win32/gdkprivate.h: Add more fields to GdkWindowPrivate to
support changing input locale on the fly.
* gdk/win32/gdkevent.c: Support input language (keyboard locale)
on-the-fly changes. Convert incoming characters from the current
codepage to Unicode (and then to a UTF-8 multi-byte string) based
on the current input language. Use keysym<->Unicode mapping tables
and functions borrowed from xterm sources.
Support IMEs (Input Method Editors) for CJK languages. On non-CJK
editions of Win9x, use the ActiveX-based Active IMM (Input Method
Manager) if available. IMEs and the Active IMM are available under
the disguise of Chinese, Korean and Japanese support for IE and
Outlook Express from "Windows Update" for Win98. On Win2k, the CJK
support is present in all editions (as long as you install it).
Call DispatchMessage from gdk_events_queue() (and thus
gdk_WindowProc()), instead of duplicating the code in
gdk_WindowProc().
Reworked the grab handling and propagation code, factored out
duplicated code snippets into separate functions. Other cleanups,
too.
* gdk/win32/surrogate-dimm.h: Provide just the bits we need from
the <dimm.h> header describing the Active IMM.
* gdk/win32/gdkfont.c: Pretend to support fontsets, but so far
just do the same as for "single" fonts.
* gdk/win32/gdk.c: Call CoInitialize() (COM initialisation) from
gdk_init_check, and CoUninitialize() from gdk_exit_func. Handle
the new keysyms from gdkkeysyms.h.
* gtk/gtkfontsel.c (Win32): Load the font for the preview as a
fontset, so that gtkentry uses wide characters.
* gtk/gtkrc.c (Win32): Get the locale with gwin_getlocale(). Call
GTk+'s system directory "gtk+", not "gtk".
Sat Oct 30 13:17:18 BST 1999 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: FAQ update

View File

@ -1,3 +1,58 @@
1999-10-31 Tor Lillqvist <tml@iki.fi>
* gdk/gdkkeysyms.h: Add new keysyms from X11R6.4 (including
EuroSign).
* gdk/gdktypes.h: Add note about wchar_t not necessarily being the
same type as GdkWChar, especially on Win32.
* gdk/win32/*.c: Change gdk_root_parent to be a pointer.
* gdk/win32/*.c: Assume all strings are UTF-8. Convert to Unicode
before passing to Windows GDI for drawing etc. Convert to the
system default codepage before passing to Windows as window
titles.
* gdk/win32/gdkprivate.h: Add more fields to GdkWindowPrivate to
support changing input locale on the fly.
* gdk/win32/gdkevent.c: Support input language (keyboard locale)
on-the-fly changes. Convert incoming characters from the current
codepage to Unicode (and then to a UTF-8 multi-byte string) based
on the current input language. Use keysym<->Unicode mapping tables
and functions borrowed from xterm sources.
Support IMEs (Input Method Editors) for CJK languages. On non-CJK
editions of Win9x, use the ActiveX-based Active IMM (Input Method
Manager) if available. IMEs and the Active IMM are available under
the disguise of Chinese, Korean and Japanese support for IE and
Outlook Express from "Windows Update" for Win98. On Win2k, the CJK
support is present in all editions (as long as you install it).
Call DispatchMessage from gdk_events_queue() (and thus
gdk_WindowProc()), instead of duplicating the code in
gdk_WindowProc().
Reworked the grab handling and propagation code, factored out
duplicated code snippets into separate functions. Other cleanups,
too.
* gdk/win32/surrogate-dimm.h: Provide just the bits we need from
the <dimm.h> header describing the Active IMM.
* gdk/win32/gdkfont.c: Pretend to support fontsets, but so far
just do the same as for "single" fonts.
* gdk/win32/gdk.c: Call CoInitialize() (COM initialisation) from
gdk_init_check, and CoUninitialize() from gdk_exit_func. Handle
the new keysyms from gdkkeysyms.h.
* gtk/gtkfontsel.c (Win32): Load the font for the preview as a
fontset, so that gtkentry uses wide characters.
* gtk/gtkrc.c (Win32): Get the locale with gwin_getlocale(). Call
GTk+'s system directory "gtk+", not "gtk".
Sat Oct 30 13:17:18 BST 1999 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: FAQ update

View File

@ -3,29 +3,31 @@ correct as the Unix/X11 version. For more information about the Win32
port, see http://www.gimp.org/tml/gimp/win32/ or
http://www.iki.fi/tml/gimp/win32/ .
To build GTk+ on Win32, you need either Microsoft compiler and tools,
or gcc-2.95 or later running under cygwin-b20.1. Compile in gdk\win32
and gtk with `nmake -f makefile.msc` or `make -f
makefile.cygwin`. Before doing a install, check the BIN definition in
gdk\win32\makefile.msc (or makefile.cygwin) and gtk\makefile.msc (or
makefile.cygwin).
To build GTk+ on Win32, you need either the Microsoft compiler and
tools, or gcc-2.95 or later running under cygwin-b20.1 or
later. Compile in gdk\win32 and gtk with `nmake -f makefile.msc` or
`make -f makefile.cygwin`. Before doing a install, check the BIN
definition in gdk\win32\makefile.msc (or makefile.cygwin) and
gtk\makefile.msc (or makefile.cygwin).
See the README.win32 file in the GLib distribution for instructions
how to build with gcc.
The tablet support uses the Wintab API. The Wintab development kit can
be downloaded from http://www.pointing.com. If you don't care for
that, undefine HAVE_WINTAB in config.h.win32 before building.
that, undefine HAVE_WINTAB in config.h.win32 and remove references to
the wntab32x library from the makefile before building.
GTk+ wants to be built with the GNU "intl" library for
internationalisation (i18n). Get the version ported to Win32 (not a
very big deal) from tml's web site mentioned above. We build the
"intl" library to a DLL called gnu-intl.dll to reduce name clash
risks. If you don't want any i18n stuff, undefine ENABLE_NLS,
HAVE_GETTEXT and HAVE_LIBINTL in the config.h.win32 file, and remove
references to the gnu-intl library from the makefiles.
"intl" library as a DLL called gnu-intl.dll (the "gnu" prefix is used
to reduce name clash risks). If you don't want any i18n stuff,
undefine ENABLE_NLS, HAVE_GETTEXT and HAVE_LIBINTL in the
config.h.win32 file, and remove references to the gnu-intl library
from the makefiles.
Note that while the GNU gettext package is under the GPL, the "intl"
library part as distributed with GNU libc is under the LGPL (like GTk+
part of it as distributed with GNU libc is under the LGPL (like GTk+
or GLib). We want the LGPL one, even if they are the same, more or
less.

View File

@ -1,4 +1,4 @@
/* config.h.win32. Handcrafted for Microsoft C */
/* config.h.win32. Handcrafted for Microsoft C and gcc -mno-cygwin */
#if ! (defined(_MSC_VER) || defined(__GNUC__))
#error Unrecognized Win32 compiler, edit config.h.win32 by hand
@ -185,3 +185,10 @@
/* Define if you have the Wintab programmer's kit */
#define HAVE_WINTAB 1
/* Define if you have the <dimm.h> header file
* (available in the Platform SDK)
*/
#ifdef _MSC_VER
#define HAVE_DIMM_H 1
#endif

View File

@ -10,6 +10,7 @@
#define GDK_Escape 0xFF1B
#define GDK_Delete 0xFFFF
#define GDK_Multi_key 0xFF20
#define GDK_Codeinput 0xFF37
#define GDK_SingleCandidate 0xFF3C
#define GDK_MultipleCandidate 0xFF3D
#define GDK_PreviousCandidate 0xFF3E
@ -30,6 +31,7 @@
#define GDK_Kana_Shift 0xFF2E
#define GDK_Eisu_Shift 0xFF2F
#define GDK_Eisu_toggle 0xFF30
#define GDK_Kanji_Bangou 0xFF37
#define GDK_Zen_Koho 0xFF3D
#define GDK_Mae_Koho 0xFF3E
#define GDK_Home 0xFF50
@ -608,6 +610,9 @@
#define GDK_uogonek 0x3f9
#define GDK_utilde 0x3fd
#define GDK_umacron 0x3fe
#define GDK_OE 0x13bc
#define GDK_oe 0x13bd
#define GDK_Ydiaeresis 0x13be
#define GDK_overline 0x47e
#define GDK_kana_fullstop 0x4a1
#define GDK_kana_openingbracket 0x4a2
@ -1315,3 +1320,16 @@
#define GDK_Hangul_J_KkogjiDalrinIeung 0xef9
#define GDK_Hangul_J_YeorinHieuh 0xefa
#define GDK_Korean_Won 0xeff
#define GDK_EcuSign 0x20a0
#define GDK_ColonSign 0x20a1
#define GDK_CruzeiroSign 0x20a2
#define GDK_FFrancSign 0x20a3
#define GDK_LiraSign 0x20a4
#define GDK_MillSign 0x20a5
#define GDK_NairaSign 0x20a6
#define GDK_PesetaSign 0x20a7
#define GDK_RupeeSign 0x20a8
#define GDK_WonSign 0x20a9
#define GDK_NewSheqelSign 0x20aa
#define GDK_DongSign 0x20ab
#define GDK_EuroSign 0x20ac

View File

@ -68,6 +68,11 @@ typedef struct _GdkPoint GdkPoint;
typedef struct _GdkRectangle GdkRectangle;
typedef struct _GdkSegment GdkSegment;
/*
* Note that on some platforms the wchar_t type
* is not the same as GdkWChar. For instance
* on Win32, wchar_t is unsigned short.
*/
typedef guint32 GdkWChar;
typedef gulong GdkAtom;

View File

@ -38,11 +38,11 @@
#include "gdkinputprivate.h"
#include "gdkkeysyms.h"
#include <objbase.h>
static void gdkx_XConvertCase (KeySym symbol,
KeySym *lower,
KeySym *upper);
#define XConvertCase gdkx_XConvertCase
static void gdk_exit_func (void);
@ -234,6 +234,9 @@ gdk_init_check (int *argc,
gdk_ProgInstance = GetModuleHandle (NULL);
gdk_DC = CreateDC ("DISPLAY", NULL, NULL, NULL);
gdk_root_window = GetDesktopWindow ();
CoInitialize (NULL);
gdk_selection_request_msg = RegisterWindowMessage ("gdk-selection-request");
gdk_selection_notify_msg = RegisterWindowMessage ("gdk-selection-notify");
@ -247,8 +250,6 @@ gdk_init_check (int *argc,
gdk_progclass = g_basename (g_get_prgname ());
gdk_progclass[0] = toupper (gdk_progclass[0]);
gdk_root_window = HWND_DESKTOP;
g_atexit (gdk_exit_func);
gdk_events_init ();
@ -333,7 +334,7 @@ gdk_screen_width (void)
{
gint return_val;
return_val = gdk_root_parent.drawable.width;
return_val = gdk_root_parent->drawable.width;
return return_val;
}
@ -358,7 +359,7 @@ gdk_screen_height (void)
{
gint return_val;
return_val = gdk_root_parent.drawable.height;
return_val = gdk_root_parent->drawable.height;
return return_val;
}
@ -498,6 +499,9 @@ gdk_exit_func (void)
gdk_input_exit ();
gdk_key_repeat_restore ();
gdk_dnd_exit ();
CoUninitialize ();
DeleteDC (gdk_DC);
gdk_DC = NULL;
gdk_initialized = 0;
@ -1670,6 +1674,22 @@ static struct gdk_key {
{ 0x000ef9, "Hangul_J_KkogjiDalrinIeung" },
{ 0x000efa, "Hangul_J_YeorinHieuh" },
{ 0x000eff, "Korean_Won" },
{ 0x0013bc, "OE" },
{ 0x0013bd, "oe" },
{ 0x0013be, "Ydiaeresis" },
{ 0x0020a0, "EcuSign" },
{ 0x0020a1, "ColonSign" },
{ 0x0020a2, "CruzeiroSign" },
{ 0x0020a3, "FFrancSign" },
{ 0x0020a4, "LiraSign" },
{ 0x0020a5, "MillSign" },
{ 0x0020a6, "NairaSign" },
{ 0x0020a7, "PesetaSign" },
{ 0x0020a8, "RupeeSign" },
{ 0x0020a9, "WonSign" },
{ 0x0020aa, "NewSheqelSign" },
{ 0x0020ab, "DongSign" },
{ 0x0020ac, "EuroSign" },
{ 0x00fd01, "3270_Duplicate" },
{ 0x00fd02, "3270_FieldMark" },
{ 0x00fd03, "3270_Right2" },
@ -1826,11 +1846,21 @@ static struct gdk_key {
{ 0x00ff2e, "Kana_Shift" },
{ 0x00ff2f, "Eisu_Shift" },
{ 0x00ff30, "Eisu_toggle" },
{ 0x00ff31, "Hangul" },
{ 0x00ff32, "Hangul_Start" },
{ 0x00ff33, "Hangul_End" },
{ 0x00ff34, "Hangul_Hanja" },
{ 0x00ff35, "Hangul_Jamo" },
{ 0x00ff36, "Hangul_Romaja" },
{ 0x00ff37, "Codeinput" },
{ 0x00ff38, "Hangul_Jeonja" },
{ 0x00ff39, "Hangul_Banja" },
{ 0x00ff3a, "Hangul_PreHanja" },
{ 0x00ff3b, "Hangul_PostHanja" },
{ 0x00ff3c, "SingleCandidate" },
{ 0x00ff3d, "MultipleCandidate" },
{ 0x00ff3d, "Zen_Koho" },
{ 0x00ff3e, "Mae_Koho" },
{ 0x00ff3e, "PreviousCandidate" },
{ 0x00ff3f, "Hangul_Special" },
{ 0x00ff50, "Home" },
{ 0x00ff51, "Left" },
{ 0x00ff52, "Up" },
@ -1949,21 +1979,6 @@ static struct gdk_key {
{ 0x00ffed, "Hyper_L" },
{ 0x00ffee, "Hyper_R" },
{ 0x00ffff, "Delete" },
{ 0x00ff31, "Hangul" },
{ 0x00ff32, "Hangul_Start" },
{ 0x00ff33, "Hangul_End" },
{ 0x00ff34, "Hangul_Hanja" },
{ 0x00ff35, "Hangul_Jamo" },
{ 0x00ff36, "Hangul_Romaja" },
{ 0x00ff37, "Hangul_Codeinput" },
{ 0x00ff38, "Hangul_Jeonja" },
{ 0x00ff39, "Hangul_Banja" },
{ 0x00ff3a, "Hangul_PreHanja" },
{ 0x00ff3b, "Hangul_PostHanja" },
{ 0x00ff3c, "Hangul_SingleCandidate" },
{ 0x00ff3d, "Hangul_MultipleCandidate" },
{ 0x00ff3e, "Hangul_PreviousCandidate" },
{ 0x00ff3f, "Hangul_Special" },
{ 0xffffff, "VoidSymbol" },
};
@ -1985,7 +2000,7 @@ gdk_keyval_name (guint keyval)
GDK_NUM_KEYS, sizeof (struct gdk_key),
gdk_keys_keyval_compare);
if (found != NULL)
return found->name;
return (gchar *) found->name;
else
return NULL;
}
@ -2037,7 +2052,7 @@ gdk_keyval_to_upper (guint keyval)
KeySym lower_val = 0;
KeySym upper_val = 0;
XConvertCase (keyval, &lower_val, &upper_val);
gdkx_XConvertCase (keyval, &lower_val, &upper_val);
return upper_val;
}
return 0;
@ -2051,7 +2066,7 @@ gdk_keyval_to_lower (guint keyval)
KeySym lower_val = 0;
KeySym upper_val = 0;
XConvertCase (keyval, &lower_val, &upper_val);
gdkx_XConvertCase (keyval, &lower_val, &upper_val);
return lower_val;
}
return 0;
@ -2065,7 +2080,7 @@ gdk_keyval_is_upper (guint keyval)
KeySym lower_val = 0;
KeySym upper_val = 0;
XConvertCase (keyval, &lower_val, &upper_val);
gdkx_XConvertCase (keyval, &lower_val, &upper_val);
return upper_val == keyval;
}
return TRUE;
@ -2079,7 +2094,7 @@ gdk_keyval_is_lower (guint keyval)
KeySym lower_val = 0;
KeySym upper_val = 0;
XConvertCase (keyval, &lower_val, &upper_val);
gdkx_XConvertCase (keyval, &lower_val, &upper_val);
return lower_val == keyval;
}
return TRUE;

View File

@ -5,3 +5,4 @@
#ifdef _MSC_VER
#define GDK_HAVE_WCTYPE_H 1
#endif
#define GDK_USE_UTF8_MBS 1

View File

@ -38,6 +38,8 @@
#ifdef OLE2_DND
#include <ole2.h>
#else
#include <objbase.h>
#endif
#ifdef _MSC_VER /* These aren't in mingw32 */
@ -596,7 +598,7 @@ gdk_dropfiles_filter (GdkXEvent *xev,
private = (GdkDragContextPrivate *) context;
context->protocol = GDK_DRAG_PROTO_WIN32_DROPFILES;
context->is_source = FALSE;
context->source_window = (GdkWindow *) &gdk_root_parent;
context->source_window = (GdkWindow *) gdk_root_parent;
context->dest_window = event->any.window;
gdk_window_ref (context->dest_window);
/* WM_DROPFILES drops are always file names */
@ -638,7 +640,7 @@ gdk_dropfiles_filter (GdkXEvent *xev,
}
g_string_append (result, "\015\012");
}
gdk_sel_prop_store ((GdkWindow *) &gdk_root_parent,
gdk_sel_prop_store ((GdkWindow *) gdk_root_parent,
text_uri_list_atom, 8, result->str, result->len + 1);
DragFinish (hdrop);

View File

@ -38,6 +38,8 @@
#ifdef OLE2_DND
#include <ole2.h>
#else
#include <objbase.h>
#endif
#ifdef _MSC_VER /* These aren't in mingw32 */
@ -596,7 +598,7 @@ gdk_dropfiles_filter (GdkXEvent *xev,
private = (GdkDragContextPrivate *) context;
context->protocol = GDK_DRAG_PROTO_WIN32_DROPFILES;
context->is_source = FALSE;
context->source_window = (GdkWindow *) &gdk_root_parent;
context->source_window = (GdkWindow *) gdk_root_parent;
context->dest_window = event->any.window;
gdk_window_ref (context->dest_window);
/* WM_DROPFILES drops are always file names */
@ -638,7 +640,7 @@ gdk_dropfiles_filter (GdkXEvent *xev,
}
g_string_append (result, "\015\012");
}
gdk_sel_prop_store ((GdkWindow *) &gdk_root_parent,
gdk_sel_prop_store ((GdkWindow *) gdk_root_parent,
text_uri_list_atom, 8, result->str, result->len + 1);
DragFinish (hdrop);

View File

@ -469,47 +469,35 @@ gdk_draw_text (GdkDrawable *drawable,
if (text_length == 0)
return;
g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET);
drawable_private = (GdkDrawablePrivate*) drawable;
gc_private = (GdkGCPrivate*) gc;
font_private = (GdkFontPrivate*) font;
if (font->type == GDK_FONT_FONT)
{
hdc = gdk_gc_predraw (drawable_private, gc_private);
xfont = (HFONT) font_private->xfont;
hdc = gdk_gc_predraw (drawable_private, gc_private);
xfont = (HFONT) font_private->xfont;
GDK_NOTE (MISC, g_print ("gdk_draw_text: %#x (%d) %#x "
"+%d+%d font: %#x \"%.*s\" length: %d\n",
drawable_private->xwindow,
gc_private, gc_private->xgc,
x, y, xfont,
(text_length > 10 ? 10 : text_length),
text, text_length));
if ((oldfont = SelectObject (hdc, xfont)) == NULL)
g_warning ("gdk_draw_text: SelectObject failed");
if (font_private->cpinfo.MaxCharSize > 1)
{
wcstr = g_new (wchar_t, text_length);
if ((wlen = MultiByteToWideChar (font_private->codepage, 0,
text, text_length,
wcstr, text_length)) == 0)
g_warning ("gdk_draw_text: MultiByteToWideChar failed");
else if (!TextOutW (hdc, x, y, wcstr, wlen))
g_warning ("gdk_draw_text: TextOutW failed");
g_free (wcstr);
}
else
{
if (!TextOutA (hdc, x, y, text, text_length))
g_warning ("gdk_draw_text: TextOutA failed");
}
if (oldfont != NULL)
SelectObject (hdc, oldfont);
gdk_gc_postdraw (drawable_private, gc_private);
}
else
g_error ("undefined font type");
GDK_NOTE (MISC, g_print ("gdk_draw_text: %#x (%d) %#x "
"+%d+%d font: %#x \"%.*s\" length: %d\n",
drawable_private->xwindow,
gc_private, gc_private->xgc,
x, y, xfont,
(text_length > 10 ? 10 : text_length),
text, text_length));
if ((oldfont = SelectObject (hdc, xfont)) == NULL)
g_warning ("gdk_draw_text: SelectObject failed");
wcstr = g_new (wchar_t, text_length);
if ((wlen = gdk_nmbstowchar_ts (wcstr, text, text_length, text_length)) == -1)
g_warning ("gdk_draw_text: gdk_nmbstowchar_ts failed");
else if (!TextOutW (hdc, x, y, wcstr, wlen))
g_warning ("gdk_draw_text: TextOutW failed");
g_free (wcstr);
if (oldfont != NULL)
SelectObject (hdc, oldfont);
gdk_gc_postdraw (drawable_private, gc_private);
}
void
@ -521,6 +509,8 @@ gdk_draw_text_wc (GdkDrawable *drawable,
const GdkWChar *text,
gint text_length)
{
HDC hdc;
HGDIOBJ oldfont;
GdkDrawablePrivate *drawable_private;
GdkFontPrivate *font_private;
GdkGCPrivate *gc_private;
@ -539,68 +529,40 @@ gdk_draw_text_wc (GdkDrawable *drawable,
if (text_length == 0)
return;
g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET);
drawable_private = (GdkDrawablePrivate*) drawable;
gc_private = (GdkGCPrivate*) gc;
font_private = (GdkFontPrivate*) font;
if (font->type == GDK_FONT_FONT)
{
HDC hdc;
HFONT xfont;
HGDIOBJ oldfont;
hdc = gdk_gc_predraw (drawable_private, gc_private);
hdc = gdk_gc_predraw (drawable_private, gc_private);
xfont = (HFONT) font_private->xfont;
GDK_NOTE (MISC, g_print ("gdk_draw_text_wc: %#x (%d) %#x "
"+%d+%d font: %#x length: %d\n",
drawable_private->xwindow,
gc_private, gc_private->xgc,
x, y, xfont,
text_length));
GDK_NOTE (MISC, g_print ("gdk_draw_text_wc: %#x (%d) %#x "
"+%d+%d font: %#x length: %d\n",
drawable_private->xwindow,
gc_private, gc_private->xgc,
x, y, font_private->xfont,
text_length));
if ((oldfont = SelectObject (hdc, xfont)) == NULL)
g_warning ("gdk_draw_text_wc: SelectObject failed");
#if 0 /* No. Don't use TextOutW directly. Compare to the X11 version,
* it uses plain XDrawString for GDK_FONT_FONT fonts, too.
* TextOutW by definition interprets the string as Unicode.
* We don't have that, but either chars from some single-byte codepage
* or from a DBCS.
*/
if ((oldfont = SelectObject (hdc, font_private->xfont)) == NULL)
g_warning ("gdk_draw_text_wc: SelectObject failed");
if (sizeof (wchar_t) != sizeof (GdkWChar))
{
wcstr = g_new (wchar_t, text_length);
for (i = 0; i < text_length; i++)
wcstr[i] = text[i];
if (!TextOutW (hdc, x, y, wcstr, text_length))
g_warning ("gdk_draw_text_wc: TextOutW failed");
g_free (wcstr);
#else
str = g_new (guchar, text_length);
for (i = 0; i < text_length; i++)
str[i] = text[i];
if (font_private->cpinfo.MaxCharSize > 1)
{
wcstr = g_new (wchar_t, text_length);
if ((wlen = MultiByteToWideChar (font_private->codepage, 0,
str, text_length,
wcstr, text_length)) == 0)
g_warning ("gdk_draw_text: MultiByteToWideChar failed");
else if (!TextOutW (hdc, x, y, wcstr, wlen))
g_warning ("gdk_draw_text_wc: TextOutW failed");
g_free (wcstr);
}
else
{
if (!TextOutA (hdc, x, y, str, text_length))
g_warning ("gdk_draw_text_wc: TextOutA failed");
}
g_free (str);
#endif
if (oldfont != NULL)
SelectObject (hdc, oldfont);
gdk_gc_postdraw (drawable_private, gc_private);
}
else
g_error ("undefined font type");
wcstr = (wchar_t *) text;
if (!TextOutW (hdc, x, y, wcstr, text_length))
g_warning ("gdk_draw_text_wc: TextOutW failed");
if (sizeof (wchar_t) != sizeof (GdkWChar))
g_free (wcstr);
if (oldfont != NULL)
SelectObject (hdc, oldfont);
gdk_gc_postdraw (drawable_private, gc_private);
}
void

View File

@ -469,47 +469,35 @@ gdk_draw_text (GdkDrawable *drawable,
if (text_length == 0)
return;
g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET);
drawable_private = (GdkDrawablePrivate*) drawable;
gc_private = (GdkGCPrivate*) gc;
font_private = (GdkFontPrivate*) font;
if (font->type == GDK_FONT_FONT)
{
hdc = gdk_gc_predraw (drawable_private, gc_private);
xfont = (HFONT) font_private->xfont;
hdc = gdk_gc_predraw (drawable_private, gc_private);
xfont = (HFONT) font_private->xfont;
GDK_NOTE (MISC, g_print ("gdk_draw_text: %#x (%d) %#x "
"+%d+%d font: %#x \"%.*s\" length: %d\n",
drawable_private->xwindow,
gc_private, gc_private->xgc,
x, y, xfont,
(text_length > 10 ? 10 : text_length),
text, text_length));
if ((oldfont = SelectObject (hdc, xfont)) == NULL)
g_warning ("gdk_draw_text: SelectObject failed");
if (font_private->cpinfo.MaxCharSize > 1)
{
wcstr = g_new (wchar_t, text_length);
if ((wlen = MultiByteToWideChar (font_private->codepage, 0,
text, text_length,
wcstr, text_length)) == 0)
g_warning ("gdk_draw_text: MultiByteToWideChar failed");
else if (!TextOutW (hdc, x, y, wcstr, wlen))
g_warning ("gdk_draw_text: TextOutW failed");
g_free (wcstr);
}
else
{
if (!TextOutA (hdc, x, y, text, text_length))
g_warning ("gdk_draw_text: TextOutA failed");
}
if (oldfont != NULL)
SelectObject (hdc, oldfont);
gdk_gc_postdraw (drawable_private, gc_private);
}
else
g_error ("undefined font type");
GDK_NOTE (MISC, g_print ("gdk_draw_text: %#x (%d) %#x "
"+%d+%d font: %#x \"%.*s\" length: %d\n",
drawable_private->xwindow,
gc_private, gc_private->xgc,
x, y, xfont,
(text_length > 10 ? 10 : text_length),
text, text_length));
if ((oldfont = SelectObject (hdc, xfont)) == NULL)
g_warning ("gdk_draw_text: SelectObject failed");
wcstr = g_new (wchar_t, text_length);
if ((wlen = gdk_nmbstowchar_ts (wcstr, text, text_length, text_length)) == -1)
g_warning ("gdk_draw_text: gdk_nmbstowchar_ts failed");
else if (!TextOutW (hdc, x, y, wcstr, wlen))
g_warning ("gdk_draw_text: TextOutW failed");
g_free (wcstr);
if (oldfont != NULL)
SelectObject (hdc, oldfont);
gdk_gc_postdraw (drawable_private, gc_private);
}
void
@ -521,6 +509,8 @@ gdk_draw_text_wc (GdkDrawable *drawable,
const GdkWChar *text,
gint text_length)
{
HDC hdc;
HGDIOBJ oldfont;
GdkDrawablePrivate *drawable_private;
GdkFontPrivate *font_private;
GdkGCPrivate *gc_private;
@ -539,68 +529,40 @@ gdk_draw_text_wc (GdkDrawable *drawable,
if (text_length == 0)
return;
g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET);
drawable_private = (GdkDrawablePrivate*) drawable;
gc_private = (GdkGCPrivate*) gc;
font_private = (GdkFontPrivate*) font;
if (font->type == GDK_FONT_FONT)
{
HDC hdc;
HFONT xfont;
HGDIOBJ oldfont;
hdc = gdk_gc_predraw (drawable_private, gc_private);
hdc = gdk_gc_predraw (drawable_private, gc_private);
xfont = (HFONT) font_private->xfont;
GDK_NOTE (MISC, g_print ("gdk_draw_text_wc: %#x (%d) %#x "
"+%d+%d font: %#x length: %d\n",
drawable_private->xwindow,
gc_private, gc_private->xgc,
x, y, xfont,
text_length));
GDK_NOTE (MISC, g_print ("gdk_draw_text_wc: %#x (%d) %#x "
"+%d+%d font: %#x length: %d\n",
drawable_private->xwindow,
gc_private, gc_private->xgc,
x, y, font_private->xfont,
text_length));
if ((oldfont = SelectObject (hdc, xfont)) == NULL)
g_warning ("gdk_draw_text_wc: SelectObject failed");
#if 0 /* No. Don't use TextOutW directly. Compare to the X11 version,
* it uses plain XDrawString for GDK_FONT_FONT fonts, too.
* TextOutW by definition interprets the string as Unicode.
* We don't have that, but either chars from some single-byte codepage
* or from a DBCS.
*/
if ((oldfont = SelectObject (hdc, font_private->xfont)) == NULL)
g_warning ("gdk_draw_text_wc: SelectObject failed");
if (sizeof (wchar_t) != sizeof (GdkWChar))
{
wcstr = g_new (wchar_t, text_length);
for (i = 0; i < text_length; i++)
wcstr[i] = text[i];
if (!TextOutW (hdc, x, y, wcstr, text_length))
g_warning ("gdk_draw_text_wc: TextOutW failed");
g_free (wcstr);
#else
str = g_new (guchar, text_length);
for (i = 0; i < text_length; i++)
str[i] = text[i];
if (font_private->cpinfo.MaxCharSize > 1)
{
wcstr = g_new (wchar_t, text_length);
if ((wlen = MultiByteToWideChar (font_private->codepage, 0,
str, text_length,
wcstr, text_length)) == 0)
g_warning ("gdk_draw_text: MultiByteToWideChar failed");
else if (!TextOutW (hdc, x, y, wcstr, wlen))
g_warning ("gdk_draw_text_wc: TextOutW failed");
g_free (wcstr);
}
else
{
if (!TextOutA (hdc, x, y, str, text_length))
g_warning ("gdk_draw_text_wc: TextOutA failed");
}
g_free (str);
#endif
if (oldfont != NULL)
SelectObject (hdc, oldfont);
gdk_gc_postdraw (drawable_private, gc_private);
}
else
g_error ("undefined font type");
wcstr = (wchar_t *) text;
if (!TextOutW (hdc, x, y, wcstr, text_length))
g_warning ("gdk_draw_text_wc: TextOutW failed");
if (sizeof (wchar_t) != sizeof (GdkWChar))
g_free (wcstr);
if (oldfont != NULL)
SelectObject (hdc, oldfont);
gdk_gc_postdraw (drawable_private, gc_private);
}
void

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -117,7 +117,8 @@ charset_name (DWORD charset)
}
GdkFont*
gdk_font_load (const gchar *font_name)
gdk_font_load_internal (GdkFontType type,
const gchar *font_name)
{
GdkFont *font;
GdkFontPrivate *private;
@ -142,9 +143,9 @@ gdk_font_load (const gchar *font_name)
g_return_val_if_fail (font_name != NULL, NULL);
GDK_NOTE (MISC, g_print ("gdk_font_load: %s\n", font_name));
GDK_NOTE (MISC, g_print ("gdk_font_load_internal: %s\n", font_name));
font = gdk_font_hash_lookup (GDK_FONT_FONT, font_name);
font = gdk_font_hash_lookup (type, font_name);
if (font)
return font;
@ -417,7 +418,6 @@ gdk_font_load (const gchar *font_name)
private->xfont = hfont;
private->ref_count = 1;
private->names = NULL;
font->type = GDK_FONT_FONT;
GetObject (private->xfont, sizeof (logfont), &logfont);
oldfont = SelectObject (gdk_DC, private->xfont);
GetTextMetrics (gdk_DC, &textmetric);
@ -426,6 +426,7 @@ gdk_font_load (const gchar *font_name)
TranslateCharsetInfo ((DWORD *) private->charset, &csi, TCI_SRCCHARSET);
private->codepage = csi.ciACP;
GetCPInfo (private->codepage, &private->cpinfo);
font->type = type;
font->ascent = textmetric.tmAscent;
font->descent = textmetric.tmDescent;
@ -442,17 +443,21 @@ gdk_font_load (const gchar *font_name)
*f = (HANDLE) ((guint) private->xfont + HFONT_DITHER);
gdk_xid_table_insert (f, font);
gdk_font_hash_insert (GDK_FONT_FONT, font, font_name);
gdk_font_hash_insert (type, font, font_name);
return font;
}
GdkFont*
gdk_font_load (const gchar *font_name)
{
return gdk_font_load_internal (GDK_FONT_FONT, font_name);
}
GdkFont*
gdk_fontset_load (gchar *fontset_name)
{
g_warning ("gdk_fontset_load: Not implemented");
return NULL;
return gdk_font_load_internal (GDK_FONT_FONTSET, fontset_name);
}
GdkFont*
@ -493,6 +498,7 @@ gdk_font_unref (GdkFont *font)
switch (font->type)
{
case GDK_FONT_FONT:
case GDK_FONT_FONTSET: /* XXX */
gdk_xid_table_remove ((HANDLE) ((guint) private->xfont + HFONT_DITHER));
DeleteObject (private->xfont);
break;
@ -515,9 +521,8 @@ gdk_font_id (const GdkFont *font)
if (font->type == GDK_FONT_FONT)
return (gint) font_private->xfont;
g_assert_not_reached ();
return 0;
else
return 0;
}
gint
@ -535,9 +540,10 @@ gdk_font_equal (const GdkFont *fonta,
if (fonta->type == GDK_FONT_FONT && fontb->type == GDK_FONT_FONT)
return (privatea->xfont == privateb->xfont);
g_assert_not_reached ();
return 0;
else if (fonta->type == GDK_FONT_FONTSET && fontb->type == GDK_FONT_FONTSET)
return (privatea->xfont == privateb->xfont);
else
return 0;
}
gint
@ -547,55 +553,59 @@ gdk_string_width (GdkFont *font,
return gdk_text_width (font, string, strlen (string));
}
gint
gdk_text_width (GdkFont *font,
const gchar *text,
gint text_length)
static gboolean
gdk_text_size (GdkFont *font,
const gchar *text,
gint text_length,
SIZE *sizep)
{
GdkFontPrivate *private;
HGDIOBJ oldfont;
SIZE size;
gint width, wlen;
gint wlen;
wchar_t *wcstr;
g_return_val_if_fail (font != NULL, -1);
g_return_val_if_fail (text != NULL, -1);
g_return_val_if_fail (font != NULL, FALSE);
g_return_val_if_fail (text != NULL, FALSE);
if (text_length == 0)
return 0;
private = (GdkFontPrivate*) font;
switch (font->type)
{
case GDK_FONT_FONT:
oldfont = SelectObject (gdk_DC, private->xfont);
if (private->cpinfo.MaxCharSize > 1)
{
wcstr = g_new (wchar_t, text_length);
if ((wlen = MultiByteToWideChar (private->codepage, 0,
text, text_length,
wcstr, text_length)) == 0)
{
g_warning ("gdk_text_width: MultiByteToWideChar failed");
size.cx = 0;
}
else
GetTextExtentPoint32W (gdk_DC, wcstr, wlen, &size);
g_free (wcstr);
}
else
{
GetTextExtentPoint32A (gdk_DC, text, text_length, &size);
}
SelectObject (gdk_DC, oldfont);
width = size.cx;
break;
g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET);
default:
g_assert_not_reached ();
if ((oldfont = SelectObject (gdk_DC, private->xfont)) == NULL)
{
g_warning ("gdk_text_width: SelectObject failed");
return FALSE;
}
return width;
wcstr = g_new (wchar_t, text_length);
if ((wlen = gdk_nmbstowchar_ts (wcstr, text, text_length, text_length)) == -1)
{
g_warning ("gdk_text_size: gdk_nmbstowchar_ts failed");
return FALSE;
}
GetTextExtentPoint32W (gdk_DC, wcstr, wlen, sizep);
g_free (wcstr);
SelectObject (gdk_DC, oldfont);
return TRUE;
}
gint
gdk_text_width (GdkFont *font,
const gchar *text,
gint text_length)
{
SIZE size;
if (!gdk_text_size (font, text, text_length, &size))
return -1;
return size.cx;
}
gint
@ -608,7 +618,7 @@ gdk_text_width_wc (GdkFont *font,
SIZE size;
wchar_t *wcstr;
guchar *str;
gint i, width, wlen;
gint i;
g_return_val_if_fail (font != NULL, -1);
g_return_val_if_fail (text != NULL, -1);
@ -616,58 +626,44 @@ gdk_text_width_wc (GdkFont *font,
if (text_length == 0)
return 0;
g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET);
private = (GdkFontPrivate*) font;
switch (font->type)
if ((oldfont = SelectObject (gdk_DC, private->xfont)) == NULL)
g_warning ("gdk_text_width_wc: SelectObject failed");
if (sizeof (wchar_t) != sizeof (GdkWChar))
{
case GDK_FONT_FONT:
oldfont = SelectObject (gdk_DC, private->xfont);
#if 0 /* No. Don't assume Unicode here either.
* (Read the comments in gdk_draw_text_wc.)
*/
wcstr = g_new (wchar_t, text_length);
for (i = 0; i < text_length; i++)
wcstr[i] = text[i];
GetTextExtentPoint32W (gdk_DC, wcstr, text_length, &size);
g_free (wcstr);
#else
str = g_new (guchar, text_length);
for (i = 0; i < text_length; i++)
str[i] = text[i];
if (private->cpinfo.MaxCharSize > 1)
{
wcstr = g_new (wchar_t, text_length);
if ((wlen = MultiByteToWideChar (private->codepage, 0,
str, text_length,
wcstr, text_length)) == 0)
{
g_warning ("gdk_text_width_wc: MultiByteToWideChar failed");
size.cx = 0;
}
else
GetTextExtentPoint32W (gdk_DC, wcstr, wlen, &size);
g_free (wcstr);
}
else
{
GetTextExtentPoint32A (gdk_DC, str, text_length, &size);
}
g_free (str);
#endif
SelectObject (gdk_DC, oldfont);
width = size.cx;
break;
default:
width = 0;
}
return width;
else
wcstr = (wchar_t *) text;
GetTextExtentPoint32W (gdk_DC, wcstr, text_length, &size);
if (sizeof (wchar_t) != sizeof (GdkWChar))
g_free (wcstr);
if (oldfont != NULL)
SelectObject (gdk_DC, oldfont);
return size.cx;
}
gint
gdk_char_width (GdkFont *font,
gchar character)
{
if (((guchar) character) >= 128)
{
/* gtktext calls us with non-ASCII characters, sigh */
GdkWChar wc = (guchar) character;
return gdk_text_width_wc (font, &wc, 1);
}
return gdk_text_width (font, &character, 1);
}
@ -722,48 +718,37 @@ gdk_text_extents (GdkFont *font,
return;
}
g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET);
private = (GdkFontPrivate*) font;
switch (font->type)
{
case GDK_FONT_FONT:
oldfont = SelectObject (gdk_DC, private->xfont);
if (private->cpinfo.MaxCharSize > 1)
{
wcstr = g_new (wchar_t, text_length);
if ((wlen = MultiByteToWideChar (private->codepage, 0,
text, text_length,
wcstr, text_length)) == 0)
{
g_warning ("gdk_text_extents: MultiByteToWideChar failed");
size.cx = 0;
size.cy = 0;
}
else
GetTextExtentPoint32W (gdk_DC, wcstr, wlen, &size);
g_free (wcstr);
}
else
{
GetTextExtentPoint32A (gdk_DC, text, text_length, &size);
}
SelectObject (gdk_DC, oldfont);
/* XXX This is all quite bogus */
if (lbearing)
*lbearing = 0;
if (rbearing)
*rbearing = 0;
if (width)
*width = size.cx;
if (ascent)
*ascent = size.cy + 1;
if (descent)
*descent = font->descent + 1;
break;
if ((oldfont = SelectObject (gdk_DC, private->xfont)) == NULL)
g_warning ("gdk_text_extents: SelectObject failed");
default:
g_assert_not_reached ();
wcstr = g_new (wchar_t, text_length);
if ((wlen = gdk_nmbstowchar_ts (wcstr, text, text_length, text_length)) == -1)
{
g_warning ("gdk_text_extents: gdk_nmbstowchar_ts failed");
size.cx = 0;
size.cy = 0;
}
else
GetTextExtentPoint32W (gdk_DC, wcstr, wlen, &size);
if (oldfont != NULL)
SelectObject (gdk_DC, oldfont);
/* XXX This is all quite bogus */
if (lbearing)
*lbearing = 0;
if (rbearing)
*rbearing = 0;
if (width)
*width = size.cx;
if (ascent)
*ascent = size.cy + 1;
if (descent)
*descent = font->descent + 1;
}
void
@ -800,35 +785,41 @@ gdk_text_extents_wc (GdkFont *font,
return;
}
g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET);
private = (GdkFontPrivate*) font;
switch (font->type)
if (sizeof (wchar_t) != sizeof (GdkWChar))
{
case GDK_FONT_FONT:
wcstr = g_new (wchar_t, text_length);
for (i = 0; i < text_length; i++)
wcstr[i] = text[i];
oldfont = SelectObject (gdk_DC, private->xfont);
GetTextExtentPoint32W (gdk_DC, wcstr, text_length, &size);
g_free (wcstr);
SelectObject (gdk_DC, oldfont);
/* XXX This is all quite bogus */
if (lbearing)
*lbearing = 0;
if (rbearing)
*rbearing = 0;
if (width)
*width = size.cx;
if (ascent)
*ascent = size.cy + 1;
if (descent)
*descent = font->descent + 1;
break;
default:
g_assert_not_reached ();
}
else
wcstr = (wchar_t *) text;
if ((oldfont = SelectObject (gdk_DC, private->xfont)) == NULL)
g_warning ("gdk_text_extents_wc: SelectObject failed");
GetTextExtentPoint32W (gdk_DC, wcstr, text_length, &size);
if (sizeof (wchar_t) != sizeof (GdkWChar))
g_free (wcstr);
if (oldfont != NULL)
SelectObject (gdk_DC, oldfont);
/* XXX This is all quite bogus */
if (lbearing)
*lbearing = 0;
if (rbearing)
*rbearing = 0;
if (width)
*width = size.cx;
if (ascent)
*ascent = size.cy + 1;
if (descent)
*descent = font->descent + 1;
}
void
@ -853,24 +844,7 @@ gdk_text_measure (GdkFont *font,
const gchar *text,
gint text_length)
{
GdkFontPrivate *private;
gint width;
g_return_val_if_fail (font != NULL, -1);
g_return_val_if_fail (text != NULL, -1);
private = (GdkFontPrivate*) font;
switch (font->type)
{
case GDK_FONT_FONT:
return gdk_text_width (font, text, text_length); /* ??? */
break;
default:
g_assert_not_reached ();
}
return 0;
return gdk_text_width (font, text, text_length); /* ??? */
}
gint
@ -895,52 +869,12 @@ gdk_text_height (GdkFont *font,
const gchar *text,
gint text_length)
{
GdkFontPrivate *private;
HGDIOBJ oldfont;
SIZE size;
gint height, wlen;
wchar_t *wcstr;
g_return_val_if_fail (font != NULL, -1);
g_return_val_if_fail (text != NULL, -1);
if (!gdk_text_size (font, text, text_length, &size))
return -1;
if (text_length == 0)
return 0;
private = (GdkFontPrivate*) font;
switch (font->type)
{
case GDK_FONT_FONT:
oldfont = SelectObject (gdk_DC, private->xfont);
if (private->cpinfo.MaxCharSize > 1)
{
wcstr = g_new (wchar_t, text_length);
if ((wlen = MultiByteToWideChar (private->codepage, 0,
text, text_length,
wcstr, text_length)) == 0)
{
g_warning ("gdk_text_height: MultiByteToWideChar failed "
"text = %.*s (%d)",
text_length, text, text_length);
size.cy = 0;
}
else
GetTextExtentPoint32W (gdk_DC, wcstr, wlen, &size);
g_free (wcstr);
}
else
{
GetTextExtentPoint32A (gdk_DC, text, text_length, &size);
}
SelectObject (gdk_DC, oldfont);
height = size.cy;
break;
default:
g_error ("font->type = %d", font->type);
}
return height;
return size.cy;
}
gint

View File

@ -117,7 +117,8 @@ charset_name (DWORD charset)
}
GdkFont*
gdk_font_load (const gchar *font_name)
gdk_font_load_internal (GdkFontType type,
const gchar *font_name)
{
GdkFont *font;
GdkFontPrivate *private;
@ -142,9 +143,9 @@ gdk_font_load (const gchar *font_name)
g_return_val_if_fail (font_name != NULL, NULL);
GDK_NOTE (MISC, g_print ("gdk_font_load: %s\n", font_name));
GDK_NOTE (MISC, g_print ("gdk_font_load_internal: %s\n", font_name));
font = gdk_font_hash_lookup (GDK_FONT_FONT, font_name);
font = gdk_font_hash_lookup (type, font_name);
if (font)
return font;
@ -417,7 +418,6 @@ gdk_font_load (const gchar *font_name)
private->xfont = hfont;
private->ref_count = 1;
private->names = NULL;
font->type = GDK_FONT_FONT;
GetObject (private->xfont, sizeof (logfont), &logfont);
oldfont = SelectObject (gdk_DC, private->xfont);
GetTextMetrics (gdk_DC, &textmetric);
@ -426,6 +426,7 @@ gdk_font_load (const gchar *font_name)
TranslateCharsetInfo ((DWORD *) private->charset, &csi, TCI_SRCCHARSET);
private->codepage = csi.ciACP;
GetCPInfo (private->codepage, &private->cpinfo);
font->type = type;
font->ascent = textmetric.tmAscent;
font->descent = textmetric.tmDescent;
@ -442,17 +443,21 @@ gdk_font_load (const gchar *font_name)
*f = (HANDLE) ((guint) private->xfont + HFONT_DITHER);
gdk_xid_table_insert (f, font);
gdk_font_hash_insert (GDK_FONT_FONT, font, font_name);
gdk_font_hash_insert (type, font, font_name);
return font;
}
GdkFont*
gdk_font_load (const gchar *font_name)
{
return gdk_font_load_internal (GDK_FONT_FONT, font_name);
}
GdkFont*
gdk_fontset_load (gchar *fontset_name)
{
g_warning ("gdk_fontset_load: Not implemented");
return NULL;
return gdk_font_load_internal (GDK_FONT_FONTSET, fontset_name);
}
GdkFont*
@ -493,6 +498,7 @@ gdk_font_unref (GdkFont *font)
switch (font->type)
{
case GDK_FONT_FONT:
case GDK_FONT_FONTSET: /* XXX */
gdk_xid_table_remove ((HANDLE) ((guint) private->xfont + HFONT_DITHER));
DeleteObject (private->xfont);
break;
@ -515,9 +521,8 @@ gdk_font_id (const GdkFont *font)
if (font->type == GDK_FONT_FONT)
return (gint) font_private->xfont;
g_assert_not_reached ();
return 0;
else
return 0;
}
gint
@ -535,9 +540,10 @@ gdk_font_equal (const GdkFont *fonta,
if (fonta->type == GDK_FONT_FONT && fontb->type == GDK_FONT_FONT)
return (privatea->xfont == privateb->xfont);
g_assert_not_reached ();
return 0;
else if (fonta->type == GDK_FONT_FONTSET && fontb->type == GDK_FONT_FONTSET)
return (privatea->xfont == privateb->xfont);
else
return 0;
}
gint
@ -547,55 +553,59 @@ gdk_string_width (GdkFont *font,
return gdk_text_width (font, string, strlen (string));
}
gint
gdk_text_width (GdkFont *font,
const gchar *text,
gint text_length)
static gboolean
gdk_text_size (GdkFont *font,
const gchar *text,
gint text_length,
SIZE *sizep)
{
GdkFontPrivate *private;
HGDIOBJ oldfont;
SIZE size;
gint width, wlen;
gint wlen;
wchar_t *wcstr;
g_return_val_if_fail (font != NULL, -1);
g_return_val_if_fail (text != NULL, -1);
g_return_val_if_fail (font != NULL, FALSE);
g_return_val_if_fail (text != NULL, FALSE);
if (text_length == 0)
return 0;
private = (GdkFontPrivate*) font;
switch (font->type)
{
case GDK_FONT_FONT:
oldfont = SelectObject (gdk_DC, private->xfont);
if (private->cpinfo.MaxCharSize > 1)
{
wcstr = g_new (wchar_t, text_length);
if ((wlen = MultiByteToWideChar (private->codepage, 0,
text, text_length,
wcstr, text_length)) == 0)
{
g_warning ("gdk_text_width: MultiByteToWideChar failed");
size.cx = 0;
}
else
GetTextExtentPoint32W (gdk_DC, wcstr, wlen, &size);
g_free (wcstr);
}
else
{
GetTextExtentPoint32A (gdk_DC, text, text_length, &size);
}
SelectObject (gdk_DC, oldfont);
width = size.cx;
break;
g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET);
default:
g_assert_not_reached ();
if ((oldfont = SelectObject (gdk_DC, private->xfont)) == NULL)
{
g_warning ("gdk_text_width: SelectObject failed");
return FALSE;
}
return width;
wcstr = g_new (wchar_t, text_length);
if ((wlen = gdk_nmbstowchar_ts (wcstr, text, text_length, text_length)) == -1)
{
g_warning ("gdk_text_size: gdk_nmbstowchar_ts failed");
return FALSE;
}
GetTextExtentPoint32W (gdk_DC, wcstr, wlen, sizep);
g_free (wcstr);
SelectObject (gdk_DC, oldfont);
return TRUE;
}
gint
gdk_text_width (GdkFont *font,
const gchar *text,
gint text_length)
{
SIZE size;
if (!gdk_text_size (font, text, text_length, &size))
return -1;
return size.cx;
}
gint
@ -608,7 +618,7 @@ gdk_text_width_wc (GdkFont *font,
SIZE size;
wchar_t *wcstr;
guchar *str;
gint i, width, wlen;
gint i;
g_return_val_if_fail (font != NULL, -1);
g_return_val_if_fail (text != NULL, -1);
@ -616,58 +626,44 @@ gdk_text_width_wc (GdkFont *font,
if (text_length == 0)
return 0;
g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET);
private = (GdkFontPrivate*) font;
switch (font->type)
if ((oldfont = SelectObject (gdk_DC, private->xfont)) == NULL)
g_warning ("gdk_text_width_wc: SelectObject failed");
if (sizeof (wchar_t) != sizeof (GdkWChar))
{
case GDK_FONT_FONT:
oldfont = SelectObject (gdk_DC, private->xfont);
#if 0 /* No. Don't assume Unicode here either.
* (Read the comments in gdk_draw_text_wc.)
*/
wcstr = g_new (wchar_t, text_length);
for (i = 0; i < text_length; i++)
wcstr[i] = text[i];
GetTextExtentPoint32W (gdk_DC, wcstr, text_length, &size);
g_free (wcstr);
#else
str = g_new (guchar, text_length);
for (i = 0; i < text_length; i++)
str[i] = text[i];
if (private->cpinfo.MaxCharSize > 1)
{
wcstr = g_new (wchar_t, text_length);
if ((wlen = MultiByteToWideChar (private->codepage, 0,
str, text_length,
wcstr, text_length)) == 0)
{
g_warning ("gdk_text_width_wc: MultiByteToWideChar failed");
size.cx = 0;
}
else
GetTextExtentPoint32W (gdk_DC, wcstr, wlen, &size);
g_free (wcstr);
}
else
{
GetTextExtentPoint32A (gdk_DC, str, text_length, &size);
}
g_free (str);
#endif
SelectObject (gdk_DC, oldfont);
width = size.cx;
break;
default:
width = 0;
}
return width;
else
wcstr = (wchar_t *) text;
GetTextExtentPoint32W (gdk_DC, wcstr, text_length, &size);
if (sizeof (wchar_t) != sizeof (GdkWChar))
g_free (wcstr);
if (oldfont != NULL)
SelectObject (gdk_DC, oldfont);
return size.cx;
}
gint
gdk_char_width (GdkFont *font,
gchar character)
{
if (((guchar) character) >= 128)
{
/* gtktext calls us with non-ASCII characters, sigh */
GdkWChar wc = (guchar) character;
return gdk_text_width_wc (font, &wc, 1);
}
return gdk_text_width (font, &character, 1);
}
@ -722,48 +718,37 @@ gdk_text_extents (GdkFont *font,
return;
}
g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET);
private = (GdkFontPrivate*) font;
switch (font->type)
{
case GDK_FONT_FONT:
oldfont = SelectObject (gdk_DC, private->xfont);
if (private->cpinfo.MaxCharSize > 1)
{
wcstr = g_new (wchar_t, text_length);
if ((wlen = MultiByteToWideChar (private->codepage, 0,
text, text_length,
wcstr, text_length)) == 0)
{
g_warning ("gdk_text_extents: MultiByteToWideChar failed");
size.cx = 0;
size.cy = 0;
}
else
GetTextExtentPoint32W (gdk_DC, wcstr, wlen, &size);
g_free (wcstr);
}
else
{
GetTextExtentPoint32A (gdk_DC, text, text_length, &size);
}
SelectObject (gdk_DC, oldfont);
/* XXX This is all quite bogus */
if (lbearing)
*lbearing = 0;
if (rbearing)
*rbearing = 0;
if (width)
*width = size.cx;
if (ascent)
*ascent = size.cy + 1;
if (descent)
*descent = font->descent + 1;
break;
if ((oldfont = SelectObject (gdk_DC, private->xfont)) == NULL)
g_warning ("gdk_text_extents: SelectObject failed");
default:
g_assert_not_reached ();
wcstr = g_new (wchar_t, text_length);
if ((wlen = gdk_nmbstowchar_ts (wcstr, text, text_length, text_length)) == -1)
{
g_warning ("gdk_text_extents: gdk_nmbstowchar_ts failed");
size.cx = 0;
size.cy = 0;
}
else
GetTextExtentPoint32W (gdk_DC, wcstr, wlen, &size);
if (oldfont != NULL)
SelectObject (gdk_DC, oldfont);
/* XXX This is all quite bogus */
if (lbearing)
*lbearing = 0;
if (rbearing)
*rbearing = 0;
if (width)
*width = size.cx;
if (ascent)
*ascent = size.cy + 1;
if (descent)
*descent = font->descent + 1;
}
void
@ -800,35 +785,41 @@ gdk_text_extents_wc (GdkFont *font,
return;
}
g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET);
private = (GdkFontPrivate*) font;
switch (font->type)
if (sizeof (wchar_t) != sizeof (GdkWChar))
{
case GDK_FONT_FONT:
wcstr = g_new (wchar_t, text_length);
for (i = 0; i < text_length; i++)
wcstr[i] = text[i];
oldfont = SelectObject (gdk_DC, private->xfont);
GetTextExtentPoint32W (gdk_DC, wcstr, text_length, &size);
g_free (wcstr);
SelectObject (gdk_DC, oldfont);
/* XXX This is all quite bogus */
if (lbearing)
*lbearing = 0;
if (rbearing)
*rbearing = 0;
if (width)
*width = size.cx;
if (ascent)
*ascent = size.cy + 1;
if (descent)
*descent = font->descent + 1;
break;
default:
g_assert_not_reached ();
}
else
wcstr = (wchar_t *) text;
if ((oldfont = SelectObject (gdk_DC, private->xfont)) == NULL)
g_warning ("gdk_text_extents_wc: SelectObject failed");
GetTextExtentPoint32W (gdk_DC, wcstr, text_length, &size);
if (sizeof (wchar_t) != sizeof (GdkWChar))
g_free (wcstr);
if (oldfont != NULL)
SelectObject (gdk_DC, oldfont);
/* XXX This is all quite bogus */
if (lbearing)
*lbearing = 0;
if (rbearing)
*rbearing = 0;
if (width)
*width = size.cx;
if (ascent)
*ascent = size.cy + 1;
if (descent)
*descent = font->descent + 1;
}
void
@ -853,24 +844,7 @@ gdk_text_measure (GdkFont *font,
const gchar *text,
gint text_length)
{
GdkFontPrivate *private;
gint width;
g_return_val_if_fail (font != NULL, -1);
g_return_val_if_fail (text != NULL, -1);
private = (GdkFontPrivate*) font;
switch (font->type)
{
case GDK_FONT_FONT:
return gdk_text_width (font, text, text_length); /* ??? */
break;
default:
g_assert_not_reached ();
}
return 0;
return gdk_text_width (font, text, text_length); /* ??? */
}
gint
@ -895,52 +869,12 @@ gdk_text_height (GdkFont *font,
const gchar *text,
gint text_length)
{
GdkFontPrivate *private;
HGDIOBJ oldfont;
SIZE size;
gint height, wlen;
wchar_t *wcstr;
g_return_val_if_fail (font != NULL, -1);
g_return_val_if_fail (text != NULL, -1);
if (!gdk_text_size (font, text, text_length, &size))
return -1;
if (text_length == 0)
return 0;
private = (GdkFontPrivate*) font;
switch (font->type)
{
case GDK_FONT_FONT:
oldfont = SelectObject (gdk_DC, private->xfont);
if (private->cpinfo.MaxCharSize > 1)
{
wcstr = g_new (wchar_t, text_length);
if ((wlen = MultiByteToWideChar (private->codepage, 0,
text, text_length,
wcstr, text_length)) == 0)
{
g_warning ("gdk_text_height: MultiByteToWideChar failed "
"text = %.*s (%d)",
text_length, text, text_length);
size.cy = 0;
}
else
GetTextExtentPoint32W (gdk_DC, wcstr, wlen, &size);
g_free (wcstr);
}
else
{
GetTextExtentPoint32A (gdk_DC, text, text_length, &size);
}
SelectObject (gdk_DC, oldfont);
height = size.cy;
break;
default:
g_error ("font->type = %d", font->type);
}
return height;
return size.cy;
}
gint

View File

@ -87,7 +87,8 @@ gdk_gc_new_with_values (GdkWindow *window,
else
private->background = white;
if ((values_mask & GDK_GC_FONT) && (values->font->type == GDK_FONT_FONT))
if ((values_mask & GDK_GC_FONT) && (values->font->type == GDK_FONT_FONT
|| values->font->type == GDK_FONT_FONTSET))
{
private->font = (HFONT) ((GdkFontPrivate*) values->font)->xfont;
GDK_NOTE (MISC, g_print (" font=%#x", private->font));
@ -480,7 +481,8 @@ gdk_gc_set_font (GdkGC *gc,
g_return_if_fail (gc != NULL);
g_return_if_fail (font != NULL);
if (font->type == GDK_FONT_FONT)
if (font->type == GDK_FONT_FONT
|| font->type == GDK_FONT_FONTSET)
{
gc_private = (GdkGCPrivate*) gc;
font_private = (GdkFontPrivate*) font;

View File

@ -87,7 +87,8 @@ gdk_gc_new_with_values (GdkWindow *window,
else
private->background = white;
if ((values_mask & GDK_GC_FONT) && (values->font->type == GDK_FONT_FONT))
if ((values_mask & GDK_GC_FONT) && (values->font->type == GDK_FONT_FONT
|| values->font->type == GDK_FONT_FONTSET))
{
private->font = (HFONT) ((GdkFontPrivate*) values->font)->xfont;
GDK_NOTE (MISC, g_print (" font=%#x", private->font));
@ -480,7 +481,8 @@ gdk_gc_set_font (GdkGC *gc,
g_return_if_fail (gc != NULL);
g_return_if_fail (font != NULL);
if (font->type == GDK_FONT_FONT)
if (font->type == GDK_FONT_FONT
|| font->type == GDK_FONT_FONTSET)
{
gc_private = (GdkGCPrivate*) gc;
font_private = (GdkFontPrivate*) font;

View File

@ -28,9 +28,9 @@
#include "gdkprivate.h"
guint gdk_debug_flags = 0;
HWND gdk_root_window;
HWND gdk_root_window = NULL;
HWND gdk_leader_window;
GDKVAR GdkWindowPrivate gdk_root_parent = { { NULL, }, NULL, };
GDKVAR GdkWindowPrivate *gdk_root_parent = NULL;
HDC gdk_DC;
HINSTANCE gdk_DLLInstance;
HINSTANCE gdk_ProgInstance;
@ -45,18 +45,8 @@ gchar *gdk_progclass = NULL;
gint gdk_error_code;
gint gdk_error_warnings = TRUE;
gint gdk_null_window_warnings = TRUE;
GList *gdk_default_filters = NULL;
gboolean gdk_xim_using; /* using XIM Protocol if TRUE */
GdkWindow *gdk_xim_window; /* currently using Widow */
GdkWindowPrivate *gdk_xgrab_window = NULL; /* Window that currently holds the
* x pointer grab
*/
GMutex *gdk_threads_mutex = NULL; /* Global GDK lock */
#ifdef USE_XIM
GdkICPrivate *gdk_xim_ic; /* currently using IC */
GdkWindow *gdk_xim_window; /* currently using Window */
#endif
BOOL (WINAPI *p_TrackMouseEvent) (TRACKMOUSEEVENT *tme) = NULL;

View File

@ -28,9 +28,9 @@
#include "gdkprivate.h"
guint gdk_debug_flags = 0;
HWND gdk_root_window;
HWND gdk_root_window = NULL;
HWND gdk_leader_window;
GDKVAR GdkWindowPrivate gdk_root_parent = { { NULL, }, NULL, };
GDKVAR GdkWindowPrivate *gdk_root_parent = NULL;
HDC gdk_DC;
HINSTANCE gdk_DLLInstance;
HINSTANCE gdk_ProgInstance;
@ -45,18 +45,8 @@ gchar *gdk_progclass = NULL;
gint gdk_error_code;
gint gdk_error_warnings = TRUE;
gint gdk_null_window_warnings = TRUE;
GList *gdk_default_filters = NULL;
gboolean gdk_xim_using; /* using XIM Protocol if TRUE */
GdkWindow *gdk_xim_window; /* currently using Widow */
GdkWindowPrivate *gdk_xgrab_window = NULL; /* Window that currently holds the
* x pointer grab
*/
GMutex *gdk_threads_mutex = NULL; /* Global GDK lock */
#ifdef USE_XIM
GdkICPrivate *gdk_xim_ic; /* currently using IC */
GdkWindow *gdk_xim_window; /* currently using Window */
#endif
BOOL (WINAPI *p_TrackMouseEvent) (TRACKMOUSEEVENT *tme) = NULL;

View File

@ -37,12 +37,6 @@
#include "gdki18n.h"
#include "gdkx.h"
/* If this variable is FALSE, it indicates that we should
* avoid trying to use multibyte conversion functions and
* assume everything is 1-byte per character
*/
static gboolean gdk_use_mb;
/*
*--------------------------------------------------------------
* gdk_set_locale
@ -59,22 +53,13 @@ static gboolean gdk_use_mb;
gchar*
gdk_set_locale (void)
{
wchar_t result;
gchar *current_locale;
gdk_use_mb = FALSE;
if (!setlocale (LC_ALL,""))
g_warning ("locale not supported by C library");
current_locale = setlocale (LC_ALL, NULL);
if (MB_CUR_MAX > 1)
gdk_use_mb = TRUE;
GDK_NOTE (XIM, g_message ("%s multi-byte string functions.",
gdk_use_mb ? "Using" : "Not using"));
return current_locale;
}
@ -158,50 +143,91 @@ gdk_ic_get_events (GdkIC *ic)
* of wide characters. The string is newly allocated. The array of
* wide characters must be null-terminated. If the conversion is
* failed, it returns NULL.
*
* On Win32, we always use UTF-8.
*/
gchar *
gdk_wcstombs (const GdkWChar *src)
{
gchar *mbstr;
gint len;
const GdkWChar *wcp;
guchar *mbstr, *bp;
if (gdk_use_mb)
wcp = src;
len = 0;
while (*wcp)
{
gint i, wcsl, mbsl;
wchar_t *src_alt;
const GdkWChar c = *wcp++;
for (wcsl = 0; src[wcsl]; wcsl++)
;
src_alt = g_new (wchar_t, wcsl+1);
for (i = wcsl; i >= 0; i--)
src_alt[i] = src[i];
mbsl = WideCharToMultiByte (CP_OEMCP, 0, src_alt, wcsl,
NULL, 0, NULL, NULL);
mbstr = g_new (guchar, mbsl + 1);
if (!WideCharToMultiByte (CP_OEMCP, 0, src_alt, wcsl,
mbstr, mbsl, NULL, NULL))
if (c < 0x80)
len += 1;
else if (c < 0x800)
len += 2;
else if (c < 0x10000)
len += 3;
else if (c < 0x200000)
len += 4;
else if (c < 0x4000000)
len += 5;
else
len += 6;
}
mbstr = g_malloc (len + 1);
wcp = src;
bp = mbstr;
while (*wcp)
{
int first;
int i;
GdkWChar c = *wcp++;
if (c < 0x80)
{
g_warning ("gdk_wcstombs: WideCharToMultiByte failed");
g_free (mbstr);
g_free (src_alt);
return NULL;
first = 0;
len = 1;
}
else if (c < 0x800)
{
first = 0xc0;
len = 2;
}
else if (c < 0x10000)
{
first = 0xe0;
len = 3;
}
else if (c < 0x200000)
{
first = 0xf0;
len = 4;
}
else if (c < 0x4000000)
{
first = 0xf8;
len = 5;
}
else
{
first = 0xfc;
len = 6;
}
mbstr[mbsl] = '\0';
g_free (src_alt);
}
else
{
gint length = 0;
gint i;
while (src[length] != 0)
length++;
mbstr = g_new (gchar, length + 1);
/* Woo-hoo! */
switch (len)
{
case 6: bp[5] = (c & 0x3f) | 0x80; c >>= 6; /* Fall through */
case 5: bp[4] = (c & 0x3f) | 0x80; c >>= 6; /* Fall through */
case 4: bp[3] = (c & 0x3f) | 0x80; c >>= 6; /* Fall through */
case 3: bp[2] = (c & 0x3f) | 0x80; c >>= 6; /* Fall through */
case 2: bp[1] = (c & 0x3f) | 0x80; c >>= 6; /* Fall through */
case 1: bp[0] = c | first;
}
for (i=0; i<length+1; i++)
mbstr[i] = src[i];
bp += len;
}
*bp = 0;
return mbstr;
}
@ -209,41 +235,158 @@ gdk_wcstombs (const GdkWChar *src)
/*
* gdk_mbstowcs
*
* Converts the specified string into wide characters, and, returns the
* number of wide characters written. The string 'src' must be
* null-terminated. If the conversion is failed, it returns -1.
* Converts the specified string into GDK wide characters, and,
* returns the number of wide characters written. The string 'src'
* must be null-terminated. If the conversion is failed, it returns
* -1.
*
* On Win32, thr string is assumed to be in UTF-8. Also note that
* GdkWChar is 32 bits, while wchar_t, and the wide characters the
* Windows API uses, are 16 bits!
*/
/* First a helper function for not zero-terminated strings */
gint
gdk_mbstowcs (GdkWChar *dest, const gchar *src, gint dest_max)
gdk_nmbstowcs (GdkWChar *dest,
const gchar *src,
gint src_len,
gint dest_max)
{
if (gdk_use_mb)
guchar *cp, *end;
gint n;
cp = (guchar *) src;
end = cp + src_len;
n = 0;
while (cp != end && dest != dest + dest_max)
{
gint i, wcsl;
wchar_t *wcstr;
gint i, mask = 0, len;
guchar c = *cp;
wcsl = MultiByteToWideChar (CP_OEMCP, 0, src, -1, NULL, 0);
wcstr = g_new (wchar_t, wcsl);
if (!MultiByteToWideChar (CP_OEMCP, 0, src, -1, wcstr, wcsl))
if (c < 0x80)
{
g_warning ("gdk_mbstowcs: MultiByteToWideChar failed");
g_free (wcstr);
return -1;
len = 1;
mask = 0x7f;
}
if (wcsl > dest_max)
wcsl = dest_max;
for (i = 0; i < wcsl && wcstr[i]; i++)
dest[i] = wcstr[i];
g_free (wcstr);
else if ((c & 0xe0) == 0xc0)
{
len = 2;
mask = 0x1f;
}
else if ((c & 0xf0) == 0xe0)
{
len = 3;
mask = 0x0f;
}
else if ((c & 0xf8) == 0xf0)
{
len = 4;
mask = 0x07;
}
else if ((c & 0xfc) == 0xf8)
{
len = 5;
mask = 0x03;
}
else if ((c & 0xfc) == 0xfc)
{
len = 6;
mask = 0x01;
}
else
return -1;
return i;
if (cp + len > end)
return -1;
*dest = (cp[0] & mask);
for (i = 1; i < len; i++)
{
if ((cp[i] & 0xc0) != 0x80)
return -1;
*dest <<= 6;
*dest |= (cp[i] & 0x3f);
}
if (*dest == -1)
return -1;
cp += len;
dest++;
n++;
}
else
{
gint i;
if (cp != end)
return -1;
for (i=0; i<dest_max && src[i]; i++)
dest[i] = src[i];
return i;
}
return n;
}
gint
gdk_mbstowcs (GdkWChar *dest,
const gchar *src,
gint dest_max)
{
return gdk_nmbstowcs (dest, src, strlen (src), dest_max);
}
/* A version that converts to wchar_t wide chars */
gint
gdk_nmbstowchar_ts (wchar_t *dest,
const gchar *src,
gint src_len,
gint dest_max)
{
guchar *cp, *end;
gint n;
cp = (guchar *) src;
end = cp + src_len;
n = 0;
while (cp != end && dest != dest + dest_max)
{
gint i, mask = 0, len;
guchar c = *cp;
if (c < 0x80)
{
len = 1;
mask = 0x7f;
}
else if ((c & 0xe0) == 0xc0)
{
len = 2;
mask = 0x1f;
}
else if ((c & 0xf0) == 0xe0)
{
len = 3;
mask = 0x0f;
}
else /* Other lengths are not possible with 16-bit wchar_t! */
return -1;
if (cp + len > end)
return -1;
*dest = (cp[0] & mask);
for (i = 1; i < len; i++)
{
if ((cp[i] & 0xc0) != 0x80)
return -1;
*dest <<= 6;
*dest |= (cp[i] & 0x3f);
}
if (*dest == 0xFFFF)
return -1;
cp += len;
dest++;
n++;
}
if (cp != end)
return -1;
return n;
}

View File

@ -37,12 +37,6 @@
#include "gdki18n.h"
#include "gdkx.h"
/* If this variable is FALSE, it indicates that we should
* avoid trying to use multibyte conversion functions and
* assume everything is 1-byte per character
*/
static gboolean gdk_use_mb;
/*
*--------------------------------------------------------------
* gdk_set_locale
@ -59,22 +53,13 @@ static gboolean gdk_use_mb;
gchar*
gdk_set_locale (void)
{
wchar_t result;
gchar *current_locale;
gdk_use_mb = FALSE;
if (!setlocale (LC_ALL,""))
g_warning ("locale not supported by C library");
current_locale = setlocale (LC_ALL, NULL);
if (MB_CUR_MAX > 1)
gdk_use_mb = TRUE;
GDK_NOTE (XIM, g_message ("%s multi-byte string functions.",
gdk_use_mb ? "Using" : "Not using"));
return current_locale;
}
@ -158,50 +143,91 @@ gdk_ic_get_events (GdkIC *ic)
* of wide characters. The string is newly allocated. The array of
* wide characters must be null-terminated. If the conversion is
* failed, it returns NULL.
*
* On Win32, we always use UTF-8.
*/
gchar *
gdk_wcstombs (const GdkWChar *src)
{
gchar *mbstr;
gint len;
const GdkWChar *wcp;
guchar *mbstr, *bp;
if (gdk_use_mb)
wcp = src;
len = 0;
while (*wcp)
{
gint i, wcsl, mbsl;
wchar_t *src_alt;
const GdkWChar c = *wcp++;
for (wcsl = 0; src[wcsl]; wcsl++)
;
src_alt = g_new (wchar_t, wcsl+1);
for (i = wcsl; i >= 0; i--)
src_alt[i] = src[i];
mbsl = WideCharToMultiByte (CP_OEMCP, 0, src_alt, wcsl,
NULL, 0, NULL, NULL);
mbstr = g_new (guchar, mbsl + 1);
if (!WideCharToMultiByte (CP_OEMCP, 0, src_alt, wcsl,
mbstr, mbsl, NULL, NULL))
if (c < 0x80)
len += 1;
else if (c < 0x800)
len += 2;
else if (c < 0x10000)
len += 3;
else if (c < 0x200000)
len += 4;
else if (c < 0x4000000)
len += 5;
else
len += 6;
}
mbstr = g_malloc (len + 1);
wcp = src;
bp = mbstr;
while (*wcp)
{
int first;
int i;
GdkWChar c = *wcp++;
if (c < 0x80)
{
g_warning ("gdk_wcstombs: WideCharToMultiByte failed");
g_free (mbstr);
g_free (src_alt);
return NULL;
first = 0;
len = 1;
}
else if (c < 0x800)
{
first = 0xc0;
len = 2;
}
else if (c < 0x10000)
{
first = 0xe0;
len = 3;
}
else if (c < 0x200000)
{
first = 0xf0;
len = 4;
}
else if (c < 0x4000000)
{
first = 0xf8;
len = 5;
}
else
{
first = 0xfc;
len = 6;
}
mbstr[mbsl] = '\0';
g_free (src_alt);
}
else
{
gint length = 0;
gint i;
while (src[length] != 0)
length++;
mbstr = g_new (gchar, length + 1);
/* Woo-hoo! */
switch (len)
{
case 6: bp[5] = (c & 0x3f) | 0x80; c >>= 6; /* Fall through */
case 5: bp[4] = (c & 0x3f) | 0x80; c >>= 6; /* Fall through */
case 4: bp[3] = (c & 0x3f) | 0x80; c >>= 6; /* Fall through */
case 3: bp[2] = (c & 0x3f) | 0x80; c >>= 6; /* Fall through */
case 2: bp[1] = (c & 0x3f) | 0x80; c >>= 6; /* Fall through */
case 1: bp[0] = c | first;
}
for (i=0; i<length+1; i++)
mbstr[i] = src[i];
bp += len;
}
*bp = 0;
return mbstr;
}
@ -209,41 +235,158 @@ gdk_wcstombs (const GdkWChar *src)
/*
* gdk_mbstowcs
*
* Converts the specified string into wide characters, and, returns the
* number of wide characters written. The string 'src' must be
* null-terminated. If the conversion is failed, it returns -1.
* Converts the specified string into GDK wide characters, and,
* returns the number of wide characters written. The string 'src'
* must be null-terminated. If the conversion is failed, it returns
* -1.
*
* On Win32, thr string is assumed to be in UTF-8. Also note that
* GdkWChar is 32 bits, while wchar_t, and the wide characters the
* Windows API uses, are 16 bits!
*/
/* First a helper function for not zero-terminated strings */
gint
gdk_mbstowcs (GdkWChar *dest, const gchar *src, gint dest_max)
gdk_nmbstowcs (GdkWChar *dest,
const gchar *src,
gint src_len,
gint dest_max)
{
if (gdk_use_mb)
guchar *cp, *end;
gint n;
cp = (guchar *) src;
end = cp + src_len;
n = 0;
while (cp != end && dest != dest + dest_max)
{
gint i, wcsl;
wchar_t *wcstr;
gint i, mask = 0, len;
guchar c = *cp;
wcsl = MultiByteToWideChar (CP_OEMCP, 0, src, -1, NULL, 0);
wcstr = g_new (wchar_t, wcsl);
if (!MultiByteToWideChar (CP_OEMCP, 0, src, -1, wcstr, wcsl))
if (c < 0x80)
{
g_warning ("gdk_mbstowcs: MultiByteToWideChar failed");
g_free (wcstr);
return -1;
len = 1;
mask = 0x7f;
}
if (wcsl > dest_max)
wcsl = dest_max;
for (i = 0; i < wcsl && wcstr[i]; i++)
dest[i] = wcstr[i];
g_free (wcstr);
else if ((c & 0xe0) == 0xc0)
{
len = 2;
mask = 0x1f;
}
else if ((c & 0xf0) == 0xe0)
{
len = 3;
mask = 0x0f;
}
else if ((c & 0xf8) == 0xf0)
{
len = 4;
mask = 0x07;
}
else if ((c & 0xfc) == 0xf8)
{
len = 5;
mask = 0x03;
}
else if ((c & 0xfc) == 0xfc)
{
len = 6;
mask = 0x01;
}
else
return -1;
return i;
if (cp + len > end)
return -1;
*dest = (cp[0] & mask);
for (i = 1; i < len; i++)
{
if ((cp[i] & 0xc0) != 0x80)
return -1;
*dest <<= 6;
*dest |= (cp[i] & 0x3f);
}
if (*dest == -1)
return -1;
cp += len;
dest++;
n++;
}
else
{
gint i;
if (cp != end)
return -1;
for (i=0; i<dest_max && src[i]; i++)
dest[i] = src[i];
return i;
}
return n;
}
gint
gdk_mbstowcs (GdkWChar *dest,
const gchar *src,
gint dest_max)
{
return gdk_nmbstowcs (dest, src, strlen (src), dest_max);
}
/* A version that converts to wchar_t wide chars */
gint
gdk_nmbstowchar_ts (wchar_t *dest,
const gchar *src,
gint src_len,
gint dest_max)
{
guchar *cp, *end;
gint n;
cp = (guchar *) src;
end = cp + src_len;
n = 0;
while (cp != end && dest != dest + dest_max)
{
gint i, mask = 0, len;
guchar c = *cp;
if (c < 0x80)
{
len = 1;
mask = 0x7f;
}
else if ((c & 0xe0) == 0xc0)
{
len = 2;
mask = 0x1f;
}
else if ((c & 0xf0) == 0xe0)
{
len = 3;
mask = 0x0f;
}
else /* Other lengths are not possible with 16-bit wchar_t! */
return -1;
if (cp + len > end)
return -1;
*dest = (cp[0] & mask);
for (i = 1; i < len; i++)
{
if ((cp[i] & 0xc0) != 0x80)
return -1;
*dest <<= 6;
*dest |= (cp[i] & 0x3f);
}
if (*dest == 0xFFFF)
return -1;
cp += len;
dest++;
n++;
}
if (cp != end)
return -1;
return n;
}

View File

@ -1006,7 +1006,7 @@ gdk_input_win32_other_event (GdkEvent *event,
#if USE_SYSCONTEXT
window = gdk_window_at_pointer (&x, &y);
if (window == NULL)
window = (GdkWindow *) &gdk_root_parent;
window = (GdkWindow *) gdk_root_parent;
gdk_window_ref (window);
@ -1036,7 +1036,7 @@ gdk_input_win32_other_event (GdkEvent *event,
switch (xevent->message)
{
case WT_PACKET:
if (window_private == &gdk_root_parent)
if (window_private == gdk_root_parent)
{
GDK_NOTE (EVENTS, g_print ("...is root\n"));
return FALSE;
@ -1104,7 +1104,7 @@ gdk_input_win32_other_event (GdkEvent *event,
{
GDK_NOTE (EVENTS, g_print ("...not selected\n"));
if (window_private->parent == (GdkWindow *) &gdk_root_parent)
if (window_private->parent == (GdkWindow *) gdk_root_parent)
return FALSE;
pt.x = x;

View File

@ -1006,7 +1006,7 @@ gdk_input_win32_other_event (GdkEvent *event,
#if USE_SYSCONTEXT
window = gdk_window_at_pointer (&x, &y);
if (window == NULL)
window = (GdkWindow *) &gdk_root_parent;
window = (GdkWindow *) gdk_root_parent;
gdk_window_ref (window);
@ -1036,7 +1036,7 @@ gdk_input_win32_other_event (GdkEvent *event,
switch (xevent->message)
{
case WT_PACKET:
if (window_private == &gdk_root_parent)
if (window_private == gdk_root_parent)
{
GDK_NOTE (EVENTS, g_print ("...is root\n"));
return FALSE;
@ -1104,7 +1104,7 @@ gdk_input_win32_other_event (GdkEvent *event,
{
GDK_NOTE (EVENTS, g_print ("...not selected\n"));
if (window_private->parent == (GdkWindow *) &gdk_root_parent)
if (window_private->parent == (GdkWindow *) gdk_root_parent)
return FALSE;
pt.x = x;

View File

@ -38,11 +38,11 @@
#include "gdkinputprivate.h"
#include "gdkkeysyms.h"
#include <objbase.h>
static void gdkx_XConvertCase (KeySym symbol,
KeySym *lower,
KeySym *upper);
#define XConvertCase gdkx_XConvertCase
static void gdk_exit_func (void);
@ -234,6 +234,9 @@ gdk_init_check (int *argc,
gdk_ProgInstance = GetModuleHandle (NULL);
gdk_DC = CreateDC ("DISPLAY", NULL, NULL, NULL);
gdk_root_window = GetDesktopWindow ();
CoInitialize (NULL);
gdk_selection_request_msg = RegisterWindowMessage ("gdk-selection-request");
gdk_selection_notify_msg = RegisterWindowMessage ("gdk-selection-notify");
@ -247,8 +250,6 @@ gdk_init_check (int *argc,
gdk_progclass = g_basename (g_get_prgname ());
gdk_progclass[0] = toupper (gdk_progclass[0]);
gdk_root_window = HWND_DESKTOP;
g_atexit (gdk_exit_func);
gdk_events_init ();
@ -333,7 +334,7 @@ gdk_screen_width (void)
{
gint return_val;
return_val = gdk_root_parent.drawable.width;
return_val = gdk_root_parent->drawable.width;
return return_val;
}
@ -358,7 +359,7 @@ gdk_screen_height (void)
{
gint return_val;
return_val = gdk_root_parent.drawable.height;
return_val = gdk_root_parent->drawable.height;
return return_val;
}
@ -498,6 +499,9 @@ gdk_exit_func (void)
gdk_input_exit ();
gdk_key_repeat_restore ();
gdk_dnd_exit ();
CoUninitialize ();
DeleteDC (gdk_DC);
gdk_DC = NULL;
gdk_initialized = 0;
@ -1670,6 +1674,22 @@ static struct gdk_key {
{ 0x000ef9, "Hangul_J_KkogjiDalrinIeung" },
{ 0x000efa, "Hangul_J_YeorinHieuh" },
{ 0x000eff, "Korean_Won" },
{ 0x0013bc, "OE" },
{ 0x0013bd, "oe" },
{ 0x0013be, "Ydiaeresis" },
{ 0x0020a0, "EcuSign" },
{ 0x0020a1, "ColonSign" },
{ 0x0020a2, "CruzeiroSign" },
{ 0x0020a3, "FFrancSign" },
{ 0x0020a4, "LiraSign" },
{ 0x0020a5, "MillSign" },
{ 0x0020a6, "NairaSign" },
{ 0x0020a7, "PesetaSign" },
{ 0x0020a8, "RupeeSign" },
{ 0x0020a9, "WonSign" },
{ 0x0020aa, "NewSheqelSign" },
{ 0x0020ab, "DongSign" },
{ 0x0020ac, "EuroSign" },
{ 0x00fd01, "3270_Duplicate" },
{ 0x00fd02, "3270_FieldMark" },
{ 0x00fd03, "3270_Right2" },
@ -1826,11 +1846,21 @@ static struct gdk_key {
{ 0x00ff2e, "Kana_Shift" },
{ 0x00ff2f, "Eisu_Shift" },
{ 0x00ff30, "Eisu_toggle" },
{ 0x00ff31, "Hangul" },
{ 0x00ff32, "Hangul_Start" },
{ 0x00ff33, "Hangul_End" },
{ 0x00ff34, "Hangul_Hanja" },
{ 0x00ff35, "Hangul_Jamo" },
{ 0x00ff36, "Hangul_Romaja" },
{ 0x00ff37, "Codeinput" },
{ 0x00ff38, "Hangul_Jeonja" },
{ 0x00ff39, "Hangul_Banja" },
{ 0x00ff3a, "Hangul_PreHanja" },
{ 0x00ff3b, "Hangul_PostHanja" },
{ 0x00ff3c, "SingleCandidate" },
{ 0x00ff3d, "MultipleCandidate" },
{ 0x00ff3d, "Zen_Koho" },
{ 0x00ff3e, "Mae_Koho" },
{ 0x00ff3e, "PreviousCandidate" },
{ 0x00ff3f, "Hangul_Special" },
{ 0x00ff50, "Home" },
{ 0x00ff51, "Left" },
{ 0x00ff52, "Up" },
@ -1949,21 +1979,6 @@ static struct gdk_key {
{ 0x00ffed, "Hyper_L" },
{ 0x00ffee, "Hyper_R" },
{ 0x00ffff, "Delete" },
{ 0x00ff31, "Hangul" },
{ 0x00ff32, "Hangul_Start" },
{ 0x00ff33, "Hangul_End" },
{ 0x00ff34, "Hangul_Hanja" },
{ 0x00ff35, "Hangul_Jamo" },
{ 0x00ff36, "Hangul_Romaja" },
{ 0x00ff37, "Hangul_Codeinput" },
{ 0x00ff38, "Hangul_Jeonja" },
{ 0x00ff39, "Hangul_Banja" },
{ 0x00ff3a, "Hangul_PreHanja" },
{ 0x00ff3b, "Hangul_PostHanja" },
{ 0x00ff3c, "Hangul_SingleCandidate" },
{ 0x00ff3d, "Hangul_MultipleCandidate" },
{ 0x00ff3e, "Hangul_PreviousCandidate" },
{ 0x00ff3f, "Hangul_Special" },
{ 0xffffff, "VoidSymbol" },
};
@ -1985,7 +2000,7 @@ gdk_keyval_name (guint keyval)
GDK_NUM_KEYS, sizeof (struct gdk_key),
gdk_keys_keyval_compare);
if (found != NULL)
return found->name;
return (gchar *) found->name;
else
return NULL;
}
@ -2037,7 +2052,7 @@ gdk_keyval_to_upper (guint keyval)
KeySym lower_val = 0;
KeySym upper_val = 0;
XConvertCase (keyval, &lower_val, &upper_val);
gdkx_XConvertCase (keyval, &lower_val, &upper_val);
return upper_val;
}
return 0;
@ -2051,7 +2066,7 @@ gdk_keyval_to_lower (guint keyval)
KeySym lower_val = 0;
KeySym upper_val = 0;
XConvertCase (keyval, &lower_val, &upper_val);
gdkx_XConvertCase (keyval, &lower_val, &upper_val);
return lower_val;
}
return 0;
@ -2065,7 +2080,7 @@ gdk_keyval_is_upper (guint keyval)
KeySym lower_val = 0;
KeySym upper_val = 0;
XConvertCase (keyval, &lower_val, &upper_val);
gdkx_XConvertCase (keyval, &lower_val, &upper_val);
return upper_val == keyval;
}
return TRUE;
@ -2079,7 +2094,7 @@ gdk_keyval_is_lower (guint keyval)
KeySym lower_val = 0;
KeySym upper_val = 0;
XConvertCase (keyval, &lower_val, &upper_val);
gdkx_XConvertCase (keyval, &lower_val, &upper_val);
return lower_val == keyval;
}
return TRUE;

View File

@ -77,7 +77,7 @@ gdk_pixmap_new (GdkWindow *window,
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
if (!window)
window = (GdkWindow*) &gdk_root_parent;
window = (GdkWindow*) gdk_root_parent;
if (GDK_DRAWABLE_DESTROYED (window))
return NULL;
@ -287,7 +287,7 @@ gdk_bitmap_create_from_data (GdkWindow *window,
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
if (!window)
window = (GdkWindow*) &gdk_root_parent;
window = (GdkWindow*) gdk_root_parent;
if (GDK_DRAWABLE_DESTROYED (window))
return NULL;
@ -616,7 +616,7 @@ _gdk_pixmap_create_from_xpm (GdkWindow *window,
g_warning ("Creating pixmap from xpm with NULL window and colormap");
if (window == NULL)
window = (GdkWindow *)&gdk_root_parent;
window = (GdkWindow *) gdk_root_parent;
if (colormap == NULL)
{
@ -929,7 +929,7 @@ gdk_pixmap_foreign_new (guint32 anid)
/* set the pixmap to the passed in value */
xpixmap = (HBITMAP) anid;
/* get the root window */
window_private = &gdk_root_parent;
window_private = gdk_root_parent;
/* get information about the BITMAP to fill in the structure for
the gdk window */

View File

@ -77,7 +77,7 @@ gdk_pixmap_new (GdkWindow *window,
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
if (!window)
window = (GdkWindow*) &gdk_root_parent;
window = (GdkWindow*) gdk_root_parent;
if (GDK_DRAWABLE_DESTROYED (window))
return NULL;
@ -287,7 +287,7 @@ gdk_bitmap_create_from_data (GdkWindow *window,
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
if (!window)
window = (GdkWindow*) &gdk_root_parent;
window = (GdkWindow*) gdk_root_parent;
if (GDK_DRAWABLE_DESTROYED (window))
return NULL;
@ -616,7 +616,7 @@ _gdk_pixmap_create_from_xpm (GdkWindow *window,
g_warning ("Creating pixmap from xpm with NULL window and colormap");
if (window == NULL)
window = (GdkWindow *)&gdk_root_parent;
window = (GdkWindow *) gdk_root_parent;
if (colormap == NULL)
{
@ -929,7 +929,7 @@ gdk_pixmap_foreign_new (guint32 anid)
/* set the pixmap to the passed in value */
xpixmap = (HBITMAP) anid;
/* get the root window */
window_private = &gdk_root_parent;
window_private = gdk_root_parent;
/* get information about the BITMAP to fill in the structure for
the gdk window */

View File

@ -50,10 +50,8 @@
#define VIETNAMESE_CHARSET 163
#endif
/* MB_CUR_MAX is missing */
#ifndef MB_CUR_MAX
extern int *__imp___mb_cur_max;
#define MB_CUR_MAX (*__imp___mb_cur_max)
#ifndef VM_OEM_PLUS
#define VK_OEM_PLUS 0xBB
#endif
#include <time.h>
@ -217,6 +215,9 @@ struct _GdkWindowPrivate
GList *filters;
GList *children;
HKL input_locale;
CHARSETINFO charset_info;
};
struct _GdkImagePrivate
@ -304,6 +305,9 @@ struct _GdkVisualPrivate
struct _GdkFontPrivate
{
GdkFont font;
/* For now, both GDK_FONT_FONT and GDK_FONT_FONTSET fonts
* just have one Windows font loaded. This will change.
*/
HFONT xfont;
guint ref_count;
@ -382,6 +386,15 @@ void gdk_sel_prop_store (GdkWindow *owner,
void gdk_event_queue_append (GdkEvent *event);
gint gdk_nmbstowcs (GdkWChar *dest,
const gchar *src,
gint src_len,
gint dest_max);
gint gdk_nmbstowchar_ts (wchar_t *dest,
const gchar *src,
gint src_len,
gint dest_max);
/* Please see gdkwindow.c for comments on how to use */
HWND gdk_window_xid_at(HWND base, gint bx, gint by, gint x, gint y, GList *excludes, gboolean excl_child);
HWND gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child);
@ -391,14 +404,12 @@ extern gint gdk_show_events;
extern gint gdk_stack_trace;
extern HWND gdk_root_window;
extern HWND gdk_leader_window;
GDKVAR GdkWindowPrivate gdk_root_parent;
GDKVAR GdkWindowPrivate *gdk_root_parent;
GDKVAR Atom gdk_selection_property;
extern GdkWindow *selection_owner[];
GDKVAR gchar *gdk_progclass;
GDKVAR gint gdk_error_code;
GDKVAR gint gdk_error_warnings;
GDKVAR gint gdk_null_window_warnings;
extern GList *gdk_default_filters;
extern gint gdk_event_func_from_window_proc;
extern HDC gdk_DC;
@ -411,6 +422,7 @@ extern UINT gdk_selection_clear_msg;
extern GdkAtom gdk_clipboard_atom;
extern GdkAtom gdk_win32_dropfiles_atom;
extern GdkAtom gdk_ole2_dnd_atom;
extern BOOL (WINAPI *p_TrackMouseEvent) (TRACKMOUSEEVENT *tme);
extern LRESULT CALLBACK gdk_WindowProc (HWND, UINT, WPARAM, LPARAM);

View File

@ -50,10 +50,8 @@
#define VIETNAMESE_CHARSET 163
#endif
/* MB_CUR_MAX is missing */
#ifndef MB_CUR_MAX
extern int *__imp___mb_cur_max;
#define MB_CUR_MAX (*__imp___mb_cur_max)
#ifndef VM_OEM_PLUS
#define VK_OEM_PLUS 0xBB
#endif
#include <time.h>
@ -217,6 +215,9 @@ struct _GdkWindowPrivate
GList *filters;
GList *children;
HKL input_locale;
CHARSETINFO charset_info;
};
struct _GdkImagePrivate
@ -304,6 +305,9 @@ struct _GdkVisualPrivate
struct _GdkFontPrivate
{
GdkFont font;
/* For now, both GDK_FONT_FONT and GDK_FONT_FONTSET fonts
* just have one Windows font loaded. This will change.
*/
HFONT xfont;
guint ref_count;
@ -382,6 +386,15 @@ void gdk_sel_prop_store (GdkWindow *owner,
void gdk_event_queue_append (GdkEvent *event);
gint gdk_nmbstowcs (GdkWChar *dest,
const gchar *src,
gint src_len,
gint dest_max);
gint gdk_nmbstowchar_ts (wchar_t *dest,
const gchar *src,
gint src_len,
gint dest_max);
/* Please see gdkwindow.c for comments on how to use */
HWND gdk_window_xid_at(HWND base, gint bx, gint by, gint x, gint y, GList *excludes, gboolean excl_child);
HWND gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child);
@ -391,14 +404,12 @@ extern gint gdk_show_events;
extern gint gdk_stack_trace;
extern HWND gdk_root_window;
extern HWND gdk_leader_window;
GDKVAR GdkWindowPrivate gdk_root_parent;
GDKVAR GdkWindowPrivate *gdk_root_parent;
GDKVAR Atom gdk_selection_property;
extern GdkWindow *selection_owner[];
GDKVAR gchar *gdk_progclass;
GDKVAR gint gdk_error_code;
GDKVAR gint gdk_error_warnings;
GDKVAR gint gdk_null_window_warnings;
extern GList *gdk_default_filters;
extern gint gdk_event_func_from_window_proc;
extern HDC gdk_DC;
@ -411,6 +422,7 @@ extern UINT gdk_selection_clear_msg;
extern GdkAtom gdk_clipboard_atom;
extern GdkAtom gdk_win32_dropfiles_atom;
extern GdkAtom gdk_ole2_dnd_atom;
extern BOOL (WINAPI *p_TrackMouseEvent) (TRACKMOUSEEVENT *tme);
extern LRESULT CALLBACK gdk_WindowProc (HWND, UINT, WPARAM, LPARAM);

View File

@ -257,11 +257,11 @@ gdk_selection_convert (GdkWindow *requestor,
*/
GdkSelProp *prop;
prop = g_hash_table_lookup (sel_prop_table, &gdk_root_parent.drawable.xwindow);
prop = g_hash_table_lookup (sel_prop_table, &gdk_root_parent->drawable.xwindow);
if (prop != NULL)
{
g_hash_table_remove (sel_prop_table, &gdk_root_parent.drawable.xwindow);
g_hash_table_remove (sel_prop_table, &gdk_root_parent->drawable.xwindow);
gdk_sel_prop_store (requestor, prop->type, prop->format,
prop->data, prop->length);
g_free (prop);

View File

@ -257,11 +257,11 @@ gdk_selection_convert (GdkWindow *requestor,
*/
GdkSelProp *prop;
prop = g_hash_table_lookup (sel_prop_table, &gdk_root_parent.drawable.xwindow);
prop = g_hash_table_lookup (sel_prop_table, &gdk_root_parent->drawable.xwindow);
if (prop != NULL)
{
g_hash_table_remove (sel_prop_table, &gdk_root_parent.drawable.xwindow);
g_hash_table_remove (sel_prop_table, &gdk_root_parent->drawable.xwindow);
gdk_sel_prop_store (requestor, prop->type, prop->format,
prop->data, prop->length);
g_free (prop);

View File

@ -34,7 +34,7 @@
#include <locale.h>
#define GDK_ROOT_WINDOW() ((guint32) HWND_DESKTOP)
#define GDK_ROOT_PARENT() ((GdkWindow *)&gdk_root_parent)
#define GDK_ROOT_PARENT() ((GdkWindow *) gdk_root_parent)
#define GDK_DISPLAY() NULL
#define GDK_DRAWABLE_XDISPLAY(win) NULL
#define GDK_DRAWABLE_XID(win) (((GdkDrawablePrivate*) win)->xwindow)

View File

@ -105,29 +105,25 @@ gdk_window_xid_at_coords (gint x,
void
gdk_window_init (void)
{
unsigned int width;
unsigned int height;
#if 0
width = GetSystemMetrics (SM_CXSCREEN);
height = GetSystemMetrics (SM_CYSCREEN);
#else
{ RECT r; /* //HB: don't obscure tray window (task bar) */
SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
width = r.right - r.left;
height = r.bottom - r.top;
}
#endif
RECT r;
guint width;
guint height;
gdk_root_parent.drawable.xwindow = gdk_root_window;
gdk_root_parent.drawable.window_type = GDK_WINDOW_ROOT;
gdk_root_parent.drawable.drawable.user_data = NULL;
gdk_root_parent.drawable.width = width;
gdk_root_parent.drawable.height = height;
gdk_root_parent.drawable.ref_count = 1;
gdk_root_parent.drawable.colormap = NULL;
gdk_root_parent.children = NULL;
SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
width = r.right - r.left;
height = r.bottom - r.top;
gdk_xid_table_insert (&gdk_root_window, &gdk_root_parent);
gdk_root_parent = g_new (GdkWindowPrivate, 1);
gdk_root_parent->drawable.xwindow = gdk_root_window;
gdk_root_parent->drawable.window_type = GDK_WINDOW_ROOT;
gdk_root_parent->drawable.drawable.user_data = NULL;
gdk_root_parent->drawable.width = width;
gdk_root_parent->drawable.height = height;
gdk_root_parent->drawable.ref_count = 1;
gdk_root_parent->drawable.colormap = NULL;
gdk_root_parent->children = NULL;
gdk_xid_table_insert (&gdk_root_window, gdk_root_parent);
}
/* RegisterGdkClass
@ -258,14 +254,19 @@ gdk_window_new (GdkWindow *parent,
ATOM klass = 0;
DWORD dwStyle, dwExStyle;
RECT rect;
UINT acp;
int width, height;
int x, y;
char *title;
gint titlelen;
wchar_t *wctitle;
gint wlen;
char *mbtitle;
g_return_val_if_fail (attributes != NULL, NULL);
if (!parent)
parent = (GdkWindow*) &gdk_root_parent;
parent = (GdkWindow*) gdk_root_parent;
parent_private = (GdkWindowPrivate*) parent;
if (GDK_DRAWABLE_DESTROYED (parent))
@ -413,10 +414,23 @@ gdk_window_new (GdkWindow *parent,
height = private->drawable.height;
}
acp = GetACP ();
private->input_locale = GetKeyboardLayout (0);
TranslateCharsetInfo ((DWORD FAR *) acp,
&private->charset_info,
TCI_SRCCODEPAGE);
titlelen = strlen (title);
wctitle = g_new (wchar_t, titlelen);
mbtitle = g_new (char, 3*titlelen + 1);
wlen = gdk_nmbstowchar_ts (wctitle, title, titlelen, titlelen);
WideCharToMultiByte (GetACP (), 0, wctitle, wlen,
mbtitle, 3*titlelen, NULL, NULL);
private->drawable.xwindow =
CreateWindowEx (dwExStyle,
MAKEINTRESOURCE(klass),
title,
mbtitle,
dwStyle,
x, y,
width, height,
@ -424,19 +438,31 @@ gdk_window_new (GdkWindow *parent,
NULL,
gdk_ProgInstance,
NULL);
g_free (mbtitle);
g_free (wctitle);
if (private->drawable.xwindow == NULL)
{
g_warning ("gdk_window_create: CreateWindowEx failed");
g_free (private);
return NULL;
}
GDK_NOTE (MISC,
g_print ("gdk_window_create: %s %s %#x %#x %dx%d@+%d+%d %#x = %#x\n",
g_print ("gdk_window_create: %s %s %dx%d@+%d+%d %#x = %#x\n"
"...locale %#x codepage %d\n",
(private->drawable.window_type == GDK_WINDOW_TOPLEVEL ? "TOPLEVEL" :
(private->drawable.window_type == GDK_WINDOW_CHILD ? "CHILD" :
(private->drawable.window_type == GDK_WINDOW_DIALOG ? "DIALOG" :
(private->drawable.window_type == GDK_WINDOW_TEMP ? "TEMP" :
"???")))),
title,
dwStyle,
private->event_mask,
width, height, (x == CW_USEDEFAULT ? -9999 : x), y,
xparent,
private->drawable.xwindow));
private->drawable.xwindow,
private->input_locale,
private->charset_info.ciACP));
gdk_window_ref (window);
gdk_xid_table_insert (&private->drawable.xwindow, window);
@ -477,7 +503,7 @@ gdk_window_foreign_new (guint32 anid)
point.x = rect.left;
point.y = rect.right;
ClientToScreen ((HWND) anid, &point);
if (parent != HWND_DESKTOP)
if (parent != GetDesktopWindow ())
ScreenToClient (parent, &point);
private->x = point.x;
private->y = point.y;
@ -727,6 +753,7 @@ gdk_window_show (GdkWindow *window)
ShowWindow (private->drawable.xwindow, SW_SHOWNORMAL);
ShowWindow (private->drawable.xwindow, SW_RESTORE);
SetForegroundWindow (private->drawable.xwindow);
BringWindowToTop (private->drawable.xwindow);
#if 0
ShowOwnedPopups (private->drawable.xwindow, TRUE);
#endif
@ -991,7 +1018,7 @@ gdk_window_reparent (GdkWindow *window,
g_return_if_fail (window != NULL);
if (!new_parent)
new_parent = (GdkWindow*) &gdk_root_parent;
new_parent = (GdkWindow*) gdk_root_parent;
window_private = (GdkWindowPrivate*) window;
old_parent_private = (GdkWindowPrivate*)window_private->parent;
@ -1370,6 +1397,11 @@ void
gdk_window_set_title (GdkWindow *window,
const gchar *title)
{
gint titlelen;
wchar_t *wcstr;
gint wlen;
char *mbstr;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
@ -1377,8 +1409,21 @@ gdk_window_set_title (GdkWindow *window,
GDK_DRAWABLE_XID (window), title));
if (!GDK_DRAWABLE_DESTROYED (window))
{
if (!SetWindowText (GDK_DRAWABLE_XID (window), title))
/* As the title most is in UTF-8 we must translate it
* to the system codepage.
*/
titlelen = strlen (title);
wcstr = g_new (wchar_t, titlelen);
mbstr = g_new (char, 3*titlelen + 1);
wlen = gdk_nmbstowchar_ts (wcstr, title, titlelen, titlelen);
WideCharToMultiByte (GetACP (), 0, wcstr, wlen,
mbstr, 3*titlelen, NULL, NULL);
if (!SetWindowText (GDK_DRAWABLE_XID (window), mbstr))
g_warning ("gdk_window_set_title: SetWindowText failed");
g_free (mbstr);
g_free (wcstr);
}
}
@ -1527,7 +1572,7 @@ gdk_window_get_geometry (GdkWindow *window,
g_return_if_fail (window == NULL || GDK_IS_WINDOW (window));
if (!window)
window = (GdkWindow*) &gdk_root_parent;
window = (GdkWindow*) gdk_root_parent;
if (!GDK_DRAWABLE_DESTROYED (window))
{
@ -1660,7 +1705,7 @@ gdk_window_get_pointer (GdkWindow *window,
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
if (!window)
window = (GdkWindow*) &gdk_root_parent;
window = (GdkWindow*) gdk_root_parent;
return_val = NULL;
GetCursorPos (&pointc);
@ -1724,7 +1769,7 @@ gdk_window_at_pointer (gint *win_x,
if (hwnd == NULL)
{
window = (GdkWindow *) &gdk_root_parent;
window = (GdkWindow *) gdk_root_parent;
if (win_x)
*win_x = pointc.x;
if (win_y)
@ -1902,10 +1947,7 @@ gdk_window_add_filter (GdkWindow *window,
if (private && GDK_DRAWABLE_DESTROYED (window))
return;
if (private)
tmp_list = private->filters;
else
tmp_list = gdk_default_filters;
tmp_list = private->filters;
while (tmp_list)
{
@ -1919,10 +1961,7 @@ gdk_window_add_filter (GdkWindow *window,
filter->function = function;
filter->data = data;
if (private)
private->filters = g_list_append (private->filters, filter);
else
gdk_default_filters = g_list_append (gdk_default_filters, filter);
private->filters = g_list_append (private->filters, filter);
}
void
@ -1939,10 +1978,7 @@ gdk_window_remove_filter (GdkWindow *window,
private = (GdkWindowPrivate*) window;
if (private)
tmp_list = private->filters;
else
tmp_list = gdk_default_filters;
tmp_list = private->filters;
while (tmp_list)
{
@ -1952,10 +1988,8 @@ gdk_window_remove_filter (GdkWindow *window,
if ((filter->function == function) && (filter->data == data))
{
if (private)
private->filters = g_list_remove_link (private->filters, node);
else
gdk_default_filters = g_list_remove_link (gdk_default_filters, node);
private->filters = g_list_remove_link (private->filters, node);
g_list_free_1 (node);
g_free (filter);
@ -2091,7 +2125,7 @@ gdk_window_get_toplevels (void)
GList *new_list = NULL;
GList *tmp_list;
tmp_list = gdk_root_parent.children;
tmp_list = gdk_root_parent->children;
while (tmp_list)
{
new_list = g_list_prepend (new_list, tmp_list->data);
@ -2244,7 +2278,7 @@ gdk_window_is_viewable (GdkWindow *window)
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
while (private &&
(private != &gdk_root_parent) &&
(private != gdk_root_parent) &&
(private->drawable.window_type != GDK_WINDOW_FOREIGN))
{
if (!private->mapped)

View File

@ -105,29 +105,25 @@ gdk_window_xid_at_coords (gint x,
void
gdk_window_init (void)
{
unsigned int width;
unsigned int height;
#if 0
width = GetSystemMetrics (SM_CXSCREEN);
height = GetSystemMetrics (SM_CYSCREEN);
#else
{ RECT r; /* //HB: don't obscure tray window (task bar) */
SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
width = r.right - r.left;
height = r.bottom - r.top;
}
#endif
RECT r;
guint width;
guint height;
gdk_root_parent.drawable.xwindow = gdk_root_window;
gdk_root_parent.drawable.window_type = GDK_WINDOW_ROOT;
gdk_root_parent.drawable.drawable.user_data = NULL;
gdk_root_parent.drawable.width = width;
gdk_root_parent.drawable.height = height;
gdk_root_parent.drawable.ref_count = 1;
gdk_root_parent.drawable.colormap = NULL;
gdk_root_parent.children = NULL;
SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
width = r.right - r.left;
height = r.bottom - r.top;
gdk_xid_table_insert (&gdk_root_window, &gdk_root_parent);
gdk_root_parent = g_new (GdkWindowPrivate, 1);
gdk_root_parent->drawable.xwindow = gdk_root_window;
gdk_root_parent->drawable.window_type = GDK_WINDOW_ROOT;
gdk_root_parent->drawable.drawable.user_data = NULL;
gdk_root_parent->drawable.width = width;
gdk_root_parent->drawable.height = height;
gdk_root_parent->drawable.ref_count = 1;
gdk_root_parent->drawable.colormap = NULL;
gdk_root_parent->children = NULL;
gdk_xid_table_insert (&gdk_root_window, gdk_root_parent);
}
/* RegisterGdkClass
@ -258,14 +254,19 @@ gdk_window_new (GdkWindow *parent,
ATOM klass = 0;
DWORD dwStyle, dwExStyle;
RECT rect;
UINT acp;
int width, height;
int x, y;
char *title;
gint titlelen;
wchar_t *wctitle;
gint wlen;
char *mbtitle;
g_return_val_if_fail (attributes != NULL, NULL);
if (!parent)
parent = (GdkWindow*) &gdk_root_parent;
parent = (GdkWindow*) gdk_root_parent;
parent_private = (GdkWindowPrivate*) parent;
if (GDK_DRAWABLE_DESTROYED (parent))
@ -413,10 +414,23 @@ gdk_window_new (GdkWindow *parent,
height = private->drawable.height;
}
acp = GetACP ();
private->input_locale = GetKeyboardLayout (0);
TranslateCharsetInfo ((DWORD FAR *) acp,
&private->charset_info,
TCI_SRCCODEPAGE);
titlelen = strlen (title);
wctitle = g_new (wchar_t, titlelen);
mbtitle = g_new (char, 3*titlelen + 1);
wlen = gdk_nmbstowchar_ts (wctitle, title, titlelen, titlelen);
WideCharToMultiByte (GetACP (), 0, wctitle, wlen,
mbtitle, 3*titlelen, NULL, NULL);
private->drawable.xwindow =
CreateWindowEx (dwExStyle,
MAKEINTRESOURCE(klass),
title,
mbtitle,
dwStyle,
x, y,
width, height,
@ -424,19 +438,31 @@ gdk_window_new (GdkWindow *parent,
NULL,
gdk_ProgInstance,
NULL);
g_free (mbtitle);
g_free (wctitle);
if (private->drawable.xwindow == NULL)
{
g_warning ("gdk_window_create: CreateWindowEx failed");
g_free (private);
return NULL;
}
GDK_NOTE (MISC,
g_print ("gdk_window_create: %s %s %#x %#x %dx%d@+%d+%d %#x = %#x\n",
g_print ("gdk_window_create: %s %s %dx%d@+%d+%d %#x = %#x\n"
"...locale %#x codepage %d\n",
(private->drawable.window_type == GDK_WINDOW_TOPLEVEL ? "TOPLEVEL" :
(private->drawable.window_type == GDK_WINDOW_CHILD ? "CHILD" :
(private->drawable.window_type == GDK_WINDOW_DIALOG ? "DIALOG" :
(private->drawable.window_type == GDK_WINDOW_TEMP ? "TEMP" :
"???")))),
title,
dwStyle,
private->event_mask,
width, height, (x == CW_USEDEFAULT ? -9999 : x), y,
xparent,
private->drawable.xwindow));
private->drawable.xwindow,
private->input_locale,
private->charset_info.ciACP));
gdk_window_ref (window);
gdk_xid_table_insert (&private->drawable.xwindow, window);
@ -477,7 +503,7 @@ gdk_window_foreign_new (guint32 anid)
point.x = rect.left;
point.y = rect.right;
ClientToScreen ((HWND) anid, &point);
if (parent != HWND_DESKTOP)
if (parent != GetDesktopWindow ())
ScreenToClient (parent, &point);
private->x = point.x;
private->y = point.y;
@ -727,6 +753,7 @@ gdk_window_show (GdkWindow *window)
ShowWindow (private->drawable.xwindow, SW_SHOWNORMAL);
ShowWindow (private->drawable.xwindow, SW_RESTORE);
SetForegroundWindow (private->drawable.xwindow);
BringWindowToTop (private->drawable.xwindow);
#if 0
ShowOwnedPopups (private->drawable.xwindow, TRUE);
#endif
@ -991,7 +1018,7 @@ gdk_window_reparent (GdkWindow *window,
g_return_if_fail (window != NULL);
if (!new_parent)
new_parent = (GdkWindow*) &gdk_root_parent;
new_parent = (GdkWindow*) gdk_root_parent;
window_private = (GdkWindowPrivate*) window;
old_parent_private = (GdkWindowPrivate*)window_private->parent;
@ -1370,6 +1397,11 @@ void
gdk_window_set_title (GdkWindow *window,
const gchar *title)
{
gint titlelen;
wchar_t *wcstr;
gint wlen;
char *mbstr;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
@ -1377,8 +1409,21 @@ gdk_window_set_title (GdkWindow *window,
GDK_DRAWABLE_XID (window), title));
if (!GDK_DRAWABLE_DESTROYED (window))
{
if (!SetWindowText (GDK_DRAWABLE_XID (window), title))
/* As the title most is in UTF-8 we must translate it
* to the system codepage.
*/
titlelen = strlen (title);
wcstr = g_new (wchar_t, titlelen);
mbstr = g_new (char, 3*titlelen + 1);
wlen = gdk_nmbstowchar_ts (wcstr, title, titlelen, titlelen);
WideCharToMultiByte (GetACP (), 0, wcstr, wlen,
mbstr, 3*titlelen, NULL, NULL);
if (!SetWindowText (GDK_DRAWABLE_XID (window), mbstr))
g_warning ("gdk_window_set_title: SetWindowText failed");
g_free (mbstr);
g_free (wcstr);
}
}
@ -1527,7 +1572,7 @@ gdk_window_get_geometry (GdkWindow *window,
g_return_if_fail (window == NULL || GDK_IS_WINDOW (window));
if (!window)
window = (GdkWindow*) &gdk_root_parent;
window = (GdkWindow*) gdk_root_parent;
if (!GDK_DRAWABLE_DESTROYED (window))
{
@ -1660,7 +1705,7 @@ gdk_window_get_pointer (GdkWindow *window,
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
if (!window)
window = (GdkWindow*) &gdk_root_parent;
window = (GdkWindow*) gdk_root_parent;
return_val = NULL;
GetCursorPos (&pointc);
@ -1724,7 +1769,7 @@ gdk_window_at_pointer (gint *win_x,
if (hwnd == NULL)
{
window = (GdkWindow *) &gdk_root_parent;
window = (GdkWindow *) gdk_root_parent;
if (win_x)
*win_x = pointc.x;
if (win_y)
@ -1902,10 +1947,7 @@ gdk_window_add_filter (GdkWindow *window,
if (private && GDK_DRAWABLE_DESTROYED (window))
return;
if (private)
tmp_list = private->filters;
else
tmp_list = gdk_default_filters;
tmp_list = private->filters;
while (tmp_list)
{
@ -1919,10 +1961,7 @@ gdk_window_add_filter (GdkWindow *window,
filter->function = function;
filter->data = data;
if (private)
private->filters = g_list_append (private->filters, filter);
else
gdk_default_filters = g_list_append (gdk_default_filters, filter);
private->filters = g_list_append (private->filters, filter);
}
void
@ -1939,10 +1978,7 @@ gdk_window_remove_filter (GdkWindow *window,
private = (GdkWindowPrivate*) window;
if (private)
tmp_list = private->filters;
else
tmp_list = gdk_default_filters;
tmp_list = private->filters;
while (tmp_list)
{
@ -1952,10 +1988,8 @@ gdk_window_remove_filter (GdkWindow *window,
if ((filter->function == function) && (filter->data == data))
{
if (private)
private->filters = g_list_remove_link (private->filters, node);
else
gdk_default_filters = g_list_remove_link (gdk_default_filters, node);
private->filters = g_list_remove_link (private->filters, node);
g_list_free_1 (node);
g_free (filter);
@ -2091,7 +2125,7 @@ gdk_window_get_toplevels (void)
GList *new_list = NULL;
GList *tmp_list;
tmp_list = gdk_root_parent.children;
tmp_list = gdk_root_parent->children;
while (tmp_list)
{
new_list = g_list_prepend (new_list, tmp_list->data);
@ -2244,7 +2278,7 @@ gdk_window_is_viewable (GdkWindow *window)
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
while (private &&
(private != &gdk_root_parent) &&
(private != gdk_root_parent) &&
(private->drawable.window_type != GDK_WINDOW_FOREIGN))
{
if (!private->mapped)

View File

@ -34,7 +34,7 @@
#include <locale.h>
#define GDK_ROOT_WINDOW() ((guint32) HWND_DESKTOP)
#define GDK_ROOT_PARENT() ((GdkWindow *)&gdk_root_parent)
#define GDK_ROOT_PARENT() ((GdkWindow *) gdk_root_parent)
#define GDK_DISPLAY() NULL
#define GDK_DRAWABLE_XDISPLAY(win) NULL
#define GDK_DRAWABLE_XID(win) (((GdkDrawablePrivate*) win)->xwindow)

View File

@ -88,7 +88,7 @@ gdkres.o : rc/gdk.rc
windres --include-dir rc rc/gdk.rc gdkres.o
gdk-$(GTK_VER).dll : $(gdk_OBJECTS) gdk.def gdkres.o libwntab32x.a
$(GLIB)/build-dll gdk $(GTK_VER) gdk.def $(gdk_OBJECTS) -L $(GLIB) -lglib-$(GLIB_VER) -L . -lwntab32x -lgdi32 -luser32 -lshell32 -lole32 -luuid $(LDFLAGS) gdkres.o
$(GLIB)/build-dll gdk $(GTK_VER) gdk.def $(gdk_OBJECTS) -L $(GLIB) -lglib-$(GLIB_VER) -L . -lwntab32x -lgdi32 -luser32 -limm32 -lshell32 -lole32 -luuid $(LDFLAGS) gdkres.o
libwntab32x.a : $(WTKIT)/lib/i386/wntab32x.lib
cp $(WTKIT)/lib/i386/wntab32x.lib libwntab32x.a

144
gdk/win32/surrogate-dimm.h Normal file
View File

@ -0,0 +1,144 @@
#ifndef __SURROGATE_DIMM_H__
#define __SURROGATE_DIMM_H__
/* The Win32api headers doesn't include <dimm.h>, thus we need
* this file, which coverr just the stuff we need from <dimm.h>.
*/
typedef struct IActiveIMMApp IActiveIMMApp;
typedef struct IActiveIMMMessagePumpOwner IActiveIMMMessagePumpOwner;
/* Dummy vtable structs that contain real names and prototypes for
* only those methods we need.
*/
typedef struct {
HRESULT (__stdcall *QueryInterface) (IActiveIMMApp *This,
REFIID riid,
void *ppvObject);
/* Dummy method prototypes for those we don't use */
ULONG (__stdcall *dummy_AddRef)();
ULONG (__stdcall *dummy_Release)();
HRESULT (__stdcall *dummy_AssociateContext)();
HRESULT (__stdcall *dummy_ConfigureIMEA)();
HRESULT (__stdcall *dummy_ConfigureIMEW)();
HRESULT (__stdcall *dummy_CreateContext)();
HRESULT (__stdcall *dummy_DestroyContext)();
HRESULT (__stdcall *dummy_EnumRegisterWordA)();
HRESULT (__stdcall *dummy_EnumRegisterWordW)();
HRESULT (__stdcall *dummy_EscapeA)();
HRESULT (__stdcall *dummy_EscapeW)();
HRESULT (__stdcall *dummy_GetCandidateListA)();
HRESULT (__stdcall *dummy_GetCandidateListW)();
HRESULT (__stdcall *dummy_GetCandidateListCountA)();
HRESULT (__stdcall *dummy_GetCandidateListCountW)();
HRESULT (__stdcall *dummy_GetCandidateWindow)();
HRESULT (__stdcall *dummy_GetCompositionFontA)();
HRESULT (__stdcall *dummy_GetCompositionFontW)();
HRESULT (__stdcall *dummy_GetCompositionStringA)();
HRESULT (__stdcall *dummy_GetCompositionStringW)();
HRESULT (__stdcall *dummy_GetCompositionWindow)();
HRESULT (__stdcall *dummy_GetContext)();
HRESULT (__stdcall *dummy_GetConversionListA)();
HRESULT (__stdcall *dummy_GetConversionListW)();
HRESULT (__stdcall *dummy_GetConversionStatus)();
HRESULT (__stdcall *GetDefaultIMEWnd)(IActiveIMMApp *This,
HWND hWnd,
HWND *phDefWnd);
HRESULT (__stdcall *dummy_GetDescriptionA)();
HRESULT (__stdcall *dummy_GetDescriptionW)();
HRESULT (__stdcall *dummy_GetGuideLineA)();
HRESULT (__stdcall *dummy_GetGuideLineW)();
HRESULT (__stdcall *dummy_GetIMEFileNameA)();
HRESULT (__stdcall *dummy_GetIMEFileNameW)();
HRESULT (__stdcall *dummy_GetOpenStatus)();
HRESULT (__stdcall *dummy_GetProperty)();
HRESULT (__stdcall *dummy_GetRegisterWordStyleA)();
HRESULT (__stdcall *dummy_GetRegisterWordStyleW)();
HRESULT (__stdcall *dummy_GetStatusWindowPos)();
HRESULT (__stdcall *dummy_GetVirtualKey)();
HRESULT (__stdcall *dummy_InstallIMEA)();
HRESULT (__stdcall *dummy_InstallIMEW)();
HRESULT (__stdcall *IsIME)(IActiveIMMApp *This,
HKL hKL);
HRESULT (__stdcall *IsUIMessageA )(IActiveIMMApp *This,
HWND hWndIME,
UINT msg,
WPARAM wParam,
LPARAM lParam);
HRESULT (__stdcall *dummy_IsUIMessageW)();
HRESULT (__stdcall *dummy_NotifyIME)();
HRESULT (__stdcall *dummy_RegisterWordA)();
HRESULT (__stdcall *dummy_RegisterWordW)();
HRESULT (__stdcall *dummy_ReleaseContext)();
HRESULT (__stdcall *dummy_SetCandidateWindow)();
HRESULT (__stdcall *dummy_SetCompositionFontA)();
HRESULT (__stdcall *dummy_SetCompositionFontW)();
HRESULT (__stdcall *dummy_SetCompositionStringA)();
HRESULT (__stdcall *dummy_SetCompositionStringW)();
HRESULT (__stdcall *dummy_SetCompositionWindow)();
HRESULT (__stdcall *dummy_SetConversionStatus)();
HRESULT (__stdcall *dummy_SetOpenStatus)();
HRESULT (__stdcall *dummy_SetStatusWindowPos)();
HRESULT (__stdcall *dummy_SimulateHotKey)();
HRESULT (__stdcall *dummy_UnregisterWordA)();
HRESULT (__stdcall *dummy_UnregisterWordW)();
HRESULT (__stdcall *Activate)(IActiveIMMApp *This,
BOOL restore);
HRESULT (__stdcall *Deactivate)(IActiveIMMApp *This);
HRESULT (__stdcall *OnDefWindowProc)(IActiveIMMApp *This,
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam,
LRESULT *plResult);
HRESULT (__stdcall *dummy_FilterClientWindows)();
HRESULT (__stdcall *GetCodePageA)(IActiveIMMApp *This,
HKL hKL,
UINT *uCodePage);
HRESULT (__stdcall *GetLangId)(IActiveIMMApp *This,
HKL hKL,
LANGID *plid);
HRESULT (__stdcall *dummy_AssociateContextEx)();
HRESULT (__stdcall *dummy_DisableIME)();
HRESULT (__stdcall *dummy_GetImeMenuItemsA)();
HRESULT (__stdcall *dummy_GetImeMenuItemsW)();
HRESULT (__stdcall *dummy_EnumInputContext)();
} IActiveIMMAppVtbl;
struct IActiveIMMApp {
IActiveIMMAppVtbl *lpVtbl;
};
typedef struct {
HRESULT (__stdcall *dummy_QueryInterface)();
ULONG (__stdcall *dummy_AddRef)();
ULONG (__stdcall *dummy_Release)();
HRESULT (__stdcall *Start)(IActiveIMMMessagePumpOwner *This);
HRESULT (__stdcall *End)(IActiveIMMMessagePumpOwner *This);
HRESULT (__stdcall *OnTranslateMessage)(IActiveIMMMessagePumpOwner *This,
MSG *pMSG);
HRESULT (__stdcall *dummy_Pause)();
HRESULT (__stdcall *dummy_Resume)();
} IActiveIMMMessagePumpOwnerVtbl;
struct IActiveIMMMessagePumpOwner {
IActiveIMMMessagePumpOwnerVtbl *lpVtbl;
};
static UUID CLSID_CActiveIMM = {
0x4955DD33, 0xB159, 0x11d0, { 0x8F,0xCF,0x00,0xAA,0x00,0x6B,0xCC,0x59 } };
static IID IID_IActiveIMMApp = {
0x08C0E040, 0x62D1, 0x11D1, { 0x93,0x26,0x00,0x60,0xB0,0x67,0xB8,0x6E } };
static IID IID_IActiveIMMMessagePumpOwner = {
0xB5CF2CFA, 0x8AEB, 0x11D1, { 0x93,0x64,0x00,0x60,0xB0,0x67,0xB8,0x6E } };
#endif /* __SURROGATE_DIMM_H__ */

View File

@ -1773,7 +1773,12 @@ gtk_font_selection_load_font (GtkFontSelection *fontsel)
#ifdef FONTSEL_DEBUG
g_message("Loading: %s\n", fontname);
#endif
#ifndef GDK_WINDOWING_WIN32
font = gdk_font_load (fontname);
#else
/* Load as a fontset so that gtkentry uses wide chars for it */
font = gdk_fontset_load (fontname);
#endif
g_free(fontname);
if (font)

View File

@ -405,7 +405,7 @@ gtk_init_check (int *argc,
bindtextdomain("gtk+", GTK_LOCALEDIR);
#else
{
/* GTk+ locale dir is %WinDir%\gtk\locale */
/* GTk+ locale dir is %WinDir%\gtk+\locale */
extern char *get_gtk_sysconf_directory ();
bindtextdomain ("gtk+", g_strconcat (get_gtk_sysconf_directory (),
G_DIR_SEPARATOR_S,

View File

@ -239,7 +239,7 @@ get_gtk_sysconf_directory (void)
gchar win_dir[100];
GetWindowsDirectory (win_dir, sizeof (win_dir));
sprintf (gtk_sysconf_dir, "%s\\gtk", win_dir);
sprintf (gtk_sysconf_dir, "%s\\gtk+", win_dir);
return gtk_sysconf_dir;
}
@ -467,10 +467,14 @@ gtk_rc_init (void)
gchar *locale_suffixes[3];
gint n_locale_suffixes = 0;
gint i, j;
#ifdef G_OS_WIN32
char *locale = gwin_getlocale ();
#else
#ifdef HAVE_LC_MESSAGES
char *locale = setlocale (LC_MESSAGES, NULL);
#else
char *locale = setlocale (LC_CTYPE, NULL);
#endif
#endif
guint length;
char *p;