From cf451eb4479173ffe7a82a1dc56a05624568997a Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Mon, 23 Aug 1999 18:53:11 +0000 Subject: [PATCH] Fix from Simon Kelley: Set expose_count in GdkEventExposes correctly. * gdk/win32/gdkevents.c (gdk_event_translate): Fix from Simon Kelley: Set expose_count in GdkEventExposes correctly. * gdk/win32/gdkwindow.c: Remove dead code (#ifdef MULTIPLE_WINDOW_CLASSES). * gdk/win32/gdkdraw.c (gdk_draw_line): Workaround from Hans Breuer for bug in NT, apparently NT *does* draw the end pixel, too, in LineTo with a one-pixel pen, so we don't have to do it ourselves. --- ChangeLog | 12 +++++ ChangeLog.pre-2-0 | 12 +++++ ChangeLog.pre-2-10 | 12 +++++ ChangeLog.pre-2-2 | 12 +++++ ChangeLog.pre-2-4 | 12 +++++ ChangeLog.pre-2-6 | 12 +++++ ChangeLog.pre-2-8 | 12 +++++ gdk/win32/gdkdraw.c | 7 +-- gdk/win32/gdkdrawable-win32.c | 7 +-- gdk/win32/gdkevents-win32.c | 26 ++++++----- gdk/win32/gdkevents.c | 26 ++++++----- gdk/win32/gdkwindow-win32.c | 83 ++--------------------------------- gdk/win32/gdkwindow.c | 83 ++--------------------------------- 13 files changed, 126 insertions(+), 190 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3eecbed996..8b895dc02f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +1999-08-23 Tor Lillqvist + + * gdk/win32/gdkevents.c (gdk_event_translate): Fix from Simon + Kelley: Set expose_count in GdkEventExposes correctly. + + * gdk/win32/gdkwindow.c: Remove dead code (#ifdef + MULTIPLE_WINDOW_CLASSES). + + * gdk/win32/gdkdraw.c (gdk_draw_line): Workaround from Hans Breuer + for bug in NT, apparently NT *does* draw the end pixel, too, in + LineTo with a one-pixel pen, so we don't have to do it ourselves. + 1999-08-21 Tor Lillqvist Improvements by Hans Breuer: diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 3eecbed996..8b895dc02f 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,15 @@ +1999-08-23 Tor Lillqvist + + * gdk/win32/gdkevents.c (gdk_event_translate): Fix from Simon + Kelley: Set expose_count in GdkEventExposes correctly. + + * gdk/win32/gdkwindow.c: Remove dead code (#ifdef + MULTIPLE_WINDOW_CLASSES). + + * gdk/win32/gdkdraw.c (gdk_draw_line): Workaround from Hans Breuer + for bug in NT, apparently NT *does* draw the end pixel, too, in + LineTo with a one-pixel pen, so we don't have to do it ourselves. + 1999-08-21 Tor Lillqvist Improvements by Hans Breuer: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 3eecbed996..8b895dc02f 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,15 @@ +1999-08-23 Tor Lillqvist + + * gdk/win32/gdkevents.c (gdk_event_translate): Fix from Simon + Kelley: Set expose_count in GdkEventExposes correctly. + + * gdk/win32/gdkwindow.c: Remove dead code (#ifdef + MULTIPLE_WINDOW_CLASSES). + + * gdk/win32/gdkdraw.c (gdk_draw_line): Workaround from Hans Breuer + for bug in NT, apparently NT *does* draw the end pixel, too, in + LineTo with a one-pixel pen, so we don't have to do it ourselves. + 1999-08-21 Tor Lillqvist Improvements by Hans Breuer: diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 3eecbed996..8b895dc02f 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,15 @@ +1999-08-23 Tor Lillqvist + + * gdk/win32/gdkevents.c (gdk_event_translate): Fix from Simon + Kelley: Set expose_count in GdkEventExposes correctly. + + * gdk/win32/gdkwindow.c: Remove dead code (#ifdef + MULTIPLE_WINDOW_CLASSES). + + * gdk/win32/gdkdraw.c (gdk_draw_line): Workaround from Hans Breuer + for bug in NT, apparently NT *does* draw the end pixel, too, in + LineTo with a one-pixel pen, so we don't have to do it ourselves. + 1999-08-21 Tor Lillqvist Improvements by Hans Breuer: diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 3eecbed996..8b895dc02f 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,15 @@ +1999-08-23 Tor Lillqvist + + * gdk/win32/gdkevents.c (gdk_event_translate): Fix from Simon + Kelley: Set expose_count in GdkEventExposes correctly. + + * gdk/win32/gdkwindow.c: Remove dead code (#ifdef + MULTIPLE_WINDOW_CLASSES). + + * gdk/win32/gdkdraw.c (gdk_draw_line): Workaround from Hans Breuer + for bug in NT, apparently NT *does* draw the end pixel, too, in + LineTo with a one-pixel pen, so we don't have to do it ourselves. + 1999-08-21 Tor Lillqvist Improvements by Hans Breuer: diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 3eecbed996..8b895dc02f 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,15 @@ +1999-08-23 Tor Lillqvist + + * gdk/win32/gdkevents.c (gdk_event_translate): Fix from Simon + Kelley: Set expose_count in GdkEventExposes correctly. + + * gdk/win32/gdkwindow.c: Remove dead code (#ifdef + MULTIPLE_WINDOW_CLASSES). + + * gdk/win32/gdkdraw.c (gdk_draw_line): Workaround from Hans Breuer + for bug in NT, apparently NT *does* draw the end pixel, too, in + LineTo with a one-pixel pen, so we don't have to do it ourselves. + 1999-08-21 Tor Lillqvist Improvements by Hans Breuer: diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 3eecbed996..8b895dc02f 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,15 @@ +1999-08-23 Tor Lillqvist + + * gdk/win32/gdkevents.c (gdk_event_translate): Fix from Simon + Kelley: Set expose_count in GdkEventExposes correctly. + + * gdk/win32/gdkwindow.c: Remove dead code (#ifdef + MULTIPLE_WINDOW_CLASSES). + + * gdk/win32/gdkdraw.c (gdk_draw_line): Workaround from Hans Breuer + for bug in NT, apparently NT *does* draw the end pixel, too, in + LineTo with a one-pixel pen, so we don't have to do it ourselves. + 1999-08-21 Tor Lillqvist Improvements by Hans Breuer: diff --git a/gdk/win32/gdkdraw.c b/gdk/win32/gdkdraw.c index 80abf7bcc2..ffa1418ea6 100644 --- a/gdk/win32/gdkdraw.c +++ b/gdk/win32/gdkdraw.c @@ -95,10 +95,11 @@ gdk_draw_line (GdkDrawable *drawable, if (!LineTo (hdc, x2, y2)) g_warning ("gdk_draw_line: LineTo #1 failed"); /* LineTo doesn't draw the last point, so if we have a pen width of 1, - * we draw the end pixel separately... With wider pens it hopefully - * doesn't matter? + * 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) + if (gc_private->pen_width == 1 + && GetVersion () > 0x80000000) if (!LineTo (hdc, x2 + 1, y2)) g_warning ("gdk_draw_line: LineTo #2 failed"); gdk_gc_postdraw (drawable_private, gc_private); diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c index 80abf7bcc2..ffa1418ea6 100644 --- a/gdk/win32/gdkdrawable-win32.c +++ b/gdk/win32/gdkdrawable-win32.c @@ -95,10 +95,11 @@ gdk_draw_line (GdkDrawable *drawable, if (!LineTo (hdc, x2, y2)) g_warning ("gdk_draw_line: LineTo #1 failed"); /* LineTo doesn't draw the last point, so if we have a pen width of 1, - * we draw the end pixel separately... With wider pens it hopefully - * doesn't matter? + * 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) + if (gc_private->pen_width == 1 + && GetVersion () > 0x80000000) if (!LineTo (hdc, x2 + 1, y2)) g_warning ("gdk_draw_line: LineTo #2 failed"); gdk_gc_postdraw (drawable_private, gc_private); diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index efe2a29db7..627532fb85 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -2362,13 +2362,9 @@ gdk_event_translate (GdkEvent *event, rect.bottom - rect.top, rect.left, rect.top, gdk_color_to_string (&window_private->bg_pixel))); -#ifdef MULTIPLE_WINDOW_CLASSES - bg = PALETTEINDEX (window_private->bg_pixel.pixel); -#else bg = GetNearestColor (hdc, RGB (window_private->bg_pixel.red >> 8, window_private->bg_pixel.green >> 8, window_private->bg_pixel.blue >> 8)); -#endif hbr = CreateSolidBrush (bg); #if 0 g_print ("...CreateSolidBrush (%.08x) = %.08x\n", bg, hbr); @@ -2446,12 +2442,7 @@ gdk_event_translate (GdkEvent *event, else { GDK_NOTE (EVENTS, g_print ("...BLACK_BRUSH (?)\n")); -#ifdef MULTIPLE_WINDOW_CLASSES - hbr = (HBRUSH) GetClassLong (window_private->xwindow, - GCL_HBRBACKGROUND); -#else hbr = GetStockObject (BLACK_BRUSH); -#endif GetClipBox (hdc, &rect); if (!FillRect (hdc, &rect, hbr)) g_warning ("WM_ERASEBKGND: FillRect failed"); @@ -2482,12 +2473,24 @@ gdk_event_translate (GdkEvent *event, event->expose.area.y = paintstruct.rcPaint.top; event->expose.area.width = paintstruct.rcPaint.right - paintstruct.rcPaint.left; event->expose.area.height = paintstruct.rcPaint.bottom - paintstruct.rcPaint.top; - event->expose.count = 1; + event->expose.count = 0; return_val = window_private && !window_private->destroyed; + if (return_val) + { + GList *list = queued_events; + while (list != NULL ) + { + if ((((GdkEvent *)list->data)->any.type == GDK_EXPOSE) && + (((GdkEvent *)list->data)->any.window == window) && + !(((GdkEventPrivate *)list->data)->flags & GDK_EVENT_PENDING)) + ((GdkEvent *)list->data)->expose.count++; + + list = list->next; + } + } break; -#ifndef MULTIPLE_WINDOW_CLASSES case WM_SETCURSOR: GDK_NOTE (EVENTS, g_print ("WM_SETCURSOR: %#x %#x %#x\n", xevent->hwnd, @@ -2512,7 +2515,6 @@ gdk_event_translate (GdkEvent *event, *ret_val_flagp = TRUE; *ret_valp = FALSE; break; -#endif #if 0 case WM_QUERYOPEN: diff --git a/gdk/win32/gdkevents.c b/gdk/win32/gdkevents.c index efe2a29db7..627532fb85 100644 --- a/gdk/win32/gdkevents.c +++ b/gdk/win32/gdkevents.c @@ -2362,13 +2362,9 @@ gdk_event_translate (GdkEvent *event, rect.bottom - rect.top, rect.left, rect.top, gdk_color_to_string (&window_private->bg_pixel))); -#ifdef MULTIPLE_WINDOW_CLASSES - bg = PALETTEINDEX (window_private->bg_pixel.pixel); -#else bg = GetNearestColor (hdc, RGB (window_private->bg_pixel.red >> 8, window_private->bg_pixel.green >> 8, window_private->bg_pixel.blue >> 8)); -#endif hbr = CreateSolidBrush (bg); #if 0 g_print ("...CreateSolidBrush (%.08x) = %.08x\n", bg, hbr); @@ -2446,12 +2442,7 @@ gdk_event_translate (GdkEvent *event, else { GDK_NOTE (EVENTS, g_print ("...BLACK_BRUSH (?)\n")); -#ifdef MULTIPLE_WINDOW_CLASSES - hbr = (HBRUSH) GetClassLong (window_private->xwindow, - GCL_HBRBACKGROUND); -#else hbr = GetStockObject (BLACK_BRUSH); -#endif GetClipBox (hdc, &rect); if (!FillRect (hdc, &rect, hbr)) g_warning ("WM_ERASEBKGND: FillRect failed"); @@ -2482,12 +2473,24 @@ gdk_event_translate (GdkEvent *event, event->expose.area.y = paintstruct.rcPaint.top; event->expose.area.width = paintstruct.rcPaint.right - paintstruct.rcPaint.left; event->expose.area.height = paintstruct.rcPaint.bottom - paintstruct.rcPaint.top; - event->expose.count = 1; + event->expose.count = 0; return_val = window_private && !window_private->destroyed; + if (return_val) + { + GList *list = queued_events; + while (list != NULL ) + { + if ((((GdkEvent *)list->data)->any.type == GDK_EXPOSE) && + (((GdkEvent *)list->data)->any.window == window) && + !(((GdkEventPrivate *)list->data)->flags & GDK_EVENT_PENDING)) + ((GdkEvent *)list->data)->expose.count++; + + list = list->next; + } + } break; -#ifndef MULTIPLE_WINDOW_CLASSES case WM_SETCURSOR: GDK_NOTE (EVENTS, g_print ("WM_SETCURSOR: %#x %#x %#x\n", xevent->hwnd, @@ -2512,7 +2515,6 @@ gdk_event_translate (GdkEvent *event, *ret_val_flagp = TRUE; *ret_valp = FALSE; break; -#endif #if 0 case WM_QUERYOPEN: diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index 32c8336405..40013d9f6e 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -144,10 +144,6 @@ RegisterGdkClass(GdkWindowType wtype) static WNDCLASSEX wcl; ATOM klass = 0; -#ifdef MULTIPLE_WINDOW_CLASSES -Error: Not yet implemented! -#endif - wcl.cbSize = sizeof(WNDCLASSEX); wcl.style = 0; /* DON'T set CS_REDRAW. It causes total redraw * on WM_SIZE and WM_MOVE. Flicker, Performance! @@ -1495,49 +1491,8 @@ gdk_window_set_background (GdkWindow *window, } private->bg_type = GDK_WIN32_BG_NORMAL; } -#ifdef MULTIPLE_WINDOW_CLASSES - if (colormap_private != NULL - && colormap_private->xcolormap->rc_palette) - { - /* If we are on a palettized display we can't use the window - * class background brush, but must handle WM_ERASEBKGND. - * At least, I think so. - */ -#endif - private->bg_type = GDK_WIN32_BG_PIXEL; - private->bg_pixel = *color; -#ifdef MULTIPLE_WINDOW_CLASSES - } - else - { - /* Non-palettized display; just set the window class background - brush. */ - HBRUSH hbr; - HGDIOBJ oldbrush; - COLORREF background; - - background = RGB (color->red >> 8, - color->green >> 8, - color->blue >> 8); - - if ((hbr = CreateSolidBrush (GetNearestColor (gdk_DC, - background))) == NULL) - { - g_warning ("gdk_window_set_background: CreateSolidBrush failed"); - return; - } - - oldbrush = (HGDIOBJ) GetClassLong (private->xwindow, - GCL_HBRBACKGROUND); - - if (SetClassLong (private->xwindow, GCL_HBRBACKGROUND, - (LONG) hbr) == 0) - g_warning ("gdk_window_set_background: SetClassLong failed"); - - if (!DeleteObject (oldbrush)) - g_warning ("gdk_window_set_background: DeleteObject failed"); - } -#endif + private->bg_type = GDK_WIN32_BG_PIXEL; + private->bg_pixel = *color; } } @@ -1547,16 +1502,10 @@ gdk_window_set_back_pixmap (GdkWindow *window, gint parent_relative) { GdkWindowPrivate *window_private; -#ifdef MULTIPLE_WINDOW_CLASSES - GdkPixmapPrivate *pixmap_private; -#endif g_return_if_fail (window != NULL); window_private = (GdkWindowPrivate*) window; -#ifdef MULTIPLE_WINDOW_CLASSES - pixmap_private = (GdkPixmapPrivate*) pixmap; -#endif if (!window_private->destroyed) { @@ -1577,29 +1526,8 @@ gdk_window_set_back_pixmap (GdkWindow *window, } else if (!pixmap) { -#ifdef MULTIPLE_WINDOW_CLASSES - SetClassLong (window_private->xwindow, GCL_HBRBACKGROUND, - (LONG) GetStockObject (BLACK_BRUSH)); -#endif + } -#ifdef MULTIPLE_WINDOW_CLASSES - else if (colormap_private->xcolormap->rc_palette) - { - /* Must do the background painting in the - * WM_ERASEBKGND handler. - */ - window_private->bg_type = GDK_WIN32_BG_PIXMAP; - window_private->bg_pixmap = pixmap; - gdk_pixmap_ref (pixmap); - } - else if (pixmap_private->width <= 8 - && pixmap_private->height <= 8) - { - /* We can use small pixmaps directly as background brush */ - SetClassLong (window_private->xwindow, GCL_HBRBACKGROUND, - (LONG) CreatePatternBrush (pixmap_private->xwindow)); - } -#endif else { /* We must cache the pixmap in the WindowPrivate and @@ -1634,12 +1562,7 @@ gdk_window_set_cursor (GdkWindow *window, GDK_NOTE (MISC, g_print ("gdk_window_set_cursor: %#x %#x\n", window_private->xwindow, xcursor)); -#ifdef MULTIPLE_WINDOW_CLASSES - if (!SetClassLong (window_private->xwindow, GCL_HCURSOR, (LONG) xcursor)) - g_warning ("gdk_window_set_cursor: SetClassLong failed"); -#else window_private->xcursor = xcursor; -#endif SetCursor (xcursor); } } diff --git a/gdk/win32/gdkwindow.c b/gdk/win32/gdkwindow.c index 32c8336405..40013d9f6e 100644 --- a/gdk/win32/gdkwindow.c +++ b/gdk/win32/gdkwindow.c @@ -144,10 +144,6 @@ RegisterGdkClass(GdkWindowType wtype) static WNDCLASSEX wcl; ATOM klass = 0; -#ifdef MULTIPLE_WINDOW_CLASSES -Error: Not yet implemented! -#endif - wcl.cbSize = sizeof(WNDCLASSEX); wcl.style = 0; /* DON'T set CS_REDRAW. It causes total redraw * on WM_SIZE and WM_MOVE. Flicker, Performance! @@ -1495,49 +1491,8 @@ gdk_window_set_background (GdkWindow *window, } private->bg_type = GDK_WIN32_BG_NORMAL; } -#ifdef MULTIPLE_WINDOW_CLASSES - if (colormap_private != NULL - && colormap_private->xcolormap->rc_palette) - { - /* If we are on a palettized display we can't use the window - * class background brush, but must handle WM_ERASEBKGND. - * At least, I think so. - */ -#endif - private->bg_type = GDK_WIN32_BG_PIXEL; - private->bg_pixel = *color; -#ifdef MULTIPLE_WINDOW_CLASSES - } - else - { - /* Non-palettized display; just set the window class background - brush. */ - HBRUSH hbr; - HGDIOBJ oldbrush; - COLORREF background; - - background = RGB (color->red >> 8, - color->green >> 8, - color->blue >> 8); - - if ((hbr = CreateSolidBrush (GetNearestColor (gdk_DC, - background))) == NULL) - { - g_warning ("gdk_window_set_background: CreateSolidBrush failed"); - return; - } - - oldbrush = (HGDIOBJ) GetClassLong (private->xwindow, - GCL_HBRBACKGROUND); - - if (SetClassLong (private->xwindow, GCL_HBRBACKGROUND, - (LONG) hbr) == 0) - g_warning ("gdk_window_set_background: SetClassLong failed"); - - if (!DeleteObject (oldbrush)) - g_warning ("gdk_window_set_background: DeleteObject failed"); - } -#endif + private->bg_type = GDK_WIN32_BG_PIXEL; + private->bg_pixel = *color; } } @@ -1547,16 +1502,10 @@ gdk_window_set_back_pixmap (GdkWindow *window, gint parent_relative) { GdkWindowPrivate *window_private; -#ifdef MULTIPLE_WINDOW_CLASSES - GdkPixmapPrivate *pixmap_private; -#endif g_return_if_fail (window != NULL); window_private = (GdkWindowPrivate*) window; -#ifdef MULTIPLE_WINDOW_CLASSES - pixmap_private = (GdkPixmapPrivate*) pixmap; -#endif if (!window_private->destroyed) { @@ -1577,29 +1526,8 @@ gdk_window_set_back_pixmap (GdkWindow *window, } else if (!pixmap) { -#ifdef MULTIPLE_WINDOW_CLASSES - SetClassLong (window_private->xwindow, GCL_HBRBACKGROUND, - (LONG) GetStockObject (BLACK_BRUSH)); -#endif + } -#ifdef MULTIPLE_WINDOW_CLASSES - else if (colormap_private->xcolormap->rc_palette) - { - /* Must do the background painting in the - * WM_ERASEBKGND handler. - */ - window_private->bg_type = GDK_WIN32_BG_PIXMAP; - window_private->bg_pixmap = pixmap; - gdk_pixmap_ref (pixmap); - } - else if (pixmap_private->width <= 8 - && pixmap_private->height <= 8) - { - /* We can use small pixmaps directly as background brush */ - SetClassLong (window_private->xwindow, GCL_HBRBACKGROUND, - (LONG) CreatePatternBrush (pixmap_private->xwindow)); - } -#endif else { /* We must cache the pixmap in the WindowPrivate and @@ -1634,12 +1562,7 @@ gdk_window_set_cursor (GdkWindow *window, GDK_NOTE (MISC, g_print ("gdk_window_set_cursor: %#x %#x\n", window_private->xwindow, xcursor)); -#ifdef MULTIPLE_WINDOW_CLASSES - if (!SetClassLong (window_private->xwindow, GCL_HCURSOR, (LONG) xcursor)) - g_warning ("gdk_window_set_cursor: SetClassLong failed"); -#else window_private->xcursor = xcursor; -#endif SetCursor (xcursor); } }