summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdk/win32/gdkcursor-win32.c21
-rw-r--r--gdk/win32/gdkdnd-win32.c73
-rw-r--r--gdk/win32/gdkdrawable-win32.c68
-rw-r--r--gdk/win32/gdkgc-win32.c35
-rw-r--r--gdk/win32/gdkglobals-win32.c1
-rw-r--r--gdk/win32/gdkkeys-win32.c88
-rw-r--r--gdk/win32/gdkmain-win32.c32
-rw-r--r--gdk/win32/gdkprivate-win32.h113
-rw-r--r--gdk/win32/gdkproperty-win32.c221
-rw-r--r--gdk/win32/gdkselection-win32.c2
10 files changed, 68 insertions, 586 deletions
diff --git a/gdk/win32/gdkcursor-win32.c b/gdk/win32/gdkcursor-win32.c
index 35a23a910e..f1d3099972 100644
--- a/gdk/win32/gdkcursor-win32.c
+++ b/gdk/win32/gdkcursor-win32.c
@@ -872,21 +872,16 @@ _gdk_win32_pixbuf_to_hicon_supports_alpha (void)
if (!is_win_xp_checked)
{
+ OSVERSIONINFO version;
+
is_win_xp_checked = TRUE;
- if (!G_WIN32_IS_NT_BASED ())
- is_win_xp = FALSE;
- else
- {
- OSVERSIONINFO version;
-
- memset (&version, 0, sizeof (version));
- version.dwOSVersionInfoSize = sizeof (version);
- is_win_xp = GetVersionEx (&version)
- && version.dwPlatformId == VER_PLATFORM_WIN32_NT
- && (version.dwMajorVersion > 5
- || (version.dwMajorVersion == 5 && version.dwMinorVersion >= 1));
- }
+ memset (&version, 0, sizeof (version));
+ version.dwOSVersionInfoSize = sizeof (version);
+ is_win_xp = GetVersionEx (&version)
+ && version.dwPlatformId == VER_PLATFORM_WIN32_NT
+ && (version.dwMajorVersion > 5
+ || (version.dwMajorVersion == 5 && version.dwMinorVersion >= 1));
}
return is_win_xp;
}
diff --git a/gdk/win32/gdkdnd-win32.c b/gdk/win32/gdkdnd-win32.c
index 346a894538..b8d940a046 100644
--- a/gdk/win32/gdkdnd-win32.c
+++ b/gdk/win32/gdkdnd-win32.c
@@ -857,7 +857,6 @@ resolve_link (HWND hWnd,
guchar **lpszPath)
{
HRESULT hres;
- IShellLinkA *pslA = NULL;
IShellLinkW *pslW = NULL;
IPersistFile *ppf = NULL;
@@ -869,18 +868,11 @@ resolve_link (HWND hWnd,
* assumed that CoInitialize has been called.
*/
- if (G_WIN32_HAVE_WIDECHAR_API ())
- hres = CoCreateInstance (&CLSID_ShellLink,
- NULL,
- CLSCTX_INPROC_SERVER,
- &IID_IShellLinkW,
- (LPVOID *)&pslW);
- else
- hres = CoCreateInstance (&CLSID_ShellLink,
- NULL,
- CLSCTX_INPROC_SERVER,
- &IID_IShellLinkA,
- (LPVOID *)&pslA);
+ hres = CoCreateInstance (&CLSID_ShellLink,
+ NULL,
+ CLSCTX_INPROC_SERVER,
+ &IID_IShellLinkW,
+ (LPVOID *)&pslW);
if (SUCCEEDED (hres))
{
@@ -888,14 +880,9 @@ resolve_link (HWND hWnd,
/* The IShellLink interface supports the IPersistFile
* interface. Get an interface pointer to it.
*/
- if (G_WIN32_HAVE_WIDECHAR_API ())
- hres = pslW->lpVtbl->QueryInterface (pslW,
- &IID_IPersistFile,
- (LPVOID *) &ppf);
- else
- hres = pslA->lpVtbl->QueryInterface (pslA,
- &IID_IPersistFile,
- (LPVOID *) &ppf);
+ hres = pslW->lpVtbl->QueryInterface (pslW,
+ &IID_IPersistFile,
+ (LPVOID *) &ppf);
}
if (SUCCEEDED (hres))
@@ -913,38 +900,23 @@ resolve_link (HWND hWnd,
/* Resolve the link by calling the Resolve()
* interface function.
*/
- if (G_WIN32_HAVE_WIDECHAR_API ())
- hres = pslW->lpVtbl->Resolve (pslW, hWnd, SLR_ANY_MATCH | SLR_NO_UI);
- else
- hres = pslA->lpVtbl->Resolve (pslA, hWnd, SLR_ANY_MATCH | SLR_NO_UI);
+ hres = pslW->lpVtbl->Resolve (pslW, hWnd, SLR_ANY_MATCH | SLR_NO_UI);
}
if (SUCCEEDED (hres))
{
- if (G_WIN32_HAVE_WIDECHAR_API ())
- {
- wchar_t wtarget[MAX_PATH];
-
- hres = pslW->lpVtbl->GetPath (pslW, wtarget, MAX_PATH, NULL, 0);
- if (SUCCEEDED (hres))
- *lpszPath = g_utf16_to_utf8 (wtarget, -1, NULL, NULL, NULL);
- }
- else
- {
- guchar cptarget[MAX_PATH];
+ wchar_t wtarget[MAX_PATH];
- hres = pslA->lpVtbl->GetPath (pslA, cptarget, MAX_PATH, NULL, 0);
- if (SUCCEEDED (hres))
- *lpszPath = g_locale_to_utf8 (cptarget, -1, NULL, NULL, NULL);
- }
+ hres = pslW->lpVtbl->GetPath (pslW, wtarget, MAX_PATH, NULL, 0);
+ if (SUCCEEDED (hres))
+ *lpszPath = g_utf16_to_utf8 (wtarget, -1, NULL, NULL, NULL);
}
if (ppf)
ppf->lpVtbl->Release (ppf);
+
if (pslW)
pslW->lpVtbl->Release (pslW);
- if (pslA)
- pslA->lpVtbl->Release (pslA);
return SUCCEEDED (hres);
}
@@ -999,21 +971,10 @@ gdk_dropfiles_filter (GdkXEvent *xev,
for (i = 0; i < nfiles; i++)
{
gchar *uri;
+ wchar_t wfn[MAX_PATH];
- if (G_WIN32_HAVE_WIDECHAR_API ())
- {
- wchar_t wfn[MAX_PATH];
-
- DragQueryFileW (hdrop, i, wfn, MAX_PATH);
- fileName = g_utf16_to_utf8 (wfn, -1, NULL, NULL, NULL);
- }
- else
- {
- char cpfn[MAX_PATH];
-
- DragQueryFileA (hdrop, i, cpfn, MAX_PATH);
- fileName = g_locale_to_utf8 (cpfn, -1, NULL, NULL, NULL);
- }
+ DragQueryFileW (hdrop, i, wfn, MAX_PATH);
+ fileName = g_utf16_to_utf8 (wfn, -1, NULL, NULL, NULL);
/* Resolve shortcuts */
if (resolve_link (msg->hwnd, fileName, &linkedFile))
diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c
index 9171ca35c2..acd6b2ceb7 100644
--- a/gdk/win32/gdkdrawable-win32.c
+++ b/gdk/win32/gdkdrawable-win32.c
@@ -47,9 +47,7 @@
#define MUST_RENDER_DASHES_MANUALLY(gcwin32) \
(gcwin32->line_style == GDK_LINE_DOUBLE_DASH || \
- (gcwin32->line_style == GDK_LINE_ON_OFF_DASH && \
- (gcwin32->pen_dash_offset || \
- (!G_WIN32_IS_NT_BASED () && (gcwin32->pen_style & PS_STYLE_MASK) == PS_SOLID))))
+ (gcwin32->line_style == GDK_LINE_ON_OFF_DASH && gcwin32->pen_dash_offset))
static void gdk_win32_draw_rectangle (GdkDrawable *drawable,
GdkGC *gc,
@@ -717,64 +715,12 @@ generic_draw (GdkDrawable *drawable,
* the areas where mask is one. (It is filled with said pattern.)
*/
- if (G_WIN32_IS_NT_BASED ())
- {
- GDI_CALL (MaskBlt, (hdc, region->extents.x1, region->extents.y1,
- width, height,
- tile_hdc, 0, 0,
- GDK_PIXMAP_HBITMAP (mask_pixmap), 0, 0,
- MAKEROP4 (rop2_to_rop3 (gcwin32->rop2), ROP3_D)));
- }
- else
- {
- GdkPixmap *temp1_pixmap =
- gdk_pixmap_new (drawable, width, height, -1);
- GdkPixmap *temp2_pixmap =
- gdk_pixmap_new (drawable, width, height, -1);
- HDC temp1_hdc = CreateCompatibleDC (hdc);
- HDC temp2_hdc = CreateCompatibleDC (hdc);
- HGDIOBJ old_temp1_hbm =
- SelectObject (temp1_hdc, GDK_PIXMAP_HBITMAP (temp1_pixmap));
- HGDIOBJ old_temp2_hbm =
- SelectObject (temp2_hdc, GDK_PIXMAP_HBITMAP (temp2_pixmap));
-
- /* Grab copy of dest region to temp1 */
- GDI_CALL (BitBlt,(temp1_hdc, 0, 0, width, height,
- hdc, region->extents.x1, region->extents.y1, SRCCOPY));
-
- /* Paint tile to temp1 using correct function */
- GDI_CALL (BitBlt, (temp1_hdc, 0, 0, width, height,
- tile_hdc, 0, 0, rop2_to_rop3 (gcwin32->rop2)));
-
- /* Mask out temp1 where function didn't paint */
- GDI_CALL (BitBlt, (temp1_hdc, 0, 0, width, height,
- mask_hdc, 0, 0, SRCAND));
-
- /* Grab another copy of dest region to temp2 */
- GDI_CALL (BitBlt, (temp2_hdc, 0, 0, width, height,
- hdc, region->extents.x1, region->extents.y1, SRCCOPY));
-
- /* Mask out temp2 where function did paint */
- GDI_CALL (BitBlt, (temp2_hdc, 0, 0, width, height,
- mask_hdc, 0, 0, ROP3_DSna));
-
- /* Combine temp1 with temp2 */
- GDI_CALL (BitBlt, (temp2_hdc, 0, 0, width, height,
- temp1_hdc, 0, 0, SRCPAINT));
-
- /* Blit back */
- GDI_CALL (BitBlt, (hdc, region->extents.x1, region->extents.y1, width, height,
- temp2_hdc, 0, 0, SRCCOPY));
-
- /* Cleanup */
- GDI_CALL (SelectObject, (temp1_hdc, old_temp1_hbm));
- GDI_CALL (SelectObject, (temp2_hdc, old_temp2_hbm));
- GDI_CALL (DeleteDC, (temp1_hdc));
- GDI_CALL (DeleteDC, (temp2_hdc));
- g_object_unref (temp1_pixmap);
- g_object_unref (temp2_pixmap);
- }
-
+ GDI_CALL (MaskBlt, (hdc, region->extents.x1, region->extents.y1,
+ width, height,
+ tile_hdc, 0, 0,
+ GDK_PIXMAP_HBITMAP (mask_pixmap), 0, 0,
+ MAKEROP4 (rop2_to_rop3 (gcwin32->rop2), ROP3_D)));
+
/* Cleanup */
GDI_CALL (SelectObject, (mask_hdc, old_mask_hbm));
GDI_CALL (SelectObject, (tile_hdc, old_tile_hbm));
diff --git a/gdk/win32/gdkgc-win32.c b/gdk/win32/gdkgc-win32.c
index 51c927ffaa..f14d02b041 100644
--- a/gdk/win32/gdkgc-win32.c
+++ b/gdk/win32/gdkgc-win32.c
@@ -172,35 +172,14 @@ fixup_pen (GdkGCWin32 *win32_gc)
win32_gc->pen_dashes[0] = 4;
win32_gc->pen_num_dashes = 1;
}
- if (G_WIN32_IS_NT_BASED ())
- {
- if (!(win32_gc->pen_style & PS_TYPE_MASK) == PS_GEOMETRIC &&
- win32_gc->pen_dashes[0] == 1 &&
- (win32_gc->pen_num_dashes == 1 ||
- (win32_gc->pen_num_dashes == 2 && win32_gc->pen_dashes[0] == 1)))
- win32_gc->pen_style |= PS_ALTERNATE;
- else
- win32_gc->pen_style |= PS_USERSTYLE;
- }
+
+ if (!(win32_gc->pen_style & PS_TYPE_MASK) == PS_GEOMETRIC &&
+ win32_gc->pen_dashes[0] == 1 &&
+ (win32_gc->pen_num_dashes == 1 ||
+ (win32_gc->pen_num_dashes == 2 && win32_gc->pen_dashes[0] == 1)))
+ win32_gc->pen_style |= PS_ALTERNATE;
else
- {
- /* Render "short" on-off dashes drawn with R2_COPYPEN and a
- * cosmetic pen using PS_DOT
- */
- if (win32_gc->line_style == GDK_LINE_ON_OFF_DASH &&
- win32_gc->rop2 == R2_COPYPEN &&
- (win32_gc->pen_style & PS_TYPE_MASK) == PS_COSMETIC &&
- win32_gc->pen_dashes[0] <= 2 &&
- (win32_gc->pen_num_dashes == 1 ||
- (win32_gc->pen_num_dashes == 2 && win32_gc->pen_dashes[1] <= 2)))
- win32_gc->pen_style |= PS_DOT;
- else
- /* Otherwise render opaque lines solid, horizontal or
- * vertical ones will be dashed manually, see
- * gdkdrawable-win32.c.
- */
- win32_gc->pen_style |= PS_SOLID;
- }
+ win32_gc->pen_style |= PS_USERSTYLE;
break;
}
diff --git a/gdk/win32/gdkglobals-win32.c b/gdk/win32/gdkglobals-win32.c
index dce7cba73f..621ff6f2ea 100644
--- a/gdk/win32/gdkglobals-win32.c
+++ b/gdk/win32/gdkglobals-win32.c
@@ -46,7 +46,6 @@ HKL _gdk_input_locale;
gboolean _gdk_input_locale_is_ime;
UINT _gdk_input_codepage;
-WORD _cf_rtf;
WORD _cf_utf8_string;
WORD _cf_image_bmp;
diff --git a/gdk/win32/gdkkeys-win32.c b/gdk/win32/gdkkeys-win32.c
index 2b2fb6693e..6bb11054fc 100644
--- a/gdk/win32/gdkkeys-win32.c
+++ b/gdk/win32/gdkkeys-win32.c
@@ -48,9 +48,6 @@ static GdkKeymap *default_keymap = NULL;
static guint *keysym_tab = NULL;
-typedef int (WINAPI *t_ToUnicodeEx) (UINT,UINT,PBYTE,LPWSTR,int,UINT,HKL);
-static t_ToUnicodeEx p_ToUnicodeEx = NULL;
-
#ifdef G_ENABLE_DEBUG
static void
print_keysym_tab (void)
@@ -266,6 +263,7 @@ static void
reset_after_dead (guchar key_state[256])
{
guchar temp_key_state[256];
+ wchar_t wcs[2];
memmove (temp_key_state, key_state, sizeof (key_state));
@@ -273,20 +271,9 @@ reset_after_dead (guchar key_state[256])
temp_key_state[VK_CONTROL] =
temp_key_state[VK_MENU] = 0;
- if (G_WIN32_HAVE_WIDECHAR_API ())
- {
- wchar_t wcs[2];
- (*p_ToUnicodeEx) (VK_SPACE, MapVirtualKey (VK_SPACE, 0),
- temp_key_state, wcs, G_N_ELEMENTS (wcs),
- 0, _gdk_input_locale);
- }
- else
- {
- char chars[2];
- ToAsciiEx (VK_SPACE, MapVirtualKey (VK_SPACE, 0),
- temp_key_state, (LPWORD) chars, 0,
- _gdk_input_locale);
- }
+ ToUnicodeEx (VK_SPACE, MapVirtualKey (VK_SPACE, 0),
+ temp_key_state, wcs, G_N_ELEMENTS (wcs),
+ 0, _gdk_input_locale);
}
static void
@@ -346,22 +333,10 @@ update_keymap (void)
guint scancode;
guint vk;
gboolean capslock_tested = FALSE;
- static HMODULE user32 = NULL;
if (keysym_tab != NULL && current_serial == _gdk_keymap_serial)
return;
- g_assert (G_WIN32_HAVE_WIDECHAR_API () || _gdk_input_codepage != 0);
-
- if (G_WIN32_HAVE_WIDECHAR_API () && user32 == NULL)
- {
- user32 = GetModuleHandle ("user32.dll");
-
- g_assert (user32 != NULL);
-
- p_ToUnicodeEx = (t_ToUnicodeEx) GetProcAddress (user32, "ToUnicodeEx");
- }
-
current_serial = _gdk_keymap_serial;
if (keysym_tab == NULL)
@@ -409,50 +384,17 @@ update_keymap (void)
wchar_t wcs[10];
gint k;
- if (G_WIN32_HAVE_WIDECHAR_API ())
- {
- k = (*p_ToUnicodeEx) (vk, scancode, key_state,
- wcs, G_N_ELEMENTS (wcs),
- 0, _gdk_input_locale);
-#if 0
- g_print ("ToUnicodeEx(%02x, %d: %d): %d, %04x %04x\n",
- vk, scancode, shift, k,
- (k != 0 ? wcs[0] : 0),
- (k >= 2 ? wcs[1] : 0));
-#endif
- if (k == 1)
- *ksymp = gdk_unicode_to_keyval (wcs[0]);
- }
- else
- {
- k = ToAsciiEx (vk, scancode, key_state,
- (LPWORD) chars, 0, _gdk_input_locale);
+ k = ToUnicodeEx (vk, scancode, key_state,
+ wcs, G_N_ELEMENTS (wcs),
+ 0, _gdk_input_locale);
#if 0
- g_print ("ToAsciiEx(%02x, %d: %d): %d, %02x %02x\n",
- vk, scancode, shift, k,
- (k != 0 ? chars[0] : 0),
- (k == 2 ? chars[1] : 0));
+ g_print ("ToUnicodeEx(%02x, %d: %d): %d, %04x %04x\n",
+ vk, scancode, shift, k,
+ (k != 0 ? wcs[0] : 0),
+ (k >= 2 ? wcs[1] : 0));
#endif
- if (k == 1)
- {
- if (_gdk_input_codepage >= 1250 &&
- _gdk_input_codepage <= 1258 &&
- chars[0] >= GDK_space &&
- chars[0] <= GDK_asciitilde)
- *ksymp = chars[0];
- else
- {
- if (MultiByteToWideChar (_gdk_input_codepage, 0,
- chars, 1, wcs, 1) > 0)
- *ksymp = gdk_unicode_to_keyval (wcs[0]);
- }
- }
- else if (k == -1)
- {
- MultiByteToWideChar (_gdk_input_codepage, 0,
- chars, 1, wcs, 1);
- }
- }
+ if (k == 1)
+ *ksymp = gdk_unicode_to_keyval (wcs[0]);
if (k == 1)
{
@@ -489,10 +431,8 @@ update_keymap (void)
{
#if 0
GDK_NOTE (EVENTS,
- g_print ("%s returns %d "
+ g_print ("ToUnicodeEx returns %d "
"for vk:%02x, sc:%02x%s%s\n",
- (G_WIN32_HAVE_WIDECHAR_API () ?
- "ToUnicodeEx" : "ToAsciiEx"),
k, vk, scancode,
(shift&0x1 ? " shift" : ""),
(shift&0x2 ? " altgr" : "")));
diff --git a/gdk/win32/gdkmain-win32.c b/gdk/win32/gdkmain-win32.c
index 37ca44b563..3bc5920936 100644
--- a/gdk/win32/gdkmain-win32.c
+++ b/gdk/win32/gdkmain-win32.c
@@ -25,6 +25,8 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
+#define WINVER 0x0500
+
#include <config.h>
#include <glib/gprintf.h>
@@ -43,12 +45,6 @@
#include <objbase.h>
-#if defined (__GNUC__) && defined (HAVE_DIMM_H)
-/* The w32api imm.h clashes a bit with the IE5.5 dimm.h */
-# define IMEMENUITEMINFOA hidden_IMEMENUITEMINFOA
-# define IMEMENUITEMINFOW hidden_IMEMENUITEMINFOW
-#endif
-
#include <imm.h>
static gboolean gdk_synchronize = FALSE;
@@ -108,7 +104,6 @@ _gdk_windowing_init (void)
CoInitialize (NULL);
- _cf_rtf = RegisterClipboardFormat ("Rich Text Format");
_cf_utf8_string = RegisterClipboardFormat ("UTF8_STRING");
_cf_image_bmp = RegisterClipboardFormat ("image/bmp");
@@ -148,20 +143,6 @@ _gdk_other_api_failed (const gchar *where,
}
void
-_gdk_win32_gdi_failed (const gchar *where,
- gint line,
- const gchar *api)
-{
- /* On Win9x GDI calls are implemented in 16-bit code and thus
- * don't set the 32-bit error code, sigh.
- */
- if (G_WIN32_IS_NT_BASED ())
- _gdk_win32_api_failed (where, line, api);
- else
- _gdk_other_api_failed (where, line, api);
-}
-
-void
gdk_set_use_xshm (gboolean use_xshm)
{
/* Always on */
@@ -1025,11 +1006,10 @@ _gdk_win32_drawable_description (GdkDrawable *d)
gdk_drawable_get_size (d, &width, &height);
depth = gdk_drawable_get_depth (d);
- return static_printf
- ("%s:%p:%dx%dx%d",
- G_OBJECT_TYPE_NAME (d),
- GDK_DRAWABLE_HANDLE (d),
- width, height, depth);
+ return static_printf ("%s:%p:%dx%dx%d",
+ G_OBJECT_TYPE_NAME (d),
+ GDK_DRAWABLE_HANDLE (d),
+ width, height, depth);
}
#endif /* G_ENABLE_DEBUG */
diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h
index 1ff541c8f0..2b7637234b 100644
--- a/gdk/win32/gdkprivate-win32.h
+++ b/gdk/win32/gdkprivate-win32.h
@@ -35,79 +35,16 @@
#include <config.h>
-/* Make up for some minor w32api header lossage */
+/* Make up for some minor w32api or MSVC6 header lossage */
-/* PS_JOIN_MASK is missing */
#ifndef PS_JOIN_MASK
#define PS_JOIN_MASK (PS_JOIN_BEVEL|PS_JOIN_MITER|PS_JOIN_ROUND)
#endif
-/* CLR_INVALID is missing */
-#ifndef CLR_INVALID
-#define CLR_INVALID CLR_NONE
-#endif
-
-/* Some charsets are missing from MSVC 5 headers */
-#ifndef JOHAB_CHARSET
-#define JOHAB_CHARSET 130
-#endif
-#ifndef VIETNAMESE_CHARSET
-#define VIETNAMESE_CHARSET 163
-#endif
-
#ifndef FS_VIETNAMESE
#define FS_VIETNAMESE 0x100
#endif
-/* Some virtual keycodes are missing */
-#ifndef VK_OEM_PLUS
-#define VK_OEM_PLUS 0xBB
-#endif
-
-#ifndef VK_OEM_COMMA
-#define VK_OEM_COMMA 0xBC
-#endif
-
-#ifndef VK_OEM_MINUS
-#define VK_OEM_MINUS 0xBD
-#endif
-
-#ifndef VK_OEM_PERIOD
-#define VK_OEM_PERIOD 0xBE
-#endif
-
-#ifndef VK_OEM_1
-#define VK_OEM_1 0xBA
-#endif
-#ifndef VK_OEM_2
-#define VK_OEM_2 0xBF
-#endif
-#ifndef VK_OEM_3
-#define VK_OEM_3 0xC0
-#endif
-#ifndef VK_OEM_4
-#define VK_OEM_4 0xDB
-#endif
-#ifndef VK_OEM_5
-#define VK_OEM_5 0xDC
-#endif
-#ifndef VK_OEM_6
-#define VK_OEM_6 0xDD
-#endif
-#ifndef VK_OEM_7
-#define VK_OEM_7 0xDE
-#endif
-#ifndef VK_OEM_8
-#define VK_OEM_8 0xDF
-#endif
-
-/* Missing messages */
-#ifndef WM_SYNCPAINT
-#define WM_SYNCPAINT 0x88
-#endif
-#ifndef WM_MOUSEWHEEL
-#define WM_MOUSEWHEEL 0X20A
-#endif
#ifndef WM_GETOBJECT
#define WM_GETOBJECT 0x3D
#endif
@@ -120,21 +57,6 @@
#ifndef WM_NCXBUTTONDBLCLK
#define WM_NCXBUTTONDBLCLK 0xAD
#endif
-#ifndef WM_MENURBUTTONUP
-#define WM_MENURBUTTONUP 0x122
-#endif
-#ifndef WM_MENUDRAG
-#define WM_MENUDRAG 0x123
-#endif
-#ifndef WM_MENUGETOBJECT
-#define WM_MENUGETOBJECT 0x124
-#endif
-#ifndef WM_UNINITMENUPOPUP
-#define WM_UNINITMENUPOPUP 0x125
-#endif
-#ifndef WM_MENUCOMMAND
-#define WM_MENUCOMMAND 0x126
-#endif
#ifndef WM_CHANGEUISTATE
#define WM_CHANGEUISTATE 0x127
#endif
@@ -153,15 +75,6 @@
#ifndef WM_XBUTTONDBLCLK
#define WM_XBUTTONDBLCLK 0x20D
#endif
-#ifndef WM_IME_REQUEST
-#define WM_IME_REQUEST 0x288
-#endif
-#ifndef WM_MOUSEHOVER
-#define WM_MOUSEHOVER 0x2A1
-#endif
-#ifndef WM_MOUSELEAVE
-#define WM_MOUSELEAVE 0x2A3
-#endif
#ifndef WM_NCMOUSEHOVER
#define WM_NCMOUSEHOVER 0x2A0
#endif
@@ -171,22 +84,6 @@
#ifndef WM_APPCOMMAND
#define WM_APPCOMMAND 0x319
#endif
-#ifndef WM_HANDHELDFIRST
-#define WM_HANDHELDFIRST 0x358
-#endif
-#ifndef WM_HANDHELDLAST
-#define WM_HANDHELDLAST 0x35F
-#endif
-#ifndef WM_AFXFIRST
-#define WM_AFXFIRST 0x360
-#endif
-#ifndef WM_AFXLAST
-#define WM_AFXLAST 0x37F
-#endif
-
-#ifndef CopyCursor
-#define CopyCursor(pcur) ((HCURSOR)CopyIcon((HICON)(pcur)))
-#endif
/* Define some combinations of GdkDebugFlags */
#define GDK_DEBUG_EVENTS_OR_COLORMAP (GDK_DEBUG_EVENTS|GDK_DEBUG_COLORMAP)
@@ -413,17 +310,14 @@ void _gdk_win32_api_failed (const gchar *where,
void _gdk_other_api_failed (const gchar *where,
gint line,
const gchar *api);
-void _gdk_win32_gdi_failed (const gchar *where,
- gint line,
- const gchar *api);
#if defined(__GNUC__) && (__GNUC__ < 3)
#define WIN32_API_FAILED(api) _gdk_win32_api_failed (__FILE__ ":" __PRETTY_FUNCTION__, __LINE__, api)
-#define WIN32_GDI_FAILED(api) _gdk_win32_gdi_failed (__FILE__ ":" __PRETTY_FUNCTION__, __LINE__, api)
+#define WIN32_GDI_FAILED(api) WIN32_API_FAILED (api)
#define OTHER_API_FAILED(api) _gdk_other_api_failed (__FILE__ ":" __PRETTY_FUNCTION__, __LINE__, api)
#else
#define WIN32_API_FAILED(api) _gdk_win32_api_failed (__FILE__, __LINE__, api)
-#define WIN32_GDI_FAILED(api) _gdk_win32_gdi_failed (__FILE__, __LINE__, api)
+#define WIN32_GDI_FAILED(api) WIN32_API_FAILED (api)
#define OTHER_API_FAILED(api) _gdk_other_api_failed (__FILE__, __LINE__, api)
#endif
@@ -469,7 +363,6 @@ extern gboolean _gdk_keyboard_has_altgr;
extern guint _scancode_rshift;
/* Registered clipboard formats */
-extern WORD _cf_rtf;
extern WORD _cf_utf8_string;
extern WORD _cf_image_bmp;
diff --git a/gdk/win32/gdkproperty-win32.c b/gdk/win32/gdkproperty-win32.c
index af9277fe01..37fc2fdf8c 100644
--- a/gdk/win32/gdkproperty-win32.c
+++ b/gdk/win32/gdkproperty-win32.c
@@ -143,106 +143,6 @@ gdk_property_get (GdkWindow *window,
return FALSE;
}
-static gboolean
-find_common_locale (const guchar *data,
- gint nelements,
- gint nchars,
- LCID *lcidp,
- guchar **bufp,
- gint *sizep)
-{
- static struct {
- LCID lcid;
- UINT cp;
- } locales[] = {
-#define ENTRY(lang, sublang) \
- { MAKELCID (MAKELANGID (LANG_##lang, SUBLANG_##sublang), SORT_DEFAULT), 0 }
- ENTRY (ENGLISH, DEFAULT),
- ENTRY (POLISH, DEFAULT),
- ENTRY (CZECH, DEFAULT),
- ENTRY (LITHUANIAN, DEFAULT),
- ENTRY (RUSSIAN, DEFAULT),
- ENTRY (GREEK, DEFAULT),
- ENTRY (TURKISH, DEFAULT),
- ENTRY (HEBREW, DEFAULT),
- ENTRY (ARABIC, DEFAULT),
- ENTRY (THAI, DEFAULT),
- ENTRY (JAPANESE, DEFAULT),
- ENTRY (CHINESE, CHINESE_SIMPLIFIED),
- ENTRY (CHINESE, CHINESE_TRADITIONAL),
- ENTRY (KOREAN, DEFAULT),
-#undef ENTRY
- };
-
- static gboolean been_here = FALSE;
- gint i;
- wchar_t *wcs;
-
- /* For each installed locale: Get the locale's default code page,
- * and store the list of locales and code pages.
- */
- if (!been_here)
- {
- been_here = TRUE;
- for (i = 0; i < G_N_ELEMENTS (locales); i++)
- if (IsValidLocale (locales[i].lcid, LCID_INSTALLED))
- {
- gchar buf[10];
- if (GetLocaleInfo (locales[i].lcid, LOCALE_IDEFAULTANSICODEPAGE,
- buf, sizeof (buf)))
- {
- gchar name[100];
- locales[i].cp = atoi (buf);
- GDK_NOTE (DND, (GetLocaleInfo (locales[i].lcid,
- LOCALE_SENGLANGUAGE,
- name, sizeof (name)),
- g_print ("locale %#lx: %s: CP%d\n",
- (gulong) locales[i].lcid, name,
- locales[i].cp)));
- }
- }
- }
-
- /* Allocate bufp big enough to store data in any code page. Two
- * bytes for each Unicode char should be enough, Windows code pages
- * are either single- or double-byte.
- */
- *bufp = g_malloc ((nchars+1)*2);
-
- /* Convert to Windows wide chars into temp buf */
- wcs = g_utf8_to_utf16 (data, nelements, NULL, NULL, NULL);
-
- /* For each code page that is the default for an installed locale: */
- for (i = 0; i < G_N_ELEMENTS (locales); i++)
- {
- BOOL used_default;
- int nbytes;
-
- if (locales[i].cp == 0)
- continue;
-
- /* Convert to that code page into bufp */
-
- nbytes = WideCharToMultiByte (locales[i].cp, 0, wcs, -1,
- *bufp, (nchars+1)*2,
- NULL, &used_default);
-
- if (!used_default)
- {
- /* This locale is good for the string */
- g_free (wcs);
- *lcidp = locales[i].lcid;
- *sizep = nbytes;
- return TRUE;
- }
- }
-
- g_free (*bufp);
- g_free (wcs);
-
- return FALSE;
-}
-
void
gdk_property_change (GdkWindow *window,
GdkAtom property,
@@ -252,17 +152,14 @@ gdk_property_change (GdkWindow *window,
const guchar *data,
gint nelements)
{
- HGLOBAL hdata, hlcid, hutf8;
+ HGLOBAL hdata;
UINT cf = 0;
- LCID lcid;
- LCID *lcidptr;
- GString *rtf = NULL;
gint i, size, nchars;
gchar *prop_name, *type_name;
guchar *ucptr, *buf = NULL;
wchar_t *wcptr;
glong wclen;
- enum { SYSTEM_CODEPAGE, UNICODE_TEXT, SINGLE_LOCALE, RICH_TEXT } method;
+ enum { SYSTEM_CODEPAGE, UNICODE_TEXT } method;
gboolean ok = TRUE;
g_return_if_fail (window != NULL);
@@ -314,9 +211,7 @@ gdk_property_change (GdkWindow *window,
if (i == nelements)
{
- /* If UTF-8 and only ASCII, use CF_TEXT and the data as
- * such.
- */
+ /* If only ASCII, use CF_TEXT and the data as such */
method = SYSTEM_CODEPAGE;
size = nelements;
for (i = 0; i < nelements; i++)
@@ -325,11 +220,9 @@ gdk_property_change (GdkWindow *window,
size++;
GDK_NOTE (DND, g_print ("... as text: %.40s\n", data));
}
- else if (G_WIN32_IS_NT_BASED ())
+ else
{
- /* On NT, use CF_UNICODETEXT if any non-system codepage
- * char present.
- */
+ /* Use CF_UNICODETEXT */
method = UNICODE_TEXT;
wcptr = g_utf8_to_utf16 (data, nelements, NULL, &wclen, NULL);
@@ -341,66 +234,6 @@ gdk_property_change (GdkWindow *window,
size += 2;
GDK_NOTE (DND, g_print ("... as Unicode\n"));
}
- else if (find_common_locale (data, nelements, nchars, &lcid, &buf, &size))
- {
- /* On Win9x, if all chars are in the default code page
- * of some installed locale, use CF_TEXT and CF_LOCALE.
- */
- method = SINGLE_LOCALE;
- GDK_NOTE (DND, g_print ("... as text in locale %#lx %d bytes\n",
- (gulong) lcid, size));
- }
- else
- {
- /* On Win9x, otherwise use RTF */
-
- const guchar *p = data;
-
- /* WordPad on XP, at least, doesn't seem to grok \uc0
- * -encoded Unicode characters. Oh well, use \uc1 then,
- * with a question mark as the "ANSI" stand-in for each
- * non-ASCII Unicode character. (WordPad for XP? This
- * code path is for Win9x! Yes, but I don't have Win9x,
- * so I use XP to test, using the G_WIN32_PRETEND_WIN9X
- * environment variable.)
- */
- method = RICH_TEXT;
- rtf = g_string_new ("{\\rtf1\\uc1 ");
-
- while (p < data + nelements)
- {
- if (*p == '{' ||
- *p == '\\' ||
- *p == '}')
- {
- rtf = g_string_append_c (rtf, '\\');
- rtf = g_string_append_c (rtf, *p);
- p++;
- }
- else if (*p < 0200 && *p >= ' ')
- {
- rtf = g_string_append_c (rtf, *p);
- p++;
- }
- else
- {
- guchar *q;
- gint n;
-
- rtf = g_string_append (rtf, "\\uNNNNN ?");
- rtf->len -= 7; /* five digits a space and a question mark */
- q = rtf->str + rtf->len;
- n = g_sprintf (q, "%d ?", g_utf8_get_char (p));
- g_assert (n <= 7);
- rtf->len += n;
-
- p = g_utf8_next_char (p);
- }
- }
- rtf = g_string_append (rtf, "}");
- size = rtf->len + 1;
- GDK_NOTE (DND, g_print ("... as RTF: %.40s\n", rtf->str));
- }
if (!(hdata = GlobalAlloc (GMEM_MOVEABLE, size)))
{
@@ -409,8 +242,6 @@ gdk_property_change (GdkWindow *window,
WIN32_API_FAILED ("CloseClipboard");
if (buf != NULL)
g_free (buf);
- if (rtf != NULL)
- g_string_free (rtf, TRUE);
return;
}
@@ -443,48 +274,6 @@ gdk_property_change (GdkWindow *window,
}
break;
- case SINGLE_LOCALE:
- cf = CF_TEXT;
- memmove (ucptr, buf, size);
- g_free (buf);
-
- /* Set the CF_LOCALE clipboard data, too */
- if (!(hlcid = GlobalAlloc (GMEM_MOVEABLE, sizeof (LCID))))
- WIN32_API_FAILED ("GlobalAlloc"), ok = FALSE;
- if (ok)
- {
- lcidptr = GlobalLock (hlcid);
- *lcidptr = lcid;
- GlobalUnlock (hlcid);
- GDK_NOTE (DND, g_print ("... SetClipboardData(CF_LOCALE,%p)\n",
- hlcid));
- if (!SetClipboardData (CF_LOCALE, hlcid))
- WIN32_API_FAILED ("SetClipboardData(CF_LOCALE)"), ok = FALSE;
- }
- break;
-
- case RICH_TEXT:
- cf = _cf_rtf;
- memmove (ucptr, rtf->str, size);
- g_string_free (rtf, TRUE);
-
- /* Set the UTF8_STRING clipboard data, too, for other
- * GTK+ apps to use (won't bother reading RTF).
- */
- if (!(hutf8 = GlobalAlloc (GMEM_MOVEABLE, nelements)))
- WIN32_API_FAILED ("GlobalAlloc");
- else
- {
- guchar *utf8ptr = GlobalLock (hutf8);
- memmove (utf8ptr, data, nelements);
- GlobalUnlock (hutf8);
- GDK_NOTE (DND, g_print ("... SetClipboardData('UTF8_STRING',%p)\n",
- hutf8));
- if (!SetClipboardData (_cf_utf8_string, hutf8))
- WIN32_API_FAILED ("SetClipboardData('UTF8_STRING')");
- }
- break;
-
default:
g_assert_not_reached ();
}
diff --git a/gdk/win32/gdkselection-win32.c b/gdk/win32/gdkselection-win32.c
index ac359b7b11..63e2c24c3f 100644
--- a/gdk/win32/gdkselection-win32.c
+++ b/gdk/win32/gdkselection-win32.c
@@ -433,7 +433,7 @@ gdk_selection_convert (GdkWindow *requestor,
return;
/* Try various formats. First the simplest, CF_UNICODETEXT. */
- if (G_WIN32_IS_NT_BASED () && (hdata = GetClipboardData (CF_UNICODETEXT)) != NULL)
+ if ((hdata = GetClipboardData (CF_UNICODETEXT)) != NULL)
{
wchar_t *ptr, *wcs, *p, *q;
guchar *data;