New font private structures, related to fontsets.

1999-11-07  Tor Lillqvist  <tml@iki.fi>

* gdk/win32/gdkprivate.h: New font private structures, related to
fontsets.

* gdk/win32/gdkfont.c: New functions gdk_font_list_new() and
gdk_font_list_free(). On X11, will just be wrappers to
XListFonts() and XFreeFontNames(). On Win32, the code previously
in gtkfontsel.c is now here.

New function gdk_font_xlfd_create(). On X11 will get the FONT
property of the font (for GDK_FONT_FONTs), or call
XBaseFontNameListOfFontSet (for GDK_FONT_FONTSETs), on Win32
builds a XLFD style name from the font information in the LOGFONT
struct(s).

New function gdk_font_xlfd_free(), which correspondingly frees the
string returned by gdk_font_xlfd_create().

Implement fontsets on Win32. Add a function that iterates over a
wide char string and calls a callback function for each substring
of wide chars from the same Unicode subrange (and thus probably
available in the same real font).

Improve the XLFD emulation a bit.

* gdk/win32/gdkim.c (gdk_nmbstowchar_ts): Small bugfix.

* gdk/win32/gdkevents.c: Workaround for suspected bug on Win2k
Beta3, WM_IME_CHAR messages don't seem to contain the composed
multi-byte char as with the Active IMM on Win9x. Oh well, handle
WM_IME_COMPOSITION with GCS_RESULTSTR instead, use
ImmGetCompositionStringW() to get the composed Unicode chars.

* gdk/win32/gdkgc.c
* gdk/win32/gdkdraw.c: Changes needed because of the font private
struct changes.

* gdk/win32/gdk.def: Add the new functions.
This commit is contained in:
Tor Lillqvist 1999-11-08 00:09:29 +00:00 committed by Tor Lillqvist
parent 559a8c8691
commit 0ad4aa57d6
29 changed files with 2225 additions and 564 deletions

View File

@ -1,3 +1,43 @@
1999-11-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate.h: New font private structures, related to
fontsets.
* gdk/win32/gdkfont.c: New functions gdk_font_list_new() and
gdk_font_list_free(). On X11, will just be wrappers to
XListFonts() and XFreeFontNames(). On Win32, the code previously
in gtkfontsel.c is now here.
New function gdk_font_xlfd_create(). On X11 will get the FONT
property of the font (for GDK_FONT_FONTs), or call
XBaseFontNameListOfFontSet (for GDK_FONT_FONTSETs), on Win32
builds a XLFD style name from the font information in the LOGFONT
struct(s).
New function gdk_font_xlfd_free(), which correspondingly frees the
string returned by gdk_font_xlfd_create().
Implement fontsets on Win32. Add a function that iterates over a
wide char string and calls a callback function for each substring
of wide chars from the same Unicode subrange (and thus probably
available in the same real font).
Improve the XLFD emulation a bit.
* gdk/win32/gdkim.c (gdk_nmbstowchar_ts): Small bugfix.
* gdk/win32/gdkevents.c: Workaround for suspected bug on Win2k
Beta3, WM_IME_CHAR messages don't seem to contain the composed
multi-byte char as with the Active IMM on Win9x. Oh well, handle
WM_IME_COMPOSITION with GCS_RESULTSTR instead, use
ImmGetCompositionStringW() to get the composed Unicode chars.
* gdk/win32/gdkgc.c
* gdk/win32/gdkdraw.c: Changes needed because of the font private
struct changes.
* gdk/win32/gdk.def: Add the new functions.
1999-11-04 Tor Lillqvist <tml@iki.fi>
* config.h.win32: Don't define HAVE_DIMM_H if MSC, as you have to

View File

@ -1,3 +1,43 @@
1999-11-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate.h: New font private structures, related to
fontsets.
* gdk/win32/gdkfont.c: New functions gdk_font_list_new() and
gdk_font_list_free(). On X11, will just be wrappers to
XListFonts() and XFreeFontNames(). On Win32, the code previously
in gtkfontsel.c is now here.
New function gdk_font_xlfd_create(). On X11 will get the FONT
property of the font (for GDK_FONT_FONTs), or call
XBaseFontNameListOfFontSet (for GDK_FONT_FONTSETs), on Win32
builds a XLFD style name from the font information in the LOGFONT
struct(s).
New function gdk_font_xlfd_free(), which correspondingly frees the
string returned by gdk_font_xlfd_create().
Implement fontsets on Win32. Add a function that iterates over a
wide char string and calls a callback function for each substring
of wide chars from the same Unicode subrange (and thus probably
available in the same real font).
Improve the XLFD emulation a bit.
* gdk/win32/gdkim.c (gdk_nmbstowchar_ts): Small bugfix.
* gdk/win32/gdkevents.c: Workaround for suspected bug on Win2k
Beta3, WM_IME_CHAR messages don't seem to contain the composed
multi-byte char as with the Active IMM on Win9x. Oh well, handle
WM_IME_COMPOSITION with GCS_RESULTSTR instead, use
ImmGetCompositionStringW() to get the composed Unicode chars.
* gdk/win32/gdkgc.c
* gdk/win32/gdkdraw.c: Changes needed because of the font private
struct changes.
* gdk/win32/gdk.def: Add the new functions.
1999-11-04 Tor Lillqvist <tml@iki.fi>
* config.h.win32: Don't define HAVE_DIMM_H if MSC, as you have to

View File

@ -1,3 +1,43 @@
1999-11-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate.h: New font private structures, related to
fontsets.
* gdk/win32/gdkfont.c: New functions gdk_font_list_new() and
gdk_font_list_free(). On X11, will just be wrappers to
XListFonts() and XFreeFontNames(). On Win32, the code previously
in gtkfontsel.c is now here.
New function gdk_font_xlfd_create(). On X11 will get the FONT
property of the font (for GDK_FONT_FONTs), or call
XBaseFontNameListOfFontSet (for GDK_FONT_FONTSETs), on Win32
builds a XLFD style name from the font information in the LOGFONT
struct(s).
New function gdk_font_xlfd_free(), which correspondingly frees the
string returned by gdk_font_xlfd_create().
Implement fontsets on Win32. Add a function that iterates over a
wide char string and calls a callback function for each substring
of wide chars from the same Unicode subrange (and thus probably
available in the same real font).
Improve the XLFD emulation a bit.
* gdk/win32/gdkim.c (gdk_nmbstowchar_ts): Small bugfix.
* gdk/win32/gdkevents.c: Workaround for suspected bug on Win2k
Beta3, WM_IME_CHAR messages don't seem to contain the composed
multi-byte char as with the Active IMM on Win9x. Oh well, handle
WM_IME_COMPOSITION with GCS_RESULTSTR instead, use
ImmGetCompositionStringW() to get the composed Unicode chars.
* gdk/win32/gdkgc.c
* gdk/win32/gdkdraw.c: Changes needed because of the font private
struct changes.
* gdk/win32/gdk.def: Add the new functions.
1999-11-04 Tor Lillqvist <tml@iki.fi>
* config.h.win32: Don't define HAVE_DIMM_H if MSC, as you have to

View File

