Commit cf451eb4 authored by Tor Lillqvist's avatar Tor Lillqvist

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.
parent b52072a7
1999-08-23 Tor Lillqvist <tml@iki.fi>
* 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 <tml@iki.fi>
Improvements by Hans Breuer:
......
1999-08-23 Tor Lillqvist <tml@iki.fi>
* 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 <tml@iki.fi>
Improvements by Hans Breuer:
......
1999-08-23 Tor Lillqvist <tml@iki.fi>
* 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 <tml@iki.fi>
Improvements by Hans Breuer:
......
1999-08-23 Tor Lillqvist <tml@iki.fi>
* 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 <tml@iki.fi>
Improvements by Hans Breuer:
......
1999-08-23 Tor Lillqvist <tml@iki.fi>
* 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 <tml@iki.fi>
Improvements by Hans Breuer:
......
1999-08-23 Tor Lillqvist <tml@iki.fi>
* 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 <tml@iki.fi>
Improvements by Hans Breuer:
......
1999-08-23 Tor Lillqvist <tml@iki.fi>
* 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 <tml@iki.fi>
Improvements by Hans Breuer:
......
......@@ -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);
......
......@@ -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);
......
......@@ -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:
......
......@@ -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:
......
......@@ -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_<H,V>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);
}
}
......
......@@ -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_<H,V>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);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment