diff options
author | Tor Lillqvist <tml@iki.fi> | 1999-10-02 22:42:58 +0000 |
---|---|---|
committer | Tor Lillqvist <tml@src.gnome.org> | 1999-10-02 22:42:58 +0000 |
commit | c50941c82dbef8fb6122ab4f19bd592cb7fc58ef (patch) | |
tree | b21e7fdac4d03769d10a9bb56013620918202c28 /gdk/win32 | |
parent | b196167dbc91b150b1f39c9cec87fffe913be199 (diff) | |
download | gtk+-c50941c82dbef8fb6122ab4f19bd592cb7fc58ef.tar.gz |
Change GDK_WINDOWING_WIN32 usage to #ifdef also here.
1999-10-03 Tor Lillqvist <tml@iki.fi>
* gdk/gdkimage.h gdk/gdkpixmap.h: Change GDK_WINDOWING_WIN32 usage
to #ifdef also here.
* gdk/win32/*.h gdk/win32/*.c: Make corresponding changes as those
Owen did to the X11 backend.
* gdk/win32/gdkdraw.c (gdk_draw_pixmap): Fix it again, don't use
ScrollWindowEx when blitting inside a window, it can't be correct
in the general case.
* gdk/win32/gdkevents.c: Don't handle WM_SIZING, handling
WM_GETMINMAXINFO is easier.
* gdk/win32/gdkimage.c (gdk_image_new): Create new image with
depth equal to the bitspixel value, not the visual's depth.
* gdk/win32/gdkvisual.c (gdk_visual_init): Set the visual's depth
to 24 even if the bitspixel value is 32.
* gdk/gdkrgb.c (gdk_rgb_select_conv): After the above change, no
need to check for depth==32 when bpp==32, depth will always be 24.
Diffstat (limited to 'gdk/win32')
44 files changed, 467 insertions, 558 deletions
diff --git a/gdk/win32/gdk-win32.def b/gdk/win32/gdk-win32.def index e4b02bb0ba..89b100b8b0 100644 --- a/gdk/win32/gdk-win32.def +++ b/gdk/win32/gdk-win32.def @@ -257,11 +257,6 @@ EXPORTS gdk_threads_enter gdk_threads_leave gdk_threads_mutex - gdk_time_get - gdk_timer_disable - gdk_timer_enable - gdk_timer_get - gdk_timer_set gdk_visual_get_best gdk_visual_get_best_depth gdk_visual_get_best_type diff --git a/gdk/win32/gdk.c b/gdk/win32/gdk.c index 9f751e3b29..83e20930a3 100644 --- a/gdk/win32/gdk.c +++ b/gdk/win32/gdk.c @@ -33,11 +33,10 @@ #include <limits.h> #include <io.h> -#include <gdk/gdk.h> -#include <gdk/gdkkeysyms.h> -#include <gdk/gdki18n.h> -#include "gdkx.h" -#include "gdkinput.h" +#include "gdk.h" +#include "gdkprivate.h" +#include "gdkinputprivate.h" +#include "gdkkeysyms.h" static void gdkx_XConvertCase (KeySym symbol, KeySym *lower, @@ -52,15 +51,6 @@ static void gdk_exit_func (void); static int gdk_initialized = 0; /* 1 if the library is initialized, * 0 otherwise. */ -static guint start; /* We use the millisecond - * timestamps from GetTickCount - */ -static gboolean timerp = TRUE; /* If TRUE use timeouts when waiting - * for Windows messages - */ -static guint32 timer_val = 20; /* Timeout in milliseconds. - */ - #ifdef G_ENABLE_DEBUG static const GDebugKey gdk_debug_keys[] = { {"events", GDK_DEBUG_EVENTS}, @@ -118,8 +108,6 @@ gdk_init_check (int *argc, if (g_thread_supported ()) gdk_threads_mutex = g_mutex_new (); - start = GetTickCount (); - #ifdef G_ENABLE_DEBUG { gchar *debug_string = getenv("GDK_DEBUG"); @@ -327,113 +315,6 @@ gdk_get_use_xshm (void) /* *-------------------------------------------------------------- - * gdk_time_get - * - * Get the number of milliseconds since the library was - * initialized. - * - * Arguments: - * - * Results: - * The time since the library was initialized is returned. - * This time value is accurate to milliseconds even though - * a more accurate time down to the microsecond could be - * returned. - * - * Side effects: - * - *-------------------------------------------------------------- - */ - -guint32 -gdk_time_get (void) -{ - guint32 milliseconds; - guint32 end = GetTickCount (); - - if (end < start) - milliseconds = 0xFFFFFFFF - (start - end) + 1; - else - milliseconds = end - start; - - return milliseconds; -} - -/* - *-------------------------------------------------------------- - * gdk_timer_get - * - * Returns the current timer. - * - * Arguments: - * - * Results: - * Returns the current timer interval. This interval is - * in units of milliseconds. - * - * Side effects: - * - *-------------------------------------------------------------- - */ - -guint32 -gdk_timer_get (void) -{ - return timer_val; -} - -/* - *-------------------------------------------------------------- - * gdk_timer_set - * - * Sets the timer interval. - * - * Arguments: - * "milliseconds" is the new value for the timer. - * - * Results: - * - * Side effects: - * Calls to "gdk_event_get" will last for a maximum - * of time of "milliseconds". However, a value of 0 - * milliseconds will cause "gdk_event_get" to block - * indefinately until an event is received. - * - *-------------------------------------------------------------- - */ - -void -gdk_timer_set (guint32 milliseconds) -{ - timer_val = milliseconds; -#ifdef USE_PEEKNAMEDPIPE - /* When using PeekNamedPipe, can't have too long timeouts. - */ - if (timer_val > 10) - timer_val = 10; - else if (timer_val == 0) - timer_val = 0; -#endif -} - -void -gdk_timer_enable (void) -{ - timerp = TRUE; -} - -void -gdk_timer_disable (void) -{ -#ifdef USE_PEEKNAMEDPIPE - /* Can't disable timeouts when using PeekNamedPipe */ -#else - timerp = FALSE; -#endif -} - -/* - *-------------------------------------------------------------- * gdk_screen_width * * Return the width of the screen. diff --git a/gdk/win32/gdk.def b/gdk/win32/gdk.def index e4b02bb0ba..89b100b8b0 100644 --- a/gdk/win32/gdk.def +++ b/gdk/win32/gdk.def @@ -257,11 +257,6 @@ EXPORTS gdk_threads_enter gdk_threads_leave gdk_threads_mutex - gdk_time_get - gdk_timer_disable - gdk_timer_enable - gdk_timer_get - gdk_timer_set gdk_visual_get_best gdk_visual_get_best_depth gdk_visual_get_best_type diff --git a/gdk/win32/gdkcc.c b/gdk/win32/gdkcc.c index a2daba685c..b9844651d3 100644 --- a/gdk/win32/gdkcc.c +++ b/gdk/win32/gdkcc.c @@ -65,10 +65,19 @@ #include <stdlib.h> #include <string.h> +#include "gdkcc.h" +#include "gdkcolor.h" #include "gdkx.h" #define MAX_IMAGE_COLORS 256 +typedef struct _GdkColorContextPrivate GdkColorContextPrivate; + +struct _GdkColorContextPrivate +{ + GdkColorContext color_context; + XStandardColormap std_cmap; +}; static guint hash_color (gconstpointer key) @@ -102,16 +111,11 @@ pixel_sort (const void *a, const void *b) return ((GdkColor *) a)->pixel - ((GdkColor *) b)->pixel; } -/* XXX: This function does an XQueryColors() the hard way, because there is - * no corresponding function in Gdk. - */ - static void my_x_query_colors (GdkColormap *colormap, GdkColor *colors, gint ncolors) { - XColor *xcolors; gint i; for (i = 0; i < ncolors; i++) @@ -175,6 +179,7 @@ init_gray (GdkColorContext *cc) gdouble dinc; cc->num_colors = 256; /* Bogus, but will never get here anyway? */ + cc->clut = g_new (gulong, cc->num_colors); cstart = g_new (GdkColor, cc->num_colors); @@ -379,8 +384,9 @@ init_palette (GdkColorContext *cc) if (cc->color_hash) { - /* XXX: quick-and-dirty way to remove everything */ - + g_hash_table_foreach (cc->color_hash, + free_hash_entry, + NULL); g_hash_table_destroy (cc->color_hash); cc->color_hash = g_hash_table_new (hash_color, compare_colors); } @@ -456,6 +462,7 @@ gdk_color_context_new (GdkVisual *visual, init_bw (cc); else init_gray (cc); + break; case GDK_VISUAL_TRUE_COLOR: /* shifts */ @@ -497,11 +504,6 @@ gdk_color_context_new (GdkVisual *visual, g_message ("gdk_color_context_new: screen depth is %i, no. of colors is %i\n", cc->visual->depth, cc->num_colors)); - /* check if we need to initialize a hash table */ - - if ((cc->mode == GDK_CC_MODE_STD_CMAP) || (cc->mode == GDK_CC_MODE_UNDEFINED)) - cc->color_hash = g_hash_table_new (hash_color, compare_colors); - return (GdkColorContext *) cc; } @@ -555,17 +557,9 @@ gdk_color_context_free (GdkColorContext *cc) gdk_colormap_unref (cc->colormap); /* free any palette that has been associated with this GdkColorContext */ - + init_palette (cc); - if (cc->color_hash) - { - g_hash_table_foreach (cc->color_hash, - free_hash_entry, - NULL); - g_hash_table_destroy (cc->color_hash); - } - g_free (cc); } @@ -581,7 +575,7 @@ gdk_color_context_get_pixel (GdkColorContext *cc, g_assert (failed != NULL); *failed = FALSE; - + switch (cc->mode) { case GDK_CC_MODE_BW: @@ -658,13 +652,14 @@ gdk_color_context_get_pixel (GdkColorContext *cc, default: { GdkColor color; - GdkColor *result; + GdkColor *result = NULL; color.red = red; color.green = green; color.blue = blue; - - result = g_hash_table_lookup (cc->color_hash, &color); + + if (cc->color_hash) + result = g_hash_table_lookup (cc->color_hash, &color); if (!result) { @@ -709,6 +704,9 @@ gdk_color_context_get_pixel (GdkColorContext *cc, cnew = g_new (GdkColor, 1); *cnew = color; + + if (!cc->color_hash) + cc->color_hash = g_hash_table_new (hash_color, compare_colors); g_hash_table_insert (cc->color_hash, cnew, cnew); cc->clut[cc->num_allocated] = color.pixel; @@ -1367,27 +1365,14 @@ gdk_color_context_add_palette (GdkColorContext *cc, /* restore previous mode if we aren't adding a new palette */ if (num_palette == 0) - { - /* GDK_CC_MODE_STD_CMAP uses a hash table, so we'd better initialize one */ - - /* XXX: here, the hash table is already initialized */ - - return 0; - } - - /* Initialize a hash table for this palette (we need one for allocating - * the pixels in the palette using the current settings) - */ - - if (cc->color_hash == NULL) - cc->color_hash = g_hash_table_new (hash_color, compare_colors); + return 0; /* copy incoming palette */ cc->palette = g_new0(GdkColor, num_palette); j = 0; - + for (i = 0; i < num_palette; i++) { erg = 0; @@ -1427,6 +1412,9 @@ gdk_color_context_add_palette (GdkColorContext *cc, if (cc->color_hash) { + g_hash_table_foreach (cc->color_hash, + free_hash_entry, + NULL); g_hash_table_destroy (cc->color_hash); cc->color_hash = NULL; } diff --git a/gdk/win32/gdkcolor-win32.c b/gdk/win32/gdkcolor-win32.c index 3712222eff..443e1fb9bf 100644 --- a/gdk/win32/gdkcolor-win32.c +++ b/gdk/win32/gdkcolor-win32.c @@ -31,7 +31,8 @@ #include <string.h> #include <time.h> -#include "gdkx.h" +#include "gdkcolor.h" +#include "gdkprivate.h" static gint gdk_colormap_match_color (GdkColormap *cmap, GdkColor *color, @@ -173,7 +174,7 @@ terms specified in this license. static int alloc_color(Colormap colormap, XColor *color, - guint *pixelp) + gulong *pixelp) { PALETTEENTRY entry, closeEntry; HDC hdc; diff --git a/gdk/win32/gdkcolor.c b/gdk/win32/gdkcolor.c index 3712222eff..443e1fb9bf 100644 --- a/gdk/win32/gdkcolor.c +++ b/gdk/win32/gdkcolor.c @@ -31,7 +31,8 @@ #include <string.h> #include <time.h> -#include "gdkx.h" +#include "gdkcolor.h" +#include "gdkprivate.h" static gint gdk_colormap_match_color (GdkColormap *cmap, GdkColor *color, @@ -173,7 +174,7 @@ terms specified in this license. static int alloc_color(Colormap colormap, XColor *color, - guint *pixelp) + gulong *pixelp) { PALETTEENTRY entry, closeEntry; HDC hdc; diff --git a/gdk/win32/gdkcursor-win32.c b/gdk/win32/gdkcursor-win32.c index 84e54f3e8d..9c4534fe9f 100644 --- a/gdk/win32/gdkcursor-win32.c +++ b/gdk/win32/gdkcursor-win32.c @@ -19,7 +19,7 @@ #include "config.h" -#include <gdk/gdk.h> +#include "gdkcursor.h" #include "gdkprivate.h" static const struct { const char *name; int type; } cursors[] = { diff --git a/gdk/win32/gdkcursor.c b/gdk/win32/gdkcursor.c index 84e54f3e8d..9c4534fe9f 100644 --- a/gdk/win32/gdkcursor.c +++ b/gdk/win32/gdkcursor.c @@ -19,7 +19,7 @@ #include "config.h" -#include <gdk/gdk.h> +#include "gdkcursor.h" #include "gdkprivate.h" static const struct { const char *name; int type; } cursors[] = { diff --git a/gdk/win32/gdkdnd-win32.c b/gdk/win32/gdkdnd-win32.c index dd51fff345..4589129173 100644 --- a/gdk/win32/gdkdnd-win32.c +++ b/gdk/win32/gdkdnd-win32.c @@ -31,7 +31,11 @@ #define INITGUID +#include "gdkdnd.h" +#include "gdkproperty.h" +#include "gdkprivate.h" #include "gdkx.h" + #ifdef OLE2_DND #include <ole2.h> #endif @@ -59,6 +63,21 @@ typedef enum { #ifdef OLE2_DND +#define PRINT_RIID(riid) \ + g_print ("riid = %.08x-%.04x-%.04x-%.02x%.02x-%.02x%.02x%.02x%.02x%.02x%.02x", \ + ((gulong *) riid)[0], \ + ((gushort *) riid)[2], \ + ((gushort *) riid)[3], \ + ((guchar *) riid)[8], \ + ((guchar *) riid)[9], \ + ((guchar *) riid)[10], \ + ((guchar *) riid)[11], \ + ((guchar *) riid)[12], \ + ((guchar *) riid)[13], \ + ((guchar *) riid)[14], \ + ((guchar *) riid)[15]); + + HRESULT STDMETHODCALLTYPE m_query_interface_target (IDropTarget __RPC_FAR *This, /* [in] */ REFIID riid, @@ -169,30 +188,20 @@ m_query_interface_target (IDropTarget __RPC_FAR *This, *ppvObject = NULL; - g_print ("riid = %.08x-%.04x-%.04x-%.02x%.02x-%.02x%.02x%.02x%.02x%.02x%.02x", - ((gulong *) riid)[0], - ((gushort *) riid)[2], - ((gushort *) riid)[3], - ((guchar *) riid)[8], - ((guchar *) riid)[9], - ((guchar *) riid)[10], - ((guchar *) riid)[11], - ((guchar *) riid)[12], - ((guchar *) riid)[13], - ((guchar *) riid)[14], - ((guchar *) riid)[15]); + PRINT_RIID (riid); + if (IsEqualGUID (riid, &IID_IUnknown)) { + g_print ("...IUnknown\n"); m_add_ref_target (This); *ppvObject = This; - g_print ("...IUnknown\n"); return S_OK; } else if (IsEqualGUID (riid, &IID_IDropTarget)) { + g_print ("...IDropTarget\n"); m_add_ref_target (This); *ppvObject = This; - g_print ("...IDropTarget\n"); return S_OK; } else @@ -280,35 +289,19 @@ m_query_interface_source (IDropSource __RPC_FAR *This, *ppvObject = NULL; - g_print ("riid = %.02x%.02x%.02x%.02x-%.02x%.02x-%.02x%.02x-%.02x%.02x-%.02x%.02x%.02x%.02x%.02x%.02x", - ((guchar *) riid)[0], - ((guchar *) riid)[1], - ((guchar *) riid)[2], - ((guchar *) riid)[3], - ((guchar *) riid)[4], - ((guchar *) riid)[5], - ((guchar *) riid)[6], - ((guchar *) riid)[7], - ((guchar *) riid)[8], - ((guchar *) riid)[9], - ((guchar *) riid)[10], - ((guchar *) riid)[11], - ((guchar *) riid)[12], - ((guchar *) riid)[13], - ((guchar *) riid)[14], - ((guchar *) riid)[15]); + PRINT_RIID (riid); if (IsEqualGUID (riid, &IID_IUnknown)) { + g_print ("...IUnknown\n"); m_add_ref_source (This); *ppvObject = This; - g_print ("...IUnknown\n"); return S_OK; } else if (IsEqualGUID (riid, &IID_IDropSource)) { + g_print ("...IDropSource\n"); m_add_ref_source (This); *ppvObject = This; - g_print ("...IDropSource\n"); return S_OK; } else @@ -817,6 +810,26 @@ gdk_drop_finish (GdkDragContext *context, { } +static GdkFilterReturn +gdk_destroy_filter (GdkXEvent *xev, + GdkEvent *event, + gpointer data) +{ +#ifdef OLE2_DND + MSG *msg = (MSG *) xev; + + if (msg->message == WM_DESTROY) + { + IDropTarget *idtp = (IDropTarget *) data; + + GDK_NOTE (DND, g_print ("gdk_destroy_filter: WM_DESTROY: %#x\n", msg->hwnd)); + RevokeDragDrop (msg->hwnd); + CoLockObjectExternal (idtp, FALSE, TRUE); + } +#endif + return GDK_FILTER_CONTINUE; +} + void gdk_window_register_dnd (GdkWindow *window) { @@ -854,6 +867,10 @@ gdk_window_register_dnd (GdkWindow *window) } else if (!SUCCEEDED (hres)) g_warning ("gdk_window_register_dnd: RegisterDragDrop failed"); + else + { + gdk_window_add_filter (window, gdk_destroy_filter, &context->idt); + } } #endif } diff --git a/gdk/win32/gdkdnd.c b/gdk/win32/gdkdnd.c index dd51fff345..4589129173 100644 --- a/gdk/win32/gdkdnd.c +++ b/gdk/win32/gdkdnd.c @@ -31,7 +31,11 @@ #define INITGUID +#include "gdkdnd.h" +#include "gdkproperty.h" +#include "gdkprivate.h" #include "gdkx.h" + #ifdef OLE2_DND #include <ole2.h> #endif @@ -59,6 +63,21 @@ typedef enum { #ifdef OLE2_DND +#define PRINT_RIID(riid) \ + g_print ("riid = %.08x-%.04x-%.04x-%.02x%.02x-%.02x%.02x%.02x%.02x%.02x%.02x", \ + ((gulong *) riid)[0], \ + ((gushort *) riid)[2], \ + ((gushort *) riid)[3], \ + ((guchar *) riid)[8], \ + ((guchar *) riid)[9], \ + ((guchar *) riid)[10], \ + ((guchar *) riid)[11], \ + ((guchar *) riid)[12], \ + ((guchar *) riid)[13], \ + ((guchar *) riid)[14], \ + ((guchar *) riid)[15]); + + HRESULT STDMETHODCALLTYPE m_query_interface_target (IDropTarget __RPC_FAR *This, /* [in] */ REFIID riid, @@ -169,30 +188,20 @@ m_query_interface_target (IDropTarget __RPC_FAR *This, *ppvObject = NULL; - g_print ("riid = %.08x-%.04x-%.04x-%.02x%.02x-%.02x%.02x%.02x%.02x%.02x%.02x", - ((gulong *) riid)[0], - ((gushort *) riid)[2], - ((gushort *) riid)[3], - ((guchar *) riid)[8], - ((guchar *) riid)[9], - ((guchar *) riid)[10], - ((guchar *) riid)[11], - ((guchar *) riid)[12], - ((guchar *) riid)[13], - ((guchar *) riid)[14], - ((guchar *) riid)[15]); + PRINT_RIID (riid); + if (IsEqualGUID (riid, &IID_IUnknown)) { + g_print ("...IUnknown\n"); m_add_ref_target (This); *ppvObject = This; - g_print ("...IUnknown\n"); return S_OK; } else if (IsEqualGUID (riid, &IID_IDropTarget)) { + g_print ("...IDropTarget\n"); m_add_ref_target (This); *ppvObject = This; - g_print ("...IDropTarget\n"); return S_OK; } else @@ -280,35 +289,19 @@ m_query_interface_source (IDropSource __RPC_FAR *This, *ppvObject = NULL; - g_print ("riid = %.02x%.02x%.02x%.02x-%.02x%.02x-%.02x%.02x-%.02x%.02x-%.02x%.02x%.02x%.02x%.02x%.02x", - ((guchar *) riid)[0], - ((guchar *) riid)[1], - ((guchar *) riid)[2], - ((guchar *) riid)[3], - ((guchar *) riid)[4], - ((guchar *) riid)[5], - ((guchar *) riid)[6], - ((guchar *) riid)[7], - ((guchar *) riid)[8], - ((guchar *) riid)[9], - ((guchar *) riid)[10], - ((guchar *) riid)[11], - ((guchar *) riid)[12], - ((guchar *) riid)[13], - ((guchar *) riid)[14], - ((guchar *) riid)[15]); + PRINT_RIID (riid); if (IsEqualGUID (riid, &IID_IUnknown)) { + g_print ("...IUnknown\n"); m_add_ref_source (This); *ppvObject = This; - g_print ("...IUnknown\n"); return S_OK; } else if (IsEqualGUID (riid, &IID_IDropSource)) { + g_print ("...IDropSource\n"); m_add_ref_source (This); *ppvObject = This; - g_print ("...IDropSource\n"); return S_OK; } else @@ -817,6 +810,26 @@ gdk_drop_finish (GdkDragContext *context, { } +static GdkFilterReturn +gdk_destroy_filter (GdkXEvent *xev, + GdkEvent *event, + gpointer data) +{ +#ifdef OLE2_DND + MSG *msg = (MSG *) xev; + + if (msg->message == WM_DESTROY) + { + IDropTarget *idtp = (IDropTarget *) data; + + GDK_NOTE (DND, g_print ("gdk_destroy_filter: WM_DESTROY: %#x\n", msg->hwnd)); + RevokeDragDrop (msg->hwnd); + CoLockObjectExternal (idtp, FALSE, TRUE); + } +#endif + return GDK_FILTER_CONTINUE; +} + void gdk_window_register_dnd (GdkWindow *window) { @@ -854,6 +867,10 @@ gdk_window_register_dnd (GdkWindow *window) } else if (!SUCCEEDED (hres)) g_warning ("gdk_window_register_dnd: RegisterDragDrop failed"); + else + { + gdk_window_add_filter (window, gdk_destroy_filter, &context->idt); + } } #endif } diff --git a/gdk/win32/gdkdraw.c b/gdk/win32/gdkdraw.c index ffa1418ea6..0904fc1ce1 100644 --- a/gdk/win32/gdkdraw.c +++ b/gdk/win32/gdkdraw.c @@ -27,7 +27,8 @@ #include "config.h" #include <math.h> -#include <gdk/gdk.h> + +#include "gdkdrawable.h" #include "gdkprivate.h" #ifndef G_PI @@ -558,35 +559,43 @@ gdk_draw_pixmap (GdkDrawable *drawable, } else { - if ((srcdc = GetDC (src_private->xwindow)) == NULL) - g_warning ("gdk_draw_pixmap: GetDC failed"); - -#if 0 - if (!BitBlt (hdc, xdest, ydest, width, height, - srcdc, xsrc, ysrc, SRCCOPY)) - g_warning ("gdk_draw_pixmap: BitBlt failed"); -#else - /* If we are in fact just blitting inside one window, - * ScrollWindowEx works better. - * Thanks to Philippe Colantoni <colanton@aris.ss.uci.edu> - * for noticing and fixing this. - */ - if (drawable_private->xwindow==src_private->xwindow) + if (drawable_private->xwindow == src_private->xwindow) { - if (!ScrollWindowEx (drawable_private->xwindow,-xsrc+xdest, -ysrc+ydest, NULL, - NULL, NULL, NULL, SW_INVALIDATE)) - g_warning ("gdk_draw_pixmap: ScrollWindowEx failed"); - + /* Blitting inside a window, use ScrollDC */ + RECT scrollRect, clipRect, emptyRect; + HRGN updateRgn; + + scrollRect.left = MIN (xsrc, xdest); + scrollRect.top = MIN (ysrc, ydest); + scrollRect.right = MAX (xsrc + width + 1, xdest + width + 1); + scrollRect.bottom = MAX (ysrc + height + 1, ydest + height + 1); + + clipRect.left = xdest; + clipRect.top = ydest; + clipRect.right = xdest + width + 1; + clipRect.bottom = ydest + height + 1; + + SetRectEmpty (&emptyRect); + updateRgn = CreateRectRgnIndirect (&emptyRect); + if (!ScrollDC (hdc, xdest - xsrc, ydest - ysrc, + &scrollRect, &clipRect, + updateRgn, NULL)) + g_warning ("gdk_draw_pixmap: ScrollDC failed"); + if (!InvalidateRgn (drawable_private->xwindow, updateRgn, FALSE)) + g_warning ("gdk_draw_pixmap: InvalidateRgn failed"); if (!UpdateWindow (drawable_private->xwindow)) g_warning ("gdk_draw_pixmap: UpdateWindow failed"); } else - if (!BitBlt (hdc, xdest, ydest, width, height, - srcdc, xsrc, ysrc, SRCCOPY)) - g_warning ("gdk_draw_pixmap: BitBlt failed"); -#endif - - ReleaseDC (src_private->xwindow, srcdc); + { + if ((srcdc = GetDC (src_private->xwindow)) == NULL) + g_warning ("gdk_draw_pixmap: GetDC failed"); + + if (!BitBlt (hdc, xdest, ydest, width, height, + srcdc, xsrc, ysrc, SRCCOPY)) + g_warning ("gdk_draw_pixmap: BitBlt failed"); + ReleaseDC (src_private->xwindow, srcdc); + } } gdk_gc_postdraw (drawable_private, gc_private); } diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c index ffa1418ea6..0904fc1ce1 100644 --- a/gdk/win32/gdkdrawable-win32.c +++ b/gdk/win32/gdkdrawable-win32.c @@ -27,7 +27,8 @@ #include "config.h" #include <math.h> -#include <gdk/gdk.h> + +#include "gdkdrawable.h" #include "gdkprivate.h" #ifndef G_PI @@ -558,35 +559,43 @@ gdk_draw_pixmap (GdkDrawable *drawable, } else { - if ((srcdc = GetDC (src_private->xwindow)) == NULL) - g_warning ("gdk_draw_pixmap: GetDC failed"); - -#if 0 - if (!BitBlt (hdc, xdest, ydest, width, height, - srcdc, xsrc, ysrc, SRCCOPY)) - g_warning ("gdk_draw_pixmap: BitBlt failed"); -#else - /* If we are in fact just blitting inside one window, - * ScrollWindowEx works better. - * Thanks to Philippe Colantoni <colanton@aris.ss.uci.edu> - * for noticing and fixing this. - */ - if (drawable_private->xwindow==src_private->xwindow) + if (drawable_private->xwindow == src_private->xwindow) { - if (!ScrollWindowEx (drawable_private->xwindow,-xsrc+xdest, -ysrc+ydest, NULL, - NULL, NULL, NULL, SW_INVALIDATE)) - g_warning ("gdk_draw_pixmap: ScrollWindowEx failed"); - + /* Blitting inside a window, use ScrollDC */ + RECT scrollRect, clipRect, emptyRect; + HRGN updateRgn; + + scrollRect.left = MIN (xsrc, xdest); + scrollRect.top = MIN (ysrc, ydest); + scrollRect.right = MAX (xsrc + width + 1, xdest + width + 1); + scrollRect.bottom = MAX (ysrc + height + 1, ydest + height + 1); + + clipRect.left = xdest; + clipRect.top = ydest; + clipRect.right = xdest + width + 1; + clipRect.bottom = ydest + height + 1; + + SetRectEmpty (&emptyRect); + updateRgn = CreateRectRgnIndirect (&emptyRect); + if (!ScrollDC (hdc, xdest - xsrc, ydest - ysrc, + &scrollRect, &clipRect, + updateRgn, NULL)) + g_warning ("gdk_draw_pixmap: ScrollDC failed"); + if (!InvalidateRgn (drawable_private->xwindow, updateRgn, FALSE)) + g_warning ("gdk_draw_pixmap: InvalidateRgn failed"); if (!UpdateWindow (drawable_private->xwindow)) g_warning ("gdk_draw_pixmap: UpdateWindow failed"); } else - if (!BitBlt (hdc, xdest, ydest, width, height, - srcdc, xsrc, ysrc, SRCCOPY)) - g_warning ("gdk_draw_pixmap: BitBlt failed"); -#endif - - ReleaseDC (src_private->xwindow, srcdc); + { + if ((srcdc = GetDC (src_private->xwindow)) == NULL) + g_warning ("gdk_draw_pixmap: GetDC failed"); + + if (!BitBlt (hdc, xdest, ydest, width, height, + srcdc, xsrc, ysrc, SRCCOPY)) + g_warning ("gdk_draw_pixmap: BitBlt failed"); + ReleaseDC (src_private->xwindow, srcdc); + } } gdk_gc_postdraw (drawable_private, gc_private); } diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index 6e5a876a5a..fd2c6cf020 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -29,13 +29,16 @@ #include <stdio.h> -#include <gdk/gdk.h> -#include <gdk/gdkkeysyms.h> +#include "gdk.h" +#include "gdkprivate.h" #include "gdkx.h" + +#include "gdkkeysyms.h" + #ifdef HAVE_WINTAB #include <wintab.h> #endif -#include "gdkinput.h" +#include "gdkinputprivate.h" #define PING() printf("%s: %d\n",__FILE__,__LINE__),fflush(stdout) @@ -76,7 +79,8 @@ struct _GdkEventPrivate */ static GdkEvent *gdk_event_new (void); -static gint gdk_event_apply_filters(MSG *xevent, +static GdkFilterReturn + gdk_event_apply_filters (MSG *xevent, GdkEvent *event, GList *filters); static gint gdk_event_translate (GdkEvent *event, @@ -1037,7 +1041,7 @@ gdk_input_remove (gint tag) g_source_remove (tag); } -static gint +static GdkFilterReturn gdk_event_apply_filters (MSG *xevent, GdkEvent *event, GList *filters) @@ -1157,6 +1161,7 @@ gdk_event_translate (GdkEvent *event, HBRUSH hbr; RECT rect; POINT pt; + MINMAXINFO *lpmmi; GdkWindowPrivate *curWnd_private; GdkEventMask mask; int button; @@ -1211,15 +1216,6 @@ gdk_event_translate (GdkEvent *event, PostMessage (xevent->hwnd, xevent->message, xevent->wParam, xevent->lParam); } - else if (xevent->message == WM_NCCREATE - || xevent->message == WM_CREATE - || xevent->message == WM_GETMINMAXINFO - || xevent->message == WM_NCCALCSIZE - || xevent->message == WM_NCDESTROY - || xevent->message == WM_DESTROY) - { - /* Nothing */ - } return FALSE; } @@ -1232,10 +1228,9 @@ gdk_event_translate (GdkEvent *event, { /* Check for filters for this window */ GdkFilterReturn result; - result = gdk_event_apply_filters (xevent, event, - window_private - ?window_private->filters - :gdk_default_filters); + result = gdk_event_apply_filters + (xevent, event, + window_private ? window_private->filters : gdk_default_filters); if (result != GDK_FILTER_CONTINUE) { @@ -1430,7 +1425,9 @@ gdk_event_translate (GdkEvent *event, case VK_BACK: event->key.keyval = GDK_BackSpace; break; case VK_TAB: - event->key.keyval = GDK_Tab; break; + event->key.keyval = (GetKeyState(VK_SHIFT) < 0 ? + GDK_ISO_Left_Tab : GDK_Tab); + break; case VK_CLEAR: event->key.keyval = GDK_Clear; break; case VK_RETURN: @@ -2643,7 +2640,9 @@ gdk_event_translate (GdkEvent *event, gdk_input_vtable.configure_event (&event->configure, window); } break; - +#if 0 /* Bernd Herd suggests responding to WM_GETMINMAXINFO instead, + * which indeed is much easier. + */ case WM_SIZING: GDK_NOTE (EVENTS, g_print ("WM_SIZING: %#x\n", xevent->hwnd)); if (ret_val_flagp == NULL) @@ -2712,6 +2711,25 @@ gdk_event_translate (GdkEvent *event, } } break; +#else + case WM_GETMINMAXINFO: + GDK_NOTE (EVENTS, g_print ("WM_GETMINMAXINFO: %#x\n", xevent->hwnd)); + lpmmi = (MINMAXINFO*) xevent->lParam; + if (window_private->hint_flags & GDK_HINT_MIN_SIZE) + { + lpmmi->ptMinTrackSize.x = window_private->hint_min_width; + lpmmi->ptMinTrackSize.y = window_private->hint_min_height; + } + if (window_private->hint_flags & GDK_HINT_MAX_SIZE) + { + lpmmi->ptMaxTrackSize.x = window_private->hint_max_width; + lpmmi->ptMaxTrackSize.y = window_private->hint_max_height; + + lpmmi->ptMaxSize.x = window_private->hint_max_width; + lpmmi->ptMaxSize.y = window_private->hint_max_height; + } + break; +#endif case WM_MOVE: GDK_NOTE (EVENTS, g_print ("WM_MOVE: %#x +%d+%d\n", diff --git a/gdk/win32/gdkevents.c b/gdk/win32/gdkevents.c index 6e5a876a5a..fd2c6cf020 100644 --- a/gdk/win32/gdkevents.c +++ b/gdk/win32/gdkevents.c @@ -29,13 +29,16 @@ #include <stdio.h> -#include <gdk/gdk.h> -#include <gdk/gdkkeysyms.h> +#include "gdk.h" +#include "gdkprivate.h" #include "gdkx.h" + +#include "gdkkeysyms.h" + #ifdef HAVE_WINTAB #include <wintab.h> #endif -#include "gdkinput.h" +#include "gdkinputprivate.h" #define PING() printf("%s: %d\n",__FILE__,__LINE__),fflush(stdout) @@ -76,7 +79,8 @@ struct _GdkEventPrivate */ static GdkEvent *gdk_event_new (void); -static gint gdk_event_apply_filters(MSG *xevent, +static GdkFilterReturn + gdk_event_apply_filters (MSG *xevent, GdkEvent *event, GList *filters); static gint gdk_event_translate (GdkEvent *event, @@ -1037,7 +1041,7 @@ gdk_input_remove (gint tag) g_source_remove (tag); } -static gint +static GdkFilterReturn gdk_event_apply_filters (MSG *xevent, GdkEvent *event, GList *filters) @@ -1157,6 +1161,7 @@ gdk_event_translate (GdkEvent *event, HBRUSH hbr; RECT rect; POINT pt; + MINMAXINFO *lpmmi; GdkWindowPrivate *curWnd_private; GdkEventMask mask; int button; @@ -1211,15 +1216,6 @@ gdk_event_translate (GdkEvent *event, PostMessage (xevent->hwnd, xevent->message, xevent->wParam, xevent->lParam); } - else if (xevent->message == WM_NCCREATE - || xevent->message == WM_CREATE - || xevent->message == WM_GETMINMAXINFO - || xevent->message == WM_NCCALCSIZE - || xevent->message == WM_NCDESTROY - || xevent->message == WM_DESTROY) - { - /* Nothing */ - } return FALSE; } @@ -1232,10 +1228,9 @@ gdk_event_translate (GdkEvent *event, { /* Check for filters for this window */ GdkFilterReturn result; - result = gdk_event_apply_filters (xevent, event, - window_private - ?window_private->filters - :gdk_default_filters); + result = gdk_event_apply_filters + (xevent, event, + window_private ? window_private->filters : gdk_default_filters); if (result != GDK_FILTER_CONTINUE) { @@ -1430,7 +1425,9 @@ gdk_event_translate (GdkEvent *event, case VK_BACK: event->key.keyval = GDK_BackSpace; break; case VK_TAB: - event->key.keyval = GDK_Tab; break; + event->key.keyval = (GetKeyState(VK_SHIFT) < 0 ? + GDK_ISO_Left_Tab : GDK_Tab); + break; case VK_CLEAR: event->key.keyval = GDK_Clear; break; case VK_RETURN: @@ -2643,7 +2640,9 @@ gdk_event_translate (GdkEvent *event, gdk_input_vtable.configure_event (&event->configure, window); } break; - +#if 0 /* Bernd Herd suggests responding to WM_GETMINMAXINFO instead, + * which indeed is much easier. + */ case WM_SIZING: GDK_NOTE (EVENTS, g_print ("WM_SIZING: %#x\n", xevent->hwnd)); if (ret_val_flagp == NULL) @@ -2712,6 +2711,25 @@ gdk_event_translate (GdkEvent *event, } } break; +#else + case WM_GETMINMAXINFO: + GDK_NOTE (EVENTS, g_print ("WM_GETMINMAXINFO: %#x\n", xevent->hwnd)); + lpmmi = (MINMAXINFO*) xevent->lParam; + if (window_private->hint_flags & GDK_HINT_MIN_SIZE) + { + lpmmi->ptMinTrackSize.x = window_private->hint_min_width; + lpmmi->ptMinTrackSize.y = window_private->hint_min_height; + } + if (window_private->hint_flags & GDK_HINT_MAX_SIZE) + { + lpmmi->ptMaxTrackSize.x = window_private->hint_max_width; + lpmmi->ptMaxTrackSize.y = window_private->hint_max_height; + + lpmmi->ptMaxSize.x = window_private->hint_max_width; + lpmmi->ptMaxSize.y = window_private->hint_max_height; + } + break; +#endif case WM_MOVE: GDK_NOTE (EVENTS, g_print ("WM_MOVE: %#x +%d+%d\n", diff --git a/gdk/win32/gdkfont-win32.c b/gdk/win32/gdkfont-win32.c index b169dd3ede..77aa8c703a 100644 --- a/gdk/win32/gdkfont-win32.c +++ b/gdk/win32/gdkfont-win32.c @@ -29,7 +29,7 @@ #include <stdio.h> #include <ctype.h> -#include <gdk/gdk.h> +#include "gdkfont.h" #include "gdkprivate.h" GdkFont* diff --git a/gdk/win32/gdkfont.c b/gdk/win32/gdkfont.c index b169dd3ede..77aa8c703a 100644 --- a/gdk/win32/gdkfont.c +++ b/gdk/win32/gdkfont.c @@ -29,7 +29,7 @@ #include <stdio.h> #include <ctype.h> -#include <gdk/gdk.h> +#include "gdkfont.h" #include "gdkprivate.h" GdkFont* diff --git a/gdk/win32/gdkgc-win32.c b/gdk/win32/gdkgc-win32.c index 0333982d18..64016d7d3d 100644 --- a/gdk/win32/gdkgc-win32.c +++ b/gdk/win32/gdkgc-win32.c @@ -27,7 +27,7 @@ #include "config.h" #include <string.h> -#include <gdk/gdk.h> +#include "gdkgc.h" #include "gdkprivate.h" GdkGC* @@ -1013,9 +1013,36 @@ gdk_gc_predraw (GdkWindowPrivate *window_private, if (SetTextColor (gc_private->xgc, fg) == CLR_INVALID) g_warning ("gdk_gc_predraw: SetTextColor failed"); +#if 0 + switch (gc_private->fill_style) + { + case GDK_STIPPLED: + { + GdkPixmap *stipple = gc_private->stipple; + GdkPixmapPrivate *stipple_private = (GdkPixmapPrivate *) stipple; + HBITMAP hbm = stipple_private->xwindow; + if (NULL == (hbr = CreatePatternBrush (hbm))) + g_warning ("gdk_gc_predraw: CreatePatternBrush failed"); + +#ifdef NATIVE_WIN16 + SetBrushOrg (gc_private->xgc, gc_private->ts_x_origin, + gc_private->ts_y_origin); +#else + SetBrushOrgEx(gc_private->xgc, gc_private->ts_x_origin, + gc_private->ts_y_origin, NULL); +#endif + } + break; + case GDK_SOLID: + default: + if ((hbr = CreateSolidBrush (fg)) == NULL) + g_warning ("gdk_gc_predraw: CreateSolidBrush failed"); + break; + } +#else if ((hbr = CreateSolidBrush (fg)) == NULL) g_warning ("gdk_gc_predraw: CreateSolidBrush failed"); - +#endif if (SelectObject (gc_private->xgc, hbr) == NULL) g_warning ("gdk_gc_predraw: SelectObject #3 failed"); diff --git a/gdk/win32/gdkgc.c b/gdk/win32/gdkgc.c index 0333982d18..64016d7d3d 100644 --- a/gdk/win32/gdkgc.c +++ b/gdk/win32/gdkgc.c @@ -27,7 +27,7 @@ #include "config.h" #include <string.h> -#include <gdk/gdk.h> +#include "gdkgc.h" #include "gdkprivate.h" GdkGC* @@ -1013,9 +1013,36 @@ gdk_gc_predraw (GdkWindowPrivate *window_private, if (SetTextColor (gc_private->xgc, fg) == CLR_INVALID) g_warning ("gdk_gc_predraw: SetTextColor failed"); +#if 0 + switch (gc_private->fill_style) + { + case GDK_STIPPLED: + { + GdkPixmap *stipple = gc_private->stipple; + GdkPixmapPrivate *stipple_private = (GdkPixmapPrivate *) stipple; + HBITMAP hbm = stipple_private->xwindow; + if (NULL == (hbr = CreatePatternBrush (hbm))) + g_warning ("gdk_gc_predraw: CreatePatternBrush failed"); + +#ifdef NATIVE_WIN16 + SetBrushOrg (gc_private->xgc, gc_private->ts_x_origin, + gc_private->ts_y_origin); +#else + SetBrushOrgEx(gc_private->xgc, gc_private->ts_x_origin, + gc_private->ts_y_origin, NULL); +#endif + } + break; + case GDK_SOLID: + default: + if ((hbr = CreateSolidBrush (fg)) == NULL) + g_warning ("gdk_gc_predraw: CreateSolidBrush failed"); + break; + } +#else if ((hbr = CreateSolidBrush (fg)) == NULL) g_warning ("gdk_gc_predraw: CreateSolidBrush failed"); - +#endif if (SelectObject (gc_private->xgc, hbr) == NULL) g_warning ("gdk_gc_predraw: SelectObject #3 failed"); diff --git a/gdk/win32/gdkglobals-win32.c b/gdk/win32/gdkglobals-win32.c index 0bb5826945..cf16cf717c 100644 --- a/gdk/win32/gdkglobals-win32.c +++ b/gdk/win32/gdkglobals-win32.c @@ -24,8 +24,7 @@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ -#include <stdio.h> -#include <gdk/gdk.h> +#include "gdktypes.h" #include "gdkprivate.h" guint gdk_debug_flags = 0; diff --git a/gdk/win32/gdkglobals.c b/gdk/win32/gdkglobals.c index 0bb5826945..cf16cf717c 100644 --- a/gdk/win32/gdkglobals.c +++ b/gdk/win32/gdkglobals.c @@ -24,8 +24,7 @@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ -#include <stdio.h> -#include <gdk/gdk.h> +#include "gdktypes.h" #include "gdkprivate.h" guint gdk_debug_flags = 0; diff --git a/gdk/win32/gdkim-win32.c b/gdk/win32/gdkim-win32.c index caeafe53ab..35ea6b5683 100644 --- a/gdk/win32/gdkim-win32.c +++ b/gdk/win32/gdkim-win32.c @@ -31,8 +31,10 @@ #include <stdlib.h> #include <string.h> -#include <gdk/gdk.h> -#include <gdk/gdki18n.h> +#include "gdkim.h" +#include "gdkpixmap.h" +#include "gdkprivate.h" +#include "gdki18n.h" #include "gdkx.h" /* If this variable is FALSE, it indicates that we should diff --git a/gdk/win32/gdkim.c b/gdk/win32/gdkim.c index caeafe53ab..35ea6b5683 100644 --- a/gdk/win32/gdkim.c +++ b/gdk/win32/gdkim.c @@ -31,8 +31,10 @@ #include <stdlib.h> #include <string.h> -#include <gdk/gdk.h> -#include <gdk/gdki18n.h> +#include "gdkim.h" +#include "gdkpixmap.h" +#include "gdkprivate.h" +#include "gdki18n.h" #include "gdkx.h" /* If this variable is FALSE, it indicates that we should diff --git a/gdk/win32/gdkimage-win32.c b/gdk/win32/gdkimage-win32.c index 790d385297..3e9d28dd69 100644 --- a/gdk/win32/gdkimage-win32.c +++ b/gdk/win32/gdkimage-win32.c @@ -26,7 +26,8 @@ #include "config.h" -#include <gdk/gdk.h> +#include "gdk.h" /* For gdk_error_trap_* / gdk_flush_* */ +#include "gdkimage.h" #include "gdkprivate.h" static void gdk_image_put_normal (GdkDrawable *drawable, @@ -276,7 +277,9 @@ gdk_image_new (GdkImageType type, gint width, gint height) { - return gdk_image_new_with_depth (type, visual, width, height, visual->depth); + GdkVisualPrivate *visual_private = (GdkVisualPrivate *) visual; + return gdk_image_new_with_depth (type, visual, width, height, + visual_private->xvisual->bitspixel); } GdkImage* diff --git a/gdk/win32/gdkimage.c b/gdk/win32/gdkimage.c index 790d385297..3e9d28dd69 100644 --- a/gdk/win32/gdkimage.c +++ b/gdk/win32/gdkimage.c @@ -26,7 +26,8 @@ #include "config.h" -#include <gdk/gdk.h> +#include "gdk.h" /* For gdk_error_trap_* / gdk_flush_* */ +#include "gdkimage.h" #include "gdkprivate.h" static void gdk_image_put_normal (GdkDrawable *drawable, @@ -276,7 +277,9 @@ gdk_image_new (GdkImageType type, gint width, gint height) { - return gdk_image_new_with_depth (type, visual, width, height, visual->depth); + GdkVisualPrivate *visual_private = (GdkVisualPrivate *) visual; + return gdk_image_new_with_depth (type, visual, width, height, + visual_private->xvisual->bitspixel); } GdkImage* diff --git a/gdk/win32/gdkinput-win32.c b/gdk/win32/gdkinput-win32.c index 03ff326ead..2f881bfb9a 100644 --- a/gdk/win32/gdkinput-win32.c +++ b/gdk/win32/gdkinput-win32.c @@ -31,8 +31,8 @@ #include <stdio.h> #include <math.h> -#include <gdk/gdk.h> -#include "gdkx.h" +#include "gdkinput.h" +#include "gdkprivate.h" #ifdef HAVE_WINTAB #include <wintab.h> @@ -41,7 +41,7 @@ #include <pktdef.h> #endif -#include "gdkinput.h" +#include "gdkinputprivate.h" struct _GdkDevicePrivate { GdkDeviceInfo info; @@ -920,8 +920,8 @@ gdk_input_win32_configure_event (GdkEventConfigure *event, input_window = gdk_input_window_find (window); g_return_if_fail (window != NULL); - gdk_input_get_root_relative_geometry (GDK_WINDOW_XWINDOW (window), - &root_x, &root_y); + gdk_input_get_root_relative_geometry + ((((GdkWindowPrivate*) window)->xwindow), &root_x, &root_y); input_window->root_x = root_x; input_window->root_y = root_y; @@ -937,8 +937,8 @@ gdk_input_win32_enter_event (GdkEventCrossing *event, input_window = gdk_input_window_find (window); g_return_if_fail (window != NULL); - gdk_input_get_root_relative_geometry (GDK_WINDOW_XWINDOW (window), - &root_x, &root_y); + gdk_input_get_root_relative_geometry + ((((GdkWindowPrivate*) window)->xwindow), &root_x, &root_y); input_window->root_x = root_x; input_window->root_y = root_y; diff --git a/gdk/win32/gdkinput.c b/gdk/win32/gdkinput.c index 03ff326ead..2f881bfb9a 100644 --- a/gdk/win32/gdkinput.c +++ b/gdk/win32/gdkinput.c @@ -31,8 +31,8 @@ #include <stdio.h> #include <math.h> -#include <gdk/gdk.h> -#include "gdkx.h" +#include "gdkinput.h" +#include "gdkprivate.h" #ifdef HAVE_WINTAB #include <wintab.h> @@ -41,7 +41,7 @@ #include <pktdef.h> #endif -#include "gdkinput.h" +#include "gdkinputprivate.h" struct _GdkDevicePrivate { GdkDeviceInfo info; @@ -920,8 +920,8 @@ gdk_input_win32_configure_event (GdkEventConfigure *event, input_window = gdk_input_window_find (window); g_return_if_fail (window != NULL); - gdk_input_get_root_relative_geometry (GDK_WINDOW_XWINDOW (window), - &root_x, &root_y); + gdk_input_get_root_relative_geometry + ((((GdkWindowPrivate*) window)->xwindow), &root_x, &root_y); input_window->root_x = root_x; input_window->root_y = root_y; @@ -937,8 +937,8 @@ gdk_input_win32_enter_event (GdkEventCrossing *event, input_window = gdk_input_window_find (window); g_return_if_fail (window != NULL); - gdk_input_get_root_relative_geometry (GDK_WINDOW_XWINDOW (window), - &root_x, &root_y); + gdk_input_get_root_relative_geometry + ((((GdkWindowPrivate*) window)->xwindow), &root_x, &root_y); input_window->root_x = root_x; input_window->root_y = root_y; diff --git a/gdk/win32/gdkinput.h b/gdk/win32/gdkinputprivate.h index aa4a02dc6c..31ba2c8a8e 100644 --- a/gdk/win32/gdkinput.h +++ b/gdk/win32/gdkinputprivate.h @@ -24,8 +24,8 @@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ -#ifndef __GDK_INPUT_H__ -#define __GDK_INPUT_H__ +#ifndef __GDK_INPUTPRIVATE_H__ +#define __GDK_INPUTPRIVATE_H__ typedef struct _GdkAxisInfo GdkAxisInfo; typedef struct _GdkInputVTable GdkInputVTable; @@ -114,4 +114,4 @@ extern gint gdk_input_ignore_wintab; void gdk_input_window_destroy (GdkWindow *window); -#endif /* __GDK_INPUT_H__ */ +#endif /* __GDK_INPUTPRIVATE_H__ */ diff --git a/gdk/win32/gdkmain-win32.c b/gdk/win32/gdkmain-win32.c index 9f751e3b29..83e20930a3 100644 --- a/gdk/win32/gdkmain-win32.c +++ b/gdk/win32/gdkmain-win32.c @@ -33,11 +33,10 @@ #include <limits.h> #include <io.h> -#include <gdk/gdk.h> -#include <gdk/gdkkeysyms.h> -#include <gdk/gdki18n.h> -#include "gdkx.h" -#include "gdkinput.h" +#include "gdk.h" +#include "gdkprivate.h" +#include "gdkinputprivate.h" +#include "gdkkeysyms.h" static void gdkx_XConvertCase (KeySym symbol, KeySym *lower, @@ -52,15 +51,6 @@ static void gdk_exit_func (void); static int gdk_initialized = 0; /* 1 if the library is initialized, * 0 otherwise. */ -static guint start; /* We use the millisecond - * timestamps from GetTickCount - */ -static gboolean timerp = TRUE; /* If TRUE use timeouts when waiting - * for Windows messages - */ -static guint32 timer_val = 20; /* Timeout in milliseconds. - */ - #ifdef G_ENABLE_DEBUG static const GDebugKey gdk_debug_keys[] = { {"events", GDK_DEBUG_EVENTS}, @@ -118,8 +108,6 @@ gdk_init_check (int *argc, if (g_thread_supported ()) gdk_threads_mutex = g_mutex_new (); - start = GetTickCount (); - #ifdef G_ENABLE_DEBUG { gchar *debug_string = getenv("GDK_DEBUG"); @@ -327,113 +315,6 @@ gdk_get_use_xshm (void) /* *-------------------------------------------------------------- - * gdk_time_get - * - * Get the number of milliseconds since the library was - * initialized. - * - * Arguments: - * - * Results: - * The time since the library was initialized is returned. - * This time value is accurate to milliseconds even though - * a more accurate time down to the microsecond could be - * returned. - * - * Side effects: - * - *-------------------------------------------------------------- - */ - -guint32 -gdk_time_get (void) -{ - guint32 milliseconds; - guint32 end = GetTickCount (); - - if (end < start) - milliseconds = 0xFFFFFFFF - (start - end) + 1; - else - milliseconds = end - start; - - return milliseconds; -} - -/* - *-------------------------------------------------------------- - * gdk_timer_get - * - * Returns the current timer. - * - * Arguments: - * - * Results: - * Returns the current timer interval. This interval is - * in units of milliseconds. - * - * Side effects: - * - *-------------------------------------------------------------- - */ - -guint32 -gdk_timer_get (void) -{ - return timer_val; -} - -/* - *-------------------------------------------------------------- - * gdk_timer_set - * - * Sets the timer interval. - * - * Arguments: - * "milliseconds" is the new value for the timer. - * - * Results: - * - * Side effects: - * Calls to "gdk_event_get" will last for a maximum - * of time of "milliseconds". However, a value of 0 - * milliseconds will cause "gdk_event_get" to block - * indefinately until an event is received. - * - *-------------------------------------------------------------- - */ - -void -gdk_timer_set (guint32 milliseconds) -{ - timer_val = milliseconds; -#ifdef USE_PEEKNAMEDPIPE - /* When using PeekNamedPipe, can't have too long timeouts. - */ - if (timer_val > 10) - timer_val = 10; - else if (timer_val == 0) - timer_val = 0; -#endif -} - -void -gdk_timer_enable (void) -{ - timerp = TRUE; -} - -void -gdk_timer_disable (void) -{ -#ifdef USE_PEEKNAMEDPIPE - /* Can't disable timeouts when using PeekNamedPipe */ -#else - timerp = FALSE; -#endif -} - -/* - *-------------------------------------------------------------- * gdk_screen_width * * Return the width of the screen. diff --git a/gdk/win32/gdkpixmap-win32.c b/gdk/win32/gdkpixmap-win32.c index f22ad98738..a943ba65c8 100644 --- a/gdk/win32/gdkpixmap-win32.c +++ b/gdk/win32/gdkpixmap-win32.c @@ -31,7 +31,7 @@ #include <stdio.h> #include <string.h> -#include <gdk/gdk.h> +#include "gdkpixmap.h" #include "gdkprivate.h" typedef struct diff --git a/gdk/win32/gdkpixmap.c b/gdk/win32/gdkpixmap.c index f22ad98738..a943ba65c8 100644 --- a/gdk/win32/gdkpixmap.c +++ b/gdk/win32/gdkpixmap.c @@ -31,7 +31,7 @@ #include <stdio.h> #include <string.h> -#include <gdk/gdk.h> +#include "gdkpixmap.h" #include "gdkprivate.h" typedef struct diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h index 80217a0de2..9fc0bae3e6 100644 --- a/gdk/win32/gdkprivate-win32.h +++ b/gdk/win32/gdkprivate-win32.h @@ -49,13 +49,33 @@ extern int *__imp___mb_cur_max; #endif #include <time.h> + +#include <gdk/gdkcursor.h> +#include <gdk/gdkevents.h> +#include <gdk/gdkfont.h> +#include <gdk/gdkgc.h> +#include <gdk/gdkim.h> +#include <gdk/gdkimage.h> +#include <gdk/gdkregion.h> +#include <gdk/gdkvisual.h> +#include <gdk/gdkwindow.h> + #include <gdk/gdktypes.h> +#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 */ + /* Define corresponding Windows types for some X11 types, just for laziness. */ -#include <glib.h> - typedef HANDLE XID; typedef PALETTEENTRY XColor; typedef HDC GC; @@ -114,21 +134,6 @@ typedef struct { unsigned long base_pixel; } XStandardColormap; -extern LRESULT CALLBACK -gdk_WindowProc (HWND, UINT, WPARAM, LPARAM); - -#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 */ - - typedef struct _GdkWindowPrivate GdkWindowPrivate; typedef struct _GdkWindowPrivate GdkPixmapPrivate; typedef struct _GdkImagePrivate GdkImagePrivate; @@ -140,7 +145,6 @@ typedef struct _GdkFontPrivate GdkFontPrivate; typedef struct _GdkCursorPrivate GdkCursorPrivate; typedef struct _GdkEventFilter GdkEventFilter; typedef struct _GdkClientFilter GdkClientFilter; -typedef struct _GdkColorContextPrivate GdkColorContextPrivate; typedef struct _GdkRegionPrivate GdkRegionPrivate; @@ -313,12 +317,6 @@ struct _GdkICPrivate #endif /* USE_XIM */ -struct _GdkColorContextPrivate -{ - GdkColorContext color_context; - XStandardColormap std_cmap; -}; - struct _GdkRegionPrivate { GdkRegion region; @@ -411,6 +409,8 @@ extern GdkAtom gdk_clipboard_atom; extern GdkAtom gdk_win32_dropfiles_atom; extern GdkAtom gdk_ole2_dnd_atom; +extern LRESULT CALLBACK gdk_WindowProc (HWND, UINT, WPARAM, LPARAM); + /* Debugging support */ #ifdef G_ENABLE_DEBUG diff --git a/gdk/win32/gdkprivate.h b/gdk/win32/gdkprivate.h index 80217a0de2..9fc0bae3e6 100644 --- a/gdk/win32/gdkprivate.h +++ b/gdk/win32/gdkprivate.h @@ -49,13 +49,33 @@ extern int *__imp___mb_cur_max; #endif #include <time.h> + +#include <gdk/gdkcursor.h> +#include <gdk/gdkevents.h> +#include <gdk/gdkfont.h> +#include <gdk/gdkgc.h> +#include <gdk/gdkim.h> +#include <gdk/gdkimage.h> +#include <gdk/gdkregion.h> +#include <gdk/gdkvisual.h> +#include <gdk/gdkwindow.h> + #include <gdk/gdktypes.h> +#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 */ + /* Define corresponding Windows types for some X11 types, just for laziness. */ -#include <glib.h> - typedef HANDLE XID; typedef PALETTEENTRY XColor; typedef HDC GC; @@ -114,21 +134,6 @@ typedef struct { unsigned long base_pixel; } XStandardColormap; -extern LRESULT CALLBACK -gdk_WindowProc (HWND, UINT, WPARAM, LPARAM); - -#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 */ - - typedef struct _GdkWindowPrivate GdkWindowPrivate; typedef struct _GdkWindowPrivate GdkPixmapPrivate; typedef struct _GdkImagePrivate GdkImagePrivate; @@ -140,7 +145,6 @@ typedef struct _GdkFontPrivate GdkFontPrivate; typedef struct _GdkCursorPrivate GdkCursorPrivate; typedef struct _GdkEventFilter GdkEventFilter; typedef struct _GdkClientFilter GdkClientFilter; -typedef struct _GdkColorContextPrivate GdkColorContextPrivate; typedef struct _GdkRegionPrivate GdkRegionPrivate; @@ -313,12 +317,6 @@ struct _GdkICPrivate #endif /* USE_XIM */ -struct _GdkColorContextPrivate -{ - GdkColorContext color_context; - XStandardColormap std_cmap; -}; - struct _GdkRegionPrivate { GdkRegion region; @@ -411,6 +409,8 @@ extern GdkAtom gdk_clipboard_atom; extern GdkAtom gdk_win32_dropfiles_atom; extern GdkAtom gdk_ole2_dnd_atom; +extern LRESULT CALLBACK gdk_WindowProc (HWND, UINT, WPARAM, LPARAM); + /* Debugging support */ #ifdef G_ENABLE_DEBUG diff --git a/gdk/win32/gdkproperty-win32.c b/gdk/win32/gdkproperty-win32.c index 5b90c169a7..e6bbca6311 100644 --- a/gdk/win32/gdkproperty-win32.c +++ b/gdk/win32/gdkproperty-win32.c @@ -27,7 +27,9 @@ #include "config.h" #include <string.h> -#include <gdk/gdk.h> + +#include "gdkproperty.h" +#include "gdkselection.h" #include "gdkprivate.h" GdkAtom diff --git a/gdk/win32/gdkproperty.c b/gdk/win32/gdkproperty.c index 5b90c169a7..e6bbca6311 100644 --- a/gdk/win32/gdkproperty.c +++ b/gdk/win32/gdkproperty.c @@ -27,7 +27,9 @@ #include "config.h" #include <string.h> -#include <gdk/gdk.h> + +#include "gdkproperty.h" +#include "gdkselection.h" #include "gdkprivate.h" GdkAtom diff --git a/gdk/win32/gdkregion-win32.c b/gdk/win32/gdkregion-win32.c index 2b417ea0bd..7a0acf5fa5 100644 --- a/gdk/win32/gdkregion-win32.c +++ b/gdk/win32/gdkregion-win32.c @@ -26,7 +26,7 @@ #include "config.h" -#include <gdk/gdk.h> +#include "gdk.h" #include "gdkprivate.h" diff --git a/gdk/win32/gdkregion.c b/gdk/win32/gdkregion.c index 2b417ea0bd..7a0acf5fa5 100644 --- a/gdk/win32/gdkregion.c +++ b/gdk/win32/gdkregion.c @@ -26,7 +26,7 @@ #include "config.h" -#include <gdk/gdk.h> +#include "gdk.h" #include "gdkprivate.h" diff --git a/gdk/win32/gdkvisual-win32.c b/gdk/win32/gdkvisual-win32.c index 6caa2dc286..635c51551c 100644 --- a/gdk/win32/gdkvisual-win32.c +++ b/gdk/win32/gdkvisual-win32.c @@ -26,8 +26,8 @@ #include "config.h" -#include <gdk/gdk.h> -#include "gdkx.h" +#include "gdkvisual.h" +#include "gdkprivate.h" static void gdk_visual_decompose_mask (gulong mask, gint *shift, @@ -167,6 +167,7 @@ gdk_visual_init (void) } else if (bitspixel == 24 || bitspixel == 32) { + bitspixel = 24; system_visual->visual.type = GDK_VISUAL_TRUE_COLOR; system_visual->visual.red_mask = 0x00FF0000; system_visual->visual.green_mask = 0x0000FF00; diff --git a/gdk/win32/gdkvisual.c b/gdk/win32/gdkvisual.c index 6caa2dc286..635c51551c 100644 --- a/gdk/win32/gdkvisual.c +++ b/gdk/win32/gdkvisual.c @@ -26,8 +26,8 @@ #include "config.h" -#include <gdk/gdk.h> -#include "gdkx.h" +#include "gdkvisual.h" +#include "gdkprivate.h" static void gdk_visual_decompose_mask (gulong mask, gint *shift, @@ -167,6 +167,7 @@ gdk_visual_init (void) } else if (bitspixel == 24 || bitspixel == 32) { + bitspixel = 24; system_visual->visual.type = GDK_VISUAL_TRUE_COLOR; system_visual->visual.red_mask = 0x00FF0000; system_visual->visual.green_mask = 0x0000FF00; diff --git a/gdk/win32/gdkwin32id.c b/gdk/win32/gdkwin32id.c index de2bfa9d31..4cba645459 100644 --- a/gdk/win32/gdkwin32id.c +++ b/gdk/win32/gdkwin32id.c @@ -28,6 +28,7 @@ #include <stdio.h> #include <gdk/gdk.h> + #include "gdkprivate.h" static guint gdk_xid_hash (XID *xid); diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index 40013d9f6e..72e9570d17 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -29,9 +29,11 @@ #include <stdlib.h> #include <stdio.h> -#include <gdk/gdk.h> + +#include "gdkevents.h" +#include "gdkwindow.h" #include "gdkprivate.h" -#include "gdkinput.h" +#include "gdkinputprivate.h" /* The Win API function AdjustWindowRect may return negative values * resulting in obscured title bars. This helper function is coreccting it. diff --git a/gdk/win32/gdkwindow.c b/gdk/win32/gdkwindow.c index 40013d9f6e..72e9570d17 100644 --- a/gdk/win32/gdkwindow.c +++ b/gdk/win32/gdkwindow.c @@ -29,9 +29,11 @@ #include <stdlib.h> #include <stdio.h> -#include <gdk/gdk.h> + +#include "gdkevents.h" +#include "gdkwindow.h" #include "gdkprivate.h" -#include "gdkinput.h" +#include "gdkinputprivate.h" /* The Win API function AdjustWindowRect may return negative values * resulting in obscured title bars. This helper function is coreccting it. diff --git a/gdk/win32/gdkxid.c b/gdk/win32/gdkxid.c index de2bfa9d31..4cba645459 100644 --- a/gdk/win32/gdkxid.c +++ b/gdk/win32/gdkxid.c @@ -28,6 +28,7 @@ #include <stdio.h> #include <gdk/gdk.h> + #include "gdkprivate.h" static guint gdk_xid_hash (XID *xid); diff --git a/gdk/win32/makefile.cygwin b/gdk/win32/makefile.cygwin index 5dbe79e65c..8cfe60ca90 100644 --- a/gdk/win32/makefile.cygwin +++ b/gdk/win32/makefile.cygwin @@ -25,7 +25,7 @@ GLIB_VER=1.3 GTK_VER=1.3 GLIB = ../../../glib -CFLAGS = $(OPTIMIZE) -I . -I ../.. -I $(WTKIT)/include -I $(GLIB) -DG_ENABLE_DEBUG -DHAVE_CONFIG_H -DGDK_VERSION=\"$(GTK_VER)\" -DNEAR= -DFAR= +CFLAGS = $(OPTIMIZE) -I . -I .. -I ../.. -I $(WTKIT)/include -I $(GLIB) -DG_ENABLE_DEBUG -DHAVE_CONFIG_H -DGDK_VERSION=\"$(GTK_VER)\" -DNEAR= -DFAR= all: \ gdk/gdkprivate.h \ @@ -68,7 +68,7 @@ gdk_OBJECTS = \ # #include <gdk/gdkprivate.h>. # Applications that depend on GTk+ 1.3 or later should include -# gdkprivate.h and gdkx.h without the gdk/ prefix. The CFLAGS should +# gdkprivate.h and/or gdkx.h without the gdk/ prefix. The CFLAGS should # include an -I switch pointing to the backend-specific directory # (*this* directory in the Win32 case). @@ -92,9 +92,14 @@ gdk-$(GTK_VER).dll : $(gdk_OBJECTS) gdk.def gdkres.o libwntab32x.a libwntab32x.a : $(WTKIT)/lib/i386/wntab32x.lib cp $(WTKIT)/lib/i386/wntab32x.lib libwntab32x.a +.SUFFIXES: .c .o .i + .c.o : $(CC) $(CFLAGS) -c -DGDK_COMPILATION -DG_LOG_DOMAIN=\"Gdk\" $< +.c.i : + $(CC) $(CFLAGS) -E -DGDK_COMPILATION -DG_LOG_DOMAIN=\"Gdk\" $< >$@ + gdkrgb.c : ../gdkrgb.c $(CP) ../gdkrgb.c . diff --git a/gdk/win32/makefile.msc b/gdk/win32/makefile.msc index d8faa49fa6..1f367e4479 100644 --- a/gdk/win32/makefile.msc +++ b/gdk/win32/makefile.msc @@ -32,7 +32,7 @@ GLIB_VER=1.3 GTK_VER=1.3 GLIB = ..\..\..\glib -CFLAGS = -I. -I..\.. -I$(WTKIT)\include -I$(GLIB) -DG_ENABLE_DEBUG -DHAVE_CONFIG_H -DGDK_VERSION=\"$(GTK_VER)\" +CFLAGS = -I. -I.. -I..\.. -I$(WTKIT)\include -I$(GLIB) -DG_ENABLE_DEBUG -DHAVE_CONFIG_H -DGDK_VERSION=\"$(GTK_VER)\" all: \ gdk\gdkprivate.h \ |