@ -1,3 +1,43 @@
1999-11-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate.h: New font private structures, related to
fontsets.
* gdk/win32/gdkfont.c: New functions gdk_font_list_new() and
gdk_font_list_free(). On X11, will just be wrappers to
XListFonts() and XFreeFontNames(). On Win32, the code previously
in gtkfontsel.c is now here.
New function gdk_font_xlfd_create(). On X11 will get the FONT
property of the font (for GDK_FONT_FONTs), or call
XBaseFontNameListOfFontSet (for GDK_FONT_FONTSETs), on Win32
builds a XLFD style name from the font information in the LOGFONT
struct(s).
New function gdk_font_xlfd_free(), which correspondingly frees the
string returned by gdk_font_xlfd_create().
Implement fontsets on Win32. Add a function that iterates over a
wide char string and calls a callback function for each substring
of wide chars from the same Unicode subrange (and thus probably
available in the same real font).
Improve the XLFD emulation a bit.
* gdk/win32/gdkim.c (gdk_nmbstowchar_ts): Small bugfix.
* gdk/win32/gdkevents.c: Workaround for suspected bug on Win2k
Beta3, WM_IME_CHAR messages don't seem to contain the composed
multi-byte char as with the Active IMM on Win9x. Oh well, handle
WM_IME_COMPOSITION with GCS_RESULTSTR instead, use
ImmGetCompositionStringW() to get the composed Unicode chars.
* gdk/win32/gdkgc.c
* gdk/win32/gdkdraw.c: Changes needed because of the font private
struct changes.
* gdk/win32/gdk.def: Add the new functions.
1999-11-04 Tor Lillqvist <tml@iki.fi>
* config.h.win32: Don't define HAVE_DIMM_H if MSC, as you have to

View File

@ -1,3 +1,43 @@
1999-11-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate.h: New font private structures, related to
fontsets.
* gdk/win32/gdkfont.c: New functions gdk_font_list_new() and
gdk_font_list_free(). On X11, will just be wrappers to
XListFonts() and XFreeFontNames(). On Win32, the code previously
in gtkfontsel.c is now here.
New function gdk_font_xlfd_create(). On X11 will get the FONT
property of the font (for GDK_FONT_FONTs), or call
XBaseFontNameListOfFontSet (for GDK_FONT_FONTSETs), on Win32
builds a XLFD style name from the font information in the LOGFONT
struct(s).
New function gdk_font_xlfd_free(), which correspondingly frees the
string returned by gdk_font_xlfd_create().
Implement fontsets on Win32. Add a function that iterates over a
wide char string and calls a callback function for each substring
of wide chars from the same Unicode subrange (and thus probably
available in the same real font).
Improve the XLFD emulation a bit.
* gdk/win32/gdkim.c (gdk_nmbstowchar_ts): Small bugfix.
* gdk/win32/gdkevents.c: Workaround for suspected bug on Win2k
Beta3, WM_IME_CHAR messages don't seem to contain the composed
multi-byte char as with the Active IMM on Win9x. Oh well, handle
WM_IME_COMPOSITION with GCS_RESULTSTR instead, use
ImmGetCompositionStringW() to get the composed Unicode chars.
* gdk/win32/gdkgc.c
* gdk/win32/gdkdraw.c: Changes needed because of the font private
struct changes.
* gdk/win32/gdk.def: Add the new functions.
1999-11-04 Tor Lillqvist <tml@iki.fi>
* config.h.win32: Don't define HAVE_DIMM_H if MSC, as you have to

View File

@ -1,3 +1,43 @@
1999-11-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate.h: New font private structures, related to
fontsets.
* gdk/win32/gdkfont.c: New functions gdk_font_list_new() and
gdk_font_list_free(). On X11, will just be wrappers to
XListFonts() and XFreeFontNames(). On Win32, the code previously
in gtkfontsel.c is now here.
New function gdk_font_xlfd_create(). On X11 will get the FONT
property of the font (for GDK_FONT_FONTs), or call
XBaseFontNameListOfFontSet (for GDK_FONT_FONTSETs), on Win32
builds a XLFD style name from the font information in the LOGFONT
struct(s).
New function gdk_font_xlfd_free(), which correspondingly frees the
string returned by gdk_font_xlfd_create().
Implement fontsets on Win32. Add a function that iterates over a
wide char string and calls a callback function for each substring
of wide chars from the same Unicode subrange (and thus probably
available in the same real font).
Improve the XLFD emulation a bit.
* gdk/win32/gdkim.c (gdk_nmbstowchar_ts): Small bugfix.
* gdk/win32/gdkevents.c: Workaround for suspected bug on Win2k
Beta3, WM_IME_CHAR messages don't seem to contain the composed
multi-byte char as with the Active IMM on Win9x. Oh well, handle
WM_IME_COMPOSITION with GCS_RESULTSTR instead, use
ImmGetCompositionStringW() to get the composed Unicode chars.
* gdk/win32/gdkgc.c
* gdk/win32/gdkdraw.c: Changes needed because of the font private
struct changes.
* gdk/win32/gdk.def: Add the new functions.
1999-11-04 Tor Lillqvist <tml@iki.fi>
* config.h.win32: Don't define HAVE_DIMM_H if MSC, as you have to

View File

@ -1,3 +1,43 @@
1999-11-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate.h: New font private structures, related to
fontsets.
* gdk/win32/gdkfont.c: New functions gdk_font_list_new() and
gdk_font_list_free(). On X11, will just be wrappers to
XListFonts() and XFreeFontNames(). On Win32, the code previously
in gtkfontsel.c is now here.
New function gdk_font_xlfd_create(). On X11 will get the FONT
property of the font (for GDK_FONT_FONTs), or call
XBaseFontNameListOfFontSet (for GDK_FONT_FONTSETs), on Win32
builds a XLFD style name from the font information in the LOGFONT
struct(s).
New function gdk_font_xlfd_free(), which correspondingly frees the
string returned by gdk_font_xlfd_create().
Implement fontsets on Win32. Add a function that iterates over a
wide char string and calls a callback function for each substring
of wide chars from the same Unicode subrange (and thus probably
available in the same real font).
Improve the XLFD emulation a bit.
* gdk/win32/gdkim.c (gdk_nmbstowchar_ts): Small bugfix.
* gdk/win32/gdkevents.c: Workaround for suspected bug on Win2k
Beta3, WM_IME_CHAR messages don't seem to contain the composed
multi-byte char as with the Active IMM on Win9x. Oh well, handle
WM_IME_COMPOSITION with GCS_RESULTSTR instead, use
ImmGetCompositionStringW() to get the composed Unicode chars.
* gdk/win32/gdkgc.c
* gdk/win32/gdkdraw.c: Changes needed because of the font private
struct changes.
* gdk/win32/gdk.def: Add the new functions.
1999-11-04 Tor Lillqvist <tml@iki.fi>
* config.h.win32: Don't define HAVE_DIMM_H if MSC, as you have to

View File

@ -105,9 +105,13 @@ EXPORTS
gdk_flush
gdk_font_equal
gdk_font_id
gdk_font_list_free
gdk_font_list_new
gdk_font_load
gdk_font_ref
gdk_font_unref
gdk_font_xlfd_create
gdk_font_xlfd_free
gdk_fontset_load
gdk_free_compound_text
gdk_free_text_list

View File

@ -235,6 +235,7 @@ gdk_init_check (int *argc,
gdk_ProgInstance = GetModuleHandle (NULL);
gdk_DC = CreateDC ("DISPLAY", NULL, NULL, NULL);
gdk_root_window = GetDesktopWindow ();
windows_version = GetVersion ();
CoInitialize (NULL);

View File

@ -105,9 +105,13 @@ EXPORTS
gdk_flush
gdk_font_equal
gdk_font_id
gdk_font_list_free
gdk_font_list_new
gdk_font_load
gdk_font_ref
gdk_font_unref
gdk_font_xlfd_create
gdk_font_xlfd_free
gdk_fontset_load
gdk_free_compound_text
gdk_free_text_list

View File

@ -6,3 +6,4 @@
#define GDK_HAVE_WCTYPE_H 1
#endif
#define GDK_USE_UTF8_MBS 1

View File

@ -209,8 +209,7 @@ gdk_draw_line (GdkDrawable *drawable,
* we draw the end pixel separately... With wider pens we don't care.
* //HB: But the NT developers don't read their API documentation ...
*/
if (gc_private->pen_width == 1
&& GetVersion () > 0x80000000)
if (gc_private->pen_width == 1 && windows_version > 0x80000000)
if (!LineTo (hdc, x2 + 1, y2))
g_warning ("gdk_draw_line: LineTo #2 failed");
gdk_gc_postdraw (drawable_private, gc_private);
@ -423,6 +422,12 @@ gdk_draw_polygon (GdkDrawable *drawable,
gdk_gc_postdraw (drawable_private, gc_private);
}
typedef struct
{
gint x, y;
HDC hdc;
} gdk_draw_text_arg;
/* gdk_draw_string
*/
void
@ -436,9 +441,35 @@ gdk_draw_string (GdkDrawable *drawable,
gdk_draw_text (drawable, font, gc, x, y, string, strlen (string));
}
static void
gdk_draw_text_handler (GdkWin32SingleFont *singlefont,
const wchar_t *wcstr,
int wclen,
void *arg)
{
HDC hdc;
HGDIOBJ oldfont;
SIZE size;
GdkDrawablePrivate *drawable_private;
GdkGCPrivate *gc_private;
gdk_draw_text_arg *argp = (gdk_draw_text_arg *) arg;
if ((oldfont = SelectObject (argp->hdc, singlefont->xfont)) == NULL)
{
g_warning ("gdk_draw_text_handler: SelectObject failed");
return;
}
if (!TextOutW (argp->hdc, argp->x, argp->y, wcstr, wclen))
g_warning ("gdk_draw_text_handler: TextOutW failed");
GetTextExtentPoint32W (argp->hdc, wcstr, wclen, &size);
argp->x += size.cx;
SelectObject (hdc, oldfont);
}
/* gdk_draw_text
*
* Interface changed: add "GdkFont *font" to specify font or fontset explicitely
*/
void
gdk_draw_text (GdkDrawable *drawable,
@ -449,14 +480,12 @@ gdk_draw_text (GdkDrawable *drawable,
const gchar *text,
gint text_length)
{
GdkDrawablePrivate *drawable_private;
GdkFontPrivate *font_private;
GdkGCPrivate *gc_private;
HDC hdc;
HFONT xfont;
HGDIOBJ oldfont;
GdkDrawablePrivate *drawable_private;
GdkGCPrivate *gc_private;
wchar_t *wcstr;
gint wlen;
gdk_draw_text_arg arg;
g_return_if_fail (drawable != NULL);
g_return_if_fail (font != NULL);
@ -473,30 +502,26 @@ gdk_draw_text (GdkDrawable *drawable,
drawable_private = (GdkDrawablePrivate*) drawable;
gc_private = (GdkGCPrivate*) gc;
font_private = (GdkFontPrivate*) font;
hdc = gdk_gc_predraw (drawable_private, gc_private);
xfont = (HFONT) font_private->xfont;
arg.x = x;
arg.y = y;
arg.hdc = gdk_gc_predraw (drawable_private, gc_private);
GDK_NOTE (MISC, g_print ("gdk_draw_text: %#x (%d) %#x "
"+%d+%d font: %#x \"%.*s\" length: %d\n",
GDK_NOTE (MISC, g_print ("gdk_draw_text: %#x (%d,%d) \"%.*s\" (len %d)\n",
drawable_private->xwindow,
gc_private, gc_private->xgc,
x, y, xfont,
x, y,
(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");
else
gdk_wchar_text_handle (font, wcstr, wlen,
gdk_draw_text_handler, &arg);
g_free (wcstr);
if (oldfont != NULL)
SelectObject (hdc, oldfont);
gdk_gc_postdraw (drawable_private, gc_private);
}
@ -510,13 +535,11 @@ gdk_draw_text_wc (GdkDrawable *drawable,
gint text_length)
{
HDC hdc;
HGDIOBJ oldfont;
GdkDrawablePrivate *drawable_private;
GdkFontPrivate *font_private;
GdkGCPrivate *gc_private;
gint i, wlen;
wchar_t *wcstr;
guchar *str;
gdk_draw_text_arg arg;
g_return_if_fail (drawable != NULL);
g_return_if_fail (font != NULL);
@ -533,19 +556,15 @@ gdk_draw_text_wc (GdkDrawable *drawable,
drawable_private = (GdkDrawablePrivate*) drawable;
gc_private = (GdkGCPrivate*) gc;
font_private = (GdkFontPrivate*) font;
hdc = gdk_gc_predraw (drawable_private, gc_private);
arg.x = x;
arg.y = y;
arg.hdc = gdk_gc_predraw (drawable_private, gc_private);
GDK_NOTE (MISC, g_print ("gdk_draw_text_wc: %#x (%d) %#x "
"+%d+%d font: %#x length: %d\n",
GDK_NOTE (MISC, g_print ("gdk_draw_text_wc: %#x (%d,%d) len: %d\n",
drawable_private->xwindow,
gc_private, gc_private->xgc,
x, y, font_private->xfont,
text_length));
x, y, text_length));
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);
@ -555,13 +574,12 @@ gdk_draw_text_wc (GdkDrawable *drawable,
else
wcstr = (wchar_t *) text;
if (!TextOutW (hdc, x, y, wcstr, text_length))
g_warning ("gdk_draw_text_wc: TextOutW failed");
gdk_wchar_text_handle (font, wcstr, text_length,
gdk_draw_text_handler, &arg);
if (sizeof (wchar_t) != sizeof (GdkWChar))
g_free (wcstr);
if (oldfont != NULL)
SelectObject (hdc, oldfont);
gdk_gc_postdraw (drawable_private, gc_private);
}

View File

@ -209,8 +209,7 @@ gdk_draw_line (GdkDrawable *drawable,
* we draw the end pixel separately... With wider pens we don't care.
* //HB: But the NT developers don't read their API documentation ...
*/
if (gc_private->pen_width == 1
&& GetVersion () > 0x80000000)
if (gc_private->pen_width == 1 && windows_version > 0x80000000)
if (!LineTo (hdc, x2 + 1, y2))
g_warning ("gdk_draw_line: LineTo #2 failed");
gdk_gc_postdraw (drawable_private, gc_private);
@ -423,6 +422,12 @@ gdk_draw_polygon (GdkDrawable *drawable,
gdk_gc_postdraw (drawable_private, gc_private);
}
typedef struct
{
gint x, y;
HDC hdc;
} gdk_draw_text_arg;
/* gdk_draw_string
*/
void
@ -436,9 +441,35 @@ gdk_draw_string (GdkDrawable *drawable,
gdk_draw_text (drawable, font, gc, x, y, string, strlen (string));
}
static void
gdk_draw_text_handler (GdkWin32SingleFont *singlefont,
const wchar_t *wcstr,
int wclen,
void *arg)
{
HDC hdc;
HGDIOBJ oldfont;
SIZE size;
GdkDrawablePrivate *drawable_private;
GdkGCPrivate *gc_private;
gdk_draw_text_arg *argp = (gdk_draw_text_arg *) arg;
if ((oldfont = SelectObject (argp->hdc, singlefont->xfont)) == NULL)
{
g_warning ("gdk_draw_text_handler: SelectObject failed");
return;
}
if (!TextOutW (argp->hdc, argp->x, argp->y, wcstr, wclen))
g_warning ("gdk_draw_text_handler: TextOutW failed");
GetTextExtentPoint32W (argp->hdc, wcstr, wclen, &size);
argp->x += size.cx;
SelectObject (hdc, oldfont);
}
/* gdk_draw_text
*
* Interface changed: add "GdkFont *font" to specify font or fontset explicitely
*/
void
gdk_draw_text (GdkDrawable *drawable,
@ -449,14 +480,12 @@ gdk_draw_text (GdkDrawable *drawable,
const gchar *text,
gint text_length)
{
GdkDrawablePrivate *drawable_private;
GdkFontPrivate *font_private;
GdkGCPrivate *gc_private;
HDC hdc;
HFONT xfont;
HGDIOBJ oldfont;
GdkDrawablePrivate *drawable_private;
GdkGCPrivate *gc_private;
wchar_t *wcstr;
gint wlen;
gdk_draw_text_arg arg;
g_return_if_fail (drawable != NULL);
g_return_if_fail (font != NULL);
@ -473,30 +502,26 @@ gdk_draw_text (GdkDrawable *drawable,
drawable_private = (GdkDrawablePrivate*) drawable;
gc_private = (GdkGCPrivate*) gc;
font_private = (GdkFontPrivate*) font;
hdc = gdk_gc_predraw (drawable_private, gc_private);
xfont = (HFONT) font_private->xfont;
arg.x = x;
arg.y = y;
arg.hdc = gdk_gc_predraw (drawable_private, gc_private);
GDK_NOTE (MISC, g_print ("gdk_draw_text: %#x (%d) %#x "
"+%d+%d font: %#x \"%.*s\" length: %d\n",
GDK_NOTE (MISC, g_print ("gdk_draw_text: %#x (%d,%d) \"%.*s\" (len %d)\n",
drawable_private->xwindow,
gc_private, gc_private->xgc,
x, y, xfont,
x, y,
(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");
else
gdk_wchar_text_handle (font, wcstr, wlen,
gdk_draw_text_handler, &arg);
g_free (wcstr);
if (oldfont != NULL)
SelectObject (hdc, oldfont);
gdk_gc_postdraw (drawable_private, gc_private);
}
@ -510,13 +535,11 @@ gdk_draw_text_wc (GdkDrawable *drawable,
gint text_length)
{
HDC hdc;
HGDIOBJ oldfont;
GdkDrawablePrivate *drawable_private;
GdkFontPrivate *font_private;
GdkGCPrivate *gc_private;
gint i, wlen;
wchar_t *wcstr;
guchar *str;
gdk_draw_text_arg arg;
g_return_if_fail (drawable != NULL);
g_return_if_fail (font != NULL);
@ -533,19 +556,15 @@ gdk_draw_text_wc (GdkDrawable *drawable,
drawable_private = (GdkDrawablePrivate*) drawable;
gc_private = (GdkGCPrivate*) gc;
font_private = (GdkFontPrivate*) font;
hdc = gdk_gc_predraw (drawable_private, gc_private);
arg.x = x;
arg.y = y;
arg.hdc = gdk_gc_predraw (drawable_private, gc_private);
GDK_NOTE (MISC, g_print ("gdk_draw_text_wc: %#x (%d) %#x "
"+%d+%d font: %#x length: %d\n",
GDK_NOTE (MISC, g_print ("gdk_draw_text_wc: %#x (%d,%d) len: %d\n",
drawable_private->xwindow,
gc_private, gc_private->xgc,
x, y, font_private->xfont,
text_length));
x, y, text_length));
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);
@ -555,13 +574,12 @@ gdk_draw_text_wc (GdkDrawable *drawable,
else
wcstr = (wchar_t *) text;
if (!TextOutW (hdc, x, y, wcstr, text_length))
g_warning ("gdk_draw_text_wc: TextOutW failed");
gdk_wchar_text_handle (font, wcstr, text_length,
gdk_draw_text_handler, &arg);
if (sizeof (wchar_t) != sizeof (GdkWChar))
g_free (wcstr);
if (oldfont != NULL)
SelectObject (hdc, oldfont);
gdk_gc_postdraw (drawable_private, gc_private);
}

View File

@ -187,6 +187,11 @@ static gboolean is_AltGr_key = FALSE;
static IActiveIMMApp *paimmapp = NULL;
static IActiveIMMMessagePumpOwner *paimmmpo = NULL;
typedef BOOL (WINAPI *PFN_TrackMouseEvent) (LPTRACKMOUSEEVENT);
static PFN_TrackMouseEvent p_TrackMouseEvent = NULL;
static gboolean use_IME_COMPOSITION = FALSE;
LRESULT CALLBACK
gdk_WindowProc (HWND hWnd,
UINT message,
@ -381,7 +386,7 @@ void
gdk_events_init (void)
{
HRESULT hres;
HMODULE user32;
HMODULE user32, imm32;
HINSTANCE commctrl32;
if (g_pipe_readable_msg == 0)
@ -430,11 +435,21 @@ gdk_events_init (void)
if ((p_TrackMouseEvent = GetProcAddress (user32, "TrackMouseEvent")) == NULL)
{
if ((commctrl32 = LoadLibrary ("commctrl32.dll")) != NULL)
p_TrackMouseEvent = GetProcAddress (commctrl32, "_TrackMouseEvent");
p_TrackMouseEvent = (PFN_TrackMouseEvent)
GetProcAddress (commctrl32, "_TrackMouseEvent");
}
if (p_TrackMouseEvent != NULL)
GDK_NOTE (EVENTS, g_print ("Using TrackMouseEvent to detect leave events\n"));
#endif
if (windows_version < 0x80000000 && (windows_version & 0xFF) == 5)
{
/* On Win2k (Beta 3, at least) WM_IME_CHAR doesn't seem to work
* correctly for non-Unicode applications. Handle
* WM_IME_COMPOSITION with GCS_RESULTSTR instead, fetch the
* Unicode char from the IME with ImmGetCompositionStringW().
*/
use_IME_COMPOSITION = TRUE;
}
}
/*
@ -1174,6 +1189,8 @@ gdk_add_client_message_filter (GdkAtom message_type,
* mapping functions, from the xterm sources.
*/
#if 0 /* Keyval-to-Unicode isn't actually needed */
struct k2u {
unsigned short keysym;
unsigned short ucs;
@ -1997,6 +2014,8 @@ keyval_to_unicode (guint keysym)
return -1;
}
#endif /* 0 */
struct u2k {
unsigned short keysym;
unsigned short ucs;
@ -2841,6 +2860,7 @@ build_keypress_event (GdkWindowPrivate *window_private,
GdkEvent *event,
MSG *xevent)
{
HIMC hIMC;
gint i, bytesleft, bytecount, ucount, ucleft, len;
guchar buf[100], *bp;
wchar_t wbuf[100], *wcp;
@ -2848,39 +2868,50 @@ build_keypress_event (GdkWindowPrivate *window_private,
event->key.type = GDK_KEY_PRESS;
event->key.time = xevent->time;
if (xevent->message == WM_CHAR)
if (xevent->message == WM_IME_COMPOSITION)
{
bytecount = MIN ((xevent->lParam & 0xFFFF), sizeof (buf));
for (i = 0; i < bytecount; i++)
buf[i] = xevent->wParam;
hIMC = ImmGetContext (xevent->hwnd);
bytecount = ImmGetCompositionStringW (hIMC, GCS_RESULTSTR,
wbuf, sizeof (wbuf));
ucount = bytecount / 2;
}
else
{
/* WM_IME_CHAR */
event->key.keyval = GDK_VoidSymbol;
if (xevent->wParam & 0xFF00)
if (xevent->message == WM_CHAR)
{
/* Contrary to the documentation,
* the lead byte is the msb byte.
*/
buf[0] = ((xevent->wParam >> 8) & 0xFF);
buf[1] = (xevent->wParam & 0xFF);
bytecount = 2;
bytecount = MIN ((xevent->lParam & 0xFFFF), sizeof (buf));
for (i = 0; i < bytecount; i++)
buf[i] = xevent->wParam;
}
else
else /* WM_IME_CHAR */
{
buf[0] = (xevent->wParam & 0xFF);
bytecount = 1;
event->key.keyval = GDK_VoidSymbol;
if (xevent->wParam & 0xFF00)
{
/* Contrary to some versions of the documentation,
* the lead byte is the most significant byte.
*/
buf[0] = ((xevent->wParam >> 8) & 0xFF);
buf[1] = (xevent->wParam & 0xFF);
bytecount = 2;
}
else
{
buf[0] = (xevent->wParam & 0xFF);
bytecount = 1;
}
}
}
/* Convert from the window's current code page
* to Unicode. Then convert to UTF-8.
* We don't handle the surrogate stuff. Should we?
*/
ucount = MultiByteToWideChar (window_private->charset_info.ciACP,
0, buf, bytecount, wbuf, 100);
/* Convert from the window's current code page
* to Unicode. Then convert to UTF-8.
* We don't handle the surrogate stuff. Should we?
*/
ucount = MultiByteToWideChar (window_private->charset_info.ciACP,
0, buf, bytecount,
wbuf, sizeof (wbuf) / sizeof (wbuf[0]));
}
if (ucount == 0)
event->key.keyval = GDK_VoidSymbol;
else if (xevent->message == WM_CHAR)
@ -2958,6 +2989,35 @@ build_keypress_event (GdkWindowPrivate *window_private,
*bp = 0;
}
static void
build_keyrelease_event (GdkWindowPrivate *window_private,
GdkEvent *event,
MSG *xevent)
{
guchar buf;
wchar_t wbuf;
event->key.type = GDK_KEY_RELEASE;
event->key.time = xevent->time;
if (xevent->message == WM_CHAR)
if (xevent->wParam < ' ')
event->key.keyval = xevent->wParam + '@';
else
{
buf = xevent->wParam;
MultiByteToWideChar (window_private->charset_info.ciACP,
0, &buf, 1, &wbuf, 1);
event->key.keyval = unicode_to_keyval (wbuf);
}
else
event->key.keyval = GDK_VoidSymbol;
build_key_event_state (event);
event->key.string = NULL;
event->key.length = 0;
}
static void
print_event_state (gint state)
{
@ -3368,7 +3428,7 @@ gdk_event_translate (GdkEvent *event,
HDC bgdc;
HGDIOBJ oldbitmap;
int button;
int i, j;
int i, j, n, k;
gchar buf[256];
gchar *msgname;
gboolean return_val;
@ -3835,6 +3895,15 @@ gdk_event_translate (GdkEvent *event,
return_val = !GDK_DRAWABLE_DESTROYED (window);
break;
case WM_IME_COMPOSITION:
if (!use_IME_COMPOSITION)
break;
GDK_NOTE (EVENTS, g_print ("WM_IME_COMPOSITION: %#x %#x\n",
xevent->hwnd, xevent->lParam));
if (xevent->lParam & GCS_RESULTSTR)
goto wm_char;
break;
case WM_IME_CHAR:
GDK_NOTE (EVENTS,
g_print ("WM_IME_CHAR: %#x bytes: %#.04x\n",
@ -3918,22 +3987,18 @@ gdk_event_translate (GdkEvent *event,
gdk_event_queue_append (event2);
GDK_NOTE (EVENTS, print_event (event2));
}
/* Return the release event. */
event->key.type = GDK_KEY_RELEASE;
event->key.keyval = xevent->wParam;
event->key.time = xevent->time;
build_key_event_state (event);
event->key.string = NULL;
event->key.length = 0;
/* Return the key release event. */
build_keyrelease_event (WINDOW_PRIVATE(window), event, xevent);
}
else if (return_val
&& (WINDOW_PRIVATE(window)->event_mask & GDK_KEY_PRESS_MASK))
{
/* Return just the GDK_KEY_PRESS event. */
/* Return just the key press event. */
build_keypress_event (WINDOW_PRIVATE(window), event, xevent);
}
else
return_val = FALSE;
#if 0 /* Don't reset is_AltGr_key here. Othewise we can't type several
* AltGr-accessed chars while keeping the AltGr pressed down
* all the time.

View File

@ -187,6 +187,11 @@ static gboolean is_AltGr_key = FALSE;
static IActiveIMMApp *paimmapp = NULL;
static IActiveIMMMessagePumpOwner *paimmmpo = NULL;
typedef BOOL (WINAPI *PFN_TrackMouseEvent) (LPTRACKMOUSEEVENT);
static PFN_TrackMouseEvent p_TrackMouseEvent = NULL;
static gboolean use_IME_COMPOSITION = FALSE;
LRESULT CALLBACK
gdk_WindowProc (HWND hWnd,
UINT message,
@ -381,7 +386,7 @@ void
gdk_events_init (void)
{
HRESULT hres;
HMODULE user32;
HMODULE user32, imm32;
HINSTANCE commctrl32;
if (g_pipe_readable_msg == 0)
@ -430,11 +435,21 @@ gdk_events_init (void)
if ((p_TrackMouseEvent = GetProcAddress (user32, "TrackMouseEvent")) == NULL)
{
if ((commctrl32 = LoadLibrary ("commctrl32.dll")) != NULL)
p_TrackMouseEvent = GetProcAddress (commctrl32, "_TrackMouseEvent");
p_TrackMouseEvent = (PFN_TrackMouseEvent)
GetProcAddress (commctrl32, "_TrackMouseEvent");
}
if (p_TrackMouseEvent != NULL)
GDK_NOTE (EVENTS, g_print ("Using TrackMouseEvent to detect leave events\n"));
#endif
if (windows_version < 0x80000000 && (windows_version & 0xFF) == 5)
{
/* On Win2k (Beta 3, at least) WM_IME_CHAR doesn't seem to work
* correctly for non-Unicode applications. Handle
* WM_IME_COMPOSITION with GCS_RESULTSTR instead, fetch the
* Unicode char from the IME with ImmGetCompositionStringW().
*/
use_IME_COMPOSITION = TRUE;
}
}
/*
@ -1174,6 +1189,8 @@ gdk_add_client_message_filter (GdkAtom message_type,
* mapping functions, from the xterm sources.
*/
#if 0 /* Keyval-to-Unicode isn't actually needed */
struct k2u {
unsigned short keysym;
unsigned short ucs;
@ -1997,6 +2014,8 @@ keyval_to_unicode (guint keysym)
return -1;
}
#endif /* 0 */
struct u2k {
unsigned short keysym;
unsigned short ucs;
@ -2841,6 +2860,7 @@ build_keypress_event (GdkWindowPrivate *window_private,
GdkEvent *event,
MSG *xevent)
{
HIMC hIMC;
gint i, bytesleft, bytecount, ucount, ucleft, len;
guchar buf[100], *bp;
wchar_t wbuf[100], *wcp;
@ -2848,39 +2868,50 @@ build_keypress_event (GdkWindowPrivate *window_private,
event->key.type = GDK_KEY_PRESS;
event->key.time = xevent->time;
if (xevent->message == WM_CHAR)
if (xevent->message == WM_IME_COMPOSITION)
{
bytecount = MIN ((xevent->lParam & 0xFFFF), sizeof (buf));
for (i = 0; i < bytecount; i++)
buf[i] = xevent->wParam;
hIMC = ImmGetContext (xevent->hwnd);
bytecount = ImmGetCompositionStringW (hIMC, GCS_RESULTSTR,
wbuf, sizeof (wbuf));
ucount = bytecount / 2;
}
else
{
/* WM_IME_CHAR */
event->key.keyval = GDK_VoidSymbol;
if (xevent->wParam & 0xFF00)
if (xevent->message == WM_CHAR)
{
/* Contrary to the documentation,
* the lead byte is the msb byte.
*/
buf[0] = ((xevent->wParam >> 8) & 0xFF);
buf[1] = (xevent->wParam & 0xFF);
bytecount = 2;
bytecount = MIN ((xevent->lParam & 0xFFFF), sizeof (buf));
for (i = 0; i < bytecount; i++)
buf[i] = xevent->wParam;
}
else
else /* WM_IME_CHAR */
{
buf[0] = (xevent->wParam & 0xFF);
bytecount = 1;
event->key.keyval = GDK_VoidSymbol;
if (xevent->wParam & 0xFF00)
{
/* Contrary to some versions of the documentation,
* the lead byte is the most significant byte.
*/
buf[0] = ((xevent->wParam >> 8) & 0xFF);
buf[1] = (xevent->wParam & 0xFF);
bytecount = 2;
}
else
{
buf[0] = (xevent->wParam & 0xFF);
bytecount = 1;
}
}
}
/* Convert from the window's current code page
* to Unicode. Then convert to UTF-8.
* We don't handle the surrogate stuff. Should we?
*/
ucount = MultiByteToWideChar (window_private->charset_info.ciACP,
0, buf, bytecount, wbuf, 100);
/* Convert from the window's current code page
* to Unicode. Then convert to UTF-8.
* We don't handle the surrogate stuff. Should we?
*/
ucount = MultiByteToWideChar (window_private->charset_info.ciACP,
0, buf, bytecount,
wbuf, sizeof (wbuf) / sizeof (wbuf[0]));
}
if (ucount == 0)
event->key.keyval = GDK_VoidSymbol;
else if (xevent->message == WM_CHAR)
@ -2958,6 +2989,35 @@ build_keypress_event (GdkWindowPrivate *window_private,
*bp = 0;
}
static void
build_keyrelease_event (GdkWindowPrivate *window_private,
GdkEvent *event,
MSG *xevent)
{
guchar buf;
wchar_t wbuf;
event->key.type = GDK_KEY_RELEASE;
event->key.time = xevent->time;
if (xevent->message == WM_CHAR)
if (xevent->wParam < ' ')
event->key.keyval = xevent->wParam + '@';
else
{
buf = xevent->wParam;
MultiByteToWideChar (window_private->charset_info.ciACP,
0, &buf, 1, &wbuf, 1);
event->key.keyval = unicode_to_keyval (wbuf);
}
else
event->key.keyval = GDK_VoidSymbol;
build_key_event_state (event);
event->key.string = NULL;
event->key.length = 0;
}
static void
print_event_state (gint state)
{
@ -3368,7 +3428,7 @@ gdk_event_translate (GdkEvent *event,
HDC bgdc;
HGDIOBJ oldbitmap;
int button;
int i, j;
int i, j, n, k;
gchar buf[256];
gchar *msgname;
gboolean return_val;
@ -3835,6 +3895,15 @@ gdk_event_translate (GdkEvent *event,
return_val = !GDK_DRAWABLE_DESTROYED (window);
break;
case WM_IME_COMPOSITION:
if (!use_IME_COMPOSITION)
break;
GDK_NOTE (EVENTS, g_print ("WM_IME_COMPOSITION: %#x %#x\n",
xevent->hwnd, xevent->lParam));
if (xevent->lParam & GCS_RESULTSTR)
goto wm_char;
break;
case WM_IME_CHAR:
GDK_NOTE (EVENTS,
g_print ("WM_IME_CHAR: %#x bytes: %#.04x\n",
@ -3918,22 +3987,18 @@ gdk_event_translate (GdkEvent *event,
gdk_event_queue_append (event2);
GDK_NOTE (EVENTS, print_event (event2));
}
/* Return the release event. */
event->key.type = GDK_KEY_RELEASE;
event->key.keyval = xevent->wParam;
event->key.time = xevent->time;
build_key_event_state (event);
event->key.string = NULL;
event->key.length = 0;
/* Return the key release event. */
build_keyrelease_event (WINDOW_PRIVATE(window), event, xevent);
}
else if (return_val
&& (WINDOW_PRIVATE(window)->event_mask & GDK_KEY_PRESS_MASK))
{
/* Return just the GDK_KEY_PRESS event. */
/* Return just the key press event. */
build_keypress_event (WINDOW_PRIVATE(window), event, xevent);
}
else
return_val = FALSE;
#if 0 /* Don't reset is_AltGr_key here. Othewise we can't type several
* AltGr-accessed chars while keeping the AltGr pressed down
* all the time.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -90,9 +90,12 @@ gdk_gc_new_with_values (GdkWindow *window,
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;
private->font = values->font;
gdk_font_ref (private->font);
GDK_NOTE (MISC, g_print (" font=%#x", private->font));
}
else
private->font = NULL;
if (values_mask & GDK_GC_FUNCTION)
{
@ -294,28 +297,17 @@ gdk_gc_unref (GdkGC *gc)
else
{
if (private->values_mask & GDK_GC_FONT)
{
#if 0
if (!DeleteObject (private->font))
g_warning ("gdk_gc_unref: DeleteObject #3 failed");
#endif
}
gdk_font_unref (private->font);
if (private->values_mask & GDK_GC_TILE)
{
gdk_pixmap_unref (private->tile);
}
gdk_pixmap_unref (private->tile);
if (private->values_mask & GDK_GC_STIPPLE)
{
gdk_pixmap_unref (private->stipple);
}
gdk_pixmap_unref (private->stipple);
if (private->values_mask & GDK_GC_CLIP_MASK)
{
DeleteObject (private->clip_region);
}
memset (gc, 0, sizeof (GdkGCPrivate));
DeleteObject (private->clip_region);
g_free (gc);
}
}
@ -333,7 +325,7 @@ gdk_gc_get_values (GdkGC *gc,
values->foreground = private->foreground;
values->background = private->background;
values->font = gdk_font_lookup (private->font);
values->font = private->font;
switch (private->rop2)
{
@ -477,6 +469,7 @@ gdk_gc_set_font (GdkGC *gc,
{
GdkGCPrivate *gc_private;
GdkFontPrivate *font_private;
gchar *xlfd;
g_return_if_fail (gc != NULL);
g_return_if_fail (font != NULL);
@ -485,12 +478,16 @@ gdk_gc_set_font (GdkGC *gc,
|| font->type == GDK_FONT_FONTSET)
{
gc_private = (GdkGCPrivate*) gc;
font_private = (GdkFontPrivate*) font;
GDK_NOTE (MISC, g_print ("gdk_gc_set_font: (%d) %#x\n",
gc_private, font_private->xfont));
GDK_NOTE (MISC, (xlfd = gdk_font_xlfd_create (font),
g_print ("gdk_gc_set_font: (%d) %s\n",
gc_private, xlfd),
gdk_font_xlfd_free (xlfd)));
gc_private->font = font_private->xfont;
if (gc_private->font != NULL)
gdk_font_unref (gc_private->font);
gc_private->font = font;
gdk_font_ref (gc_private->font);
gc_private->values_mask |= GDK_GC_FONT;
}
}
@ -1067,10 +1064,6 @@ gdk_gc_predraw (GdkDrawablePrivate *drawable_private,
if (SetTextAlign (gc_private->xgc, TA_BASELINE) == GDI_ERROR)
g_warning ("gdk_gc_predraw: SetTextAlign failed");
if (gc_private->values_mask & GDK_GC_FONT)
if (SelectObject (gc_private->xgc, gc_private->font) == NULL)
g_warning ("gdk_gc_predraw: SelectObject #4 failed");
if (gc_private->values_mask & GDK_GC_FUNCTION)
if (SetROP2 (gc_private->xgc, gc_private->rop2) == 0)
g_warning ("gdk_gc_predraw: SetROP2 failed");

View File

@ -90,9 +90,12 @@ gdk_gc_new_with_values (GdkWindow *window,
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;
private->font = values->font;
gdk_font_ref (private->font);
GDK_NOTE (MISC, g_print (" font=%#x", private->font));
}
else
private->font = NULL;
if (values_mask & GDK_GC_FUNCTION)
{
@ -294,28 +297,17 @@ gdk_gc_unref (GdkGC *gc)
else
{
if (private->values_mask & GDK_GC_FONT)
{
#if 0
if (!DeleteObject (private->font))
g_warning ("gdk_gc_unref: DeleteObject #3 failed");
#endif
}
gdk_font_unref (private->font);
if (private->values_mask & GDK_GC_TILE)
{
gdk_pixmap_unref (private->tile);
}
gdk_pixmap_unref (private->tile);
if (private->values_mask & GDK_GC_STIPPLE)
{
gdk_pixmap_unref (private->stipple);
}
gdk_pixmap_unref (private->stipple);
if (private->values_mask & GDK_GC_CLIP_MASK)
{
DeleteObject (private->clip_region);
}
memset (gc, 0, sizeof (GdkGCPrivate));
DeleteObject (private->clip_region);
g_free (gc);
}
}
@ -333,7 +325,7 @@ gdk_gc_get_values (GdkGC *gc,
values->foreground = private->foreground;
values->background = private->background;
values->font = gdk_font_lookup (private->font);
values->font = private->font;
switch (private->rop2)
{
@ -477,6 +469,7 @@ gdk_gc_set_font (GdkGC *gc,
{
GdkGCPrivate *gc_private;
GdkFontPrivate *font_private;
gchar *xlfd;
g_return_if_fail (gc != NULL);
g_return_if_fail (font != NULL);
@ -485,12 +478,16 @@ gdk_gc_set_font (GdkGC *gc,
|| font->type == GDK_FONT_FONTSET)
{
gc_private = (GdkGCPrivate*) gc;
font_private = (GdkFontPrivate*) font;
GDK_NOTE (MISC, g_print ("gdk_gc_set_font: (%d) %#x\n",
gc_private, font_private->xfont));
GDK_NOTE (MISC, (xlfd = gdk_font_xlfd_create (font),
g_print ("gdk_gc_set_font: (%d) %s\n",
gc_private, xlfd),
gdk_font_xlfd_free (xlfd)));
gc_private->font = font_private->xfont;
if (gc_private->font != NULL)
gdk_font_unref (gc_private->font);
gc_private->font = font;
gdk_font_ref (gc_private->font);
gc_private->values_mask |= GDK_GC_FONT;
}
}
@ -1067,10 +1064,6 @@ gdk_gc_predraw (GdkDrawablePrivate *drawable_private,
if (SetTextAlign (gc_private->xgc, TA_BASELINE) == GDI_ERROR)
g_warning ("gdk_gc_predraw: SetTextAlign failed");
if (gc_private->values_mask & GDK_GC_FONT)
if (SelectObject (gc_private->xgc, gc_private->font) == NULL)
g_warning ("gdk_gc_predraw: SelectObject #4 failed");
if (gc_private->values_mask & GDK_GC_FUNCTION)
if (SetROP2 (gc_private->xgc, gc_private->rop2) == 0)
g_warning ("gdk_gc_predraw: SetROP2 failed");

View File

@ -46,6 +46,6 @@ gint gdk_error_code;
gint gdk_error_warnings = TRUE;
gint gdk_null_window_warnings = TRUE;
GMutex *gdk_threads_mutex = NULL; /* Global GDK lock */
GMutex *gdk_threads_mutex = NULL;
PFN_TrackMouseEvent p_TrackMouseEvent = NULL;
DWORD windows_version = 0;

View File

@ -46,6 +46,6 @@ gint gdk_error_code;
gint gdk_error_warnings = TRUE;
gint gdk_null_window_warnings = TRUE;
GMutex *gdk_threads_mutex = NULL; /* Global GDK lock */
GMutex *gdk_threads_mutex = NULL;
PFN_TrackMouseEvent p_TrackMouseEvent = NULL;
DWORD windows_version = 0;

View File

@ -337,13 +337,15 @@ gdk_nmbstowchar_ts (wchar_t *dest,
gint src_len,
gint dest_max)
{
wchar_t *wcp;
guchar *cp, *end;
gint n;
wcp = dest;
cp = (guchar *) src;
end = cp + src_len;
n = 0;
while (cp != end && dest != dest + dest_max)
while (cp != end && wcp != dest + dest_max)
{
gint i, mask = 0, len;
guchar c = *cp;
@ -369,19 +371,19 @@ gdk_nmbstowchar_ts (wchar_t *dest,
if (cp + len > end)
return -1;
*dest = (cp[0] & mask);
*wcp = (cp[0] & mask);
for (i = 1; i < len; i++)
{
if ((cp[i] & 0xc0) != 0x80)
return -1;
*dest <<= 6;
*dest |= (cp[i] & 0x3f);
*wcp <<= 6;
*wcp |= (cp[i] & 0x3f);
}
if (*dest == 0xFFFF)
if (*wcp == 0xFFFF)
return -1;
cp += len;
dest++;
wcp++;
n++;
}
if (cp != end)

View File

@ -337,13 +337,15 @@ gdk_nmbstowchar_ts (wchar_t *dest,
gint src_len,
gint dest_max)
{
wchar_t *wcp;
guchar *cp, *end;
gint n;
wcp = dest;
cp = (guchar *) src;
end = cp + src_len;
n = 0;
while (cp != end && dest != dest + dest_max)
while (cp != end && wcp != dest + dest_max)
{
gint i, mask = 0, len;
guchar c = *cp;
@ -369,19 +371,19 @@ gdk_nmbstowchar_ts (wchar_t *dest,
if (cp + len > end)
return -1;
*dest = (cp[0] & mask);
*wcp = (cp[0] & mask);
for (i = 1; i < len; i++)
{
if ((cp[i] & 0xc0) != 0x80)
return -1;
*dest <<= 6;
*dest |= (cp[i] & 0x3f);
*wcp <<= 6;
*wcp |= (cp[i] & 0x3f);
}
if (*dest == 0xFFFF)
if (*wcp == 0xFFFF)
return -1;
cp += len;
dest++;
wcp++;
n++;
}
if (cp != end)

View File

@ -235,6 +235,7 @@ gdk_init_check (int *argc,
gdk_ProgInstance = GetModuleHandle (NULL);
gdk_DC = CreateDC ("DISPLAY", NULL, NULL, NULL);
gdk_root_window = GetDesktopWindow ();
windows_version = GetVersion ();
CoInitialize (NULL);

View File

@ -78,10 +78,6 @@
#define gdk_window_lookup(xid) ((GdkWindow*) gdk_xid_table_lookup (xid))
#define gdk_pixmap_lookup(xid) ((GdkPixmap*) gdk_xid_table_lookup (xid))
/* HFONTs clash with HWNDs, so add dithering to HFONTs... (hack) */
#define HFONT_DITHER 43
#define gdk_font_lookup(xid) ((GdkFont*) gdk_xid_table_lookup ((HANDLE) ((guint) xid + HFONT_DITHER)))
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@ -249,7 +245,7 @@ struct _GdkGCPrivate
GdkGCValuesMask values_mask;
GdkColor foreground;
GdkColor background;
HFONT font;
GdkFont *font;
gint rop2;
GdkFill fill_style;
GdkPixmap *tile;
@ -299,20 +295,22 @@ struct _GdkVisualPrivate
Visual *xvisual;
};
struct _GdkFontPrivate
typedef struct
{
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;
GSList *names;
DWORD charset;
UINT codepage;
CPINFO cpinfo;
FONTSIGNATURE fs;
} GdkWin32SingleFont;
struct _GdkFontPrivate
{
GdkFont font;
guint ref_count;
GSList *fonts;
GSList *names;
};
struct _GdkCursorPrivate
@ -381,17 +379,26 @@ void gdk_sel_prop_store (GdkWindow *owner,
guchar *data,
gint length);
void gdk_event_queue_append (GdkEvent *event);
void gdk_event_queue_append (GdkEvent *event);
gint gdk_nmbstowcs (GdkWChar *dest,
gint gdk_nmbstowcs (GdkWChar *dest,
const gchar *src,
gint src_len,
gint dest_max);
gint gdk_nmbstowchar_ts (wchar_t *dest,
gint gdk_nmbstowchar_ts (wchar_t *dest,
const gchar *src,
gint src_len,
gint dest_max);
void gdk_wchar_text_handle (GdkFont *font,
const wchar_t *wcstr,
int wclen,
void (*handler)(GdkWin32SingleFont *,
const wchar_t *,
int,
void *),
void *arg);
/* 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);
@ -420,11 +427,10 @@ extern GdkAtom gdk_clipboard_atom;
extern GdkAtom gdk_win32_dropfiles_atom;
extern GdkAtom gdk_ole2_dnd_atom;
typedef BOOL (WINAPI *PFN_TrackMouseEvent) (LPTRACKMOUSEEVENT);
extern PFN_TrackMouseEvent p_TrackMouseEvent;
extern LRESULT CALLBACK gdk_WindowProc (HWND, UINT, WPARAM, LPARAM);
extern DWORD windows_version;
/* Debugging support */
#ifdef G_ENABLE_DEBUG

View File

@ -78,10 +78,6 @@
#define gdk_window_lookup(xid) ((GdkWindow*) gdk_xid_table_lookup (xid))
#define gdk_pixmap_lookup(xid) ((GdkPixmap*) gdk_xid_table_lookup (xid))
/* HFONTs clash with HWNDs, so add dithering to HFONTs... (hack) */
#define HFONT_DITHER 43
#define gdk_font_lookup(xid) ((GdkFont*) gdk_xid_table_lookup ((HANDLE) ((guint) xid + HFONT_DITHER)))
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@ -249,7 +245,7 @@ struct _GdkGCPrivate
GdkGCValuesMask values_mask;
GdkColor foreground;
GdkColor background;
HFONT font;
GdkFont *font;
gint rop2;
GdkFill fill_style;
GdkPixmap *tile;
@ -299,20 +295,22 @@ struct _GdkVisualPrivate
Visual *xvisual;
};
struct _GdkFontPrivate
typedef struct
{
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;
GSList *names;
DWORD charset;
UINT codepage;
CPINFO cpinfo;
FONTSIGNATURE fs;
} GdkWin32SingleFont;
struct _GdkFontPrivate
{
GdkFont font;
guint ref_count;
GSList *fonts;
GSList *names;
};
struct _GdkCursorPrivate
@ -381,17 +379,26 @@ void gdk_sel_prop_store (GdkWindow *owner,
guchar *data,
gint length);
void gdk_event_queue_append (GdkEvent *event);
void gdk_event_queue_append (GdkEvent *event);
gint gdk_nmbstowcs (GdkWChar *dest,
gint gdk_nmbstowcs (GdkWChar *dest,
const gchar *src,
gint src_len,
gint dest_max);
gint gdk_nmbstowchar_ts (wchar_t *dest,
gint gdk_nmbstowchar_ts (wchar_t *dest,
const gchar *src,
gint src_len,
gint dest_max);
void gdk_wchar_text_handle (GdkFont *font,
const wchar_t *wcstr,
int wclen,
void (*handler)(GdkWin32SingleFont *,
const wchar_t *,
int,
void *),
void *arg);
/* 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);
@ -420,11 +427,10 @@ extern GdkAtom gdk_clipboard_atom;
extern GdkAtom gdk_win32_dropfiles_atom;
extern GdkAtom gdk_ole2_dnd_atom;
typedef BOOL (WINAPI *PFN_TrackMouseEvent) (LPTRACKMOUSEEVENT);
extern PFN_TrackMouseEvent p_TrackMouseEvent;
extern LRESULT CALLBACK gdk_WindowProc (HWND, UINT, WPARAM, LPARAM);
extern DWORD windows_version;
/* Debugging support */
#ifdef G_ENABLE_DEBUG

View File

@ -48,7 +48,6 @@
#define GDK_COLORMAP_XCOLORMAP(cmap) (((GdkColormapPrivate*) cmap)->xcolormap)
#define GDK_VISUAL_XVISUAL(vis) (((GdkVisualPrivate*) vis)->xvisual)
#define GDK_FONT_XDISPLAY(font) NULL
#define GDK_FONT_XFONT(font) (((GdkFontPrivate*) font)->xfont)
GdkVisual* gdkx_visual_get (VisualID xvisualid);
/* XXX: Do not use this function until it is fixed. An X Colormap

View File

@ -48,7 +48,6 @@
#define GDK_COLORMAP_XCOLORMAP(cmap) (((GdkColormapPrivate*) cmap)->xcolormap)
#define GDK_VISUAL_XVISUAL(vis) (((GdkVisualPrivate*) vis)->xvisual)
#define GDK_FONT_XDISPLAY(font) NULL
#define GDK_FONT_XFONT(font) (((GdkFontPrivate*) font)->xfont)
GdkVisual* gdkx_visual_get (VisualID xvisualid);
/* XXX: Do not use this function until it is fixed. An X Colormap

View File

@ -18,8 +18,8 @@ LOCALEDIR = /WINDOWS/$(PACKAGE)/locale
endif
# uk (Ukrainian) is skipped, as native2ascii doesn't know the KOI8_U
# encoding, sigh
LANGUAGES= $(basename $(basename .Big5,$(wildcard $(addsuffix .po,ca cs da de el es et eu fi fr ga gl hr hu it ja ko nl no pl pt pt_BR ru sk sl sv wa zh_TW.Big5))))
# encoding, sigh. Or is it suffuciently similar to KOI8_R?
LANGUAGES= $(basename $(basename $(wildcard $(addsuffix .po,ca cs da de el es et eu fi fr ga gl hr hu it ja ko nl no pl pt pt_BR ru sk sl sv wa zh_TW.Big5))))
################################################################