Make it compile again for Windows

This commit is contained in:
Tor Lillqvist 2010-10-07 01:14:46 +03:00
parent 4196f56de9
commit e346d26f70
6 changed files with 16 additions and 163 deletions

View File

@ -1212,7 +1212,7 @@ target_context_new (GdkWindow *window)
target_drag_context *result; target_drag_context *result;
GdkDragContextPrivateWin32 *private; GdkDragContextPrivateWin32 *private;
GdkDevice *device; GdkDevice *device;
GdkDeviceManager device_manager; GdkDeviceManager *device_manager;
result = g_new0 (target_drag_context, 1); result = g_new0 (target_drag_context, 1);
@ -1222,7 +1222,7 @@ target_context_new (GdkWindow *window)
result->context->protocol = GDK_DRAG_PROTO_OLE2; result->context->protocol = GDK_DRAG_PROTO_OLE2;
result->context->is_source = FALSE; result->context->is_source = FALSE;
device_manager = gdk_display_get_device_manager (_gtk_display); device_manager = gdk_display_get_device_manager (_gdk_display);
device = gdk_device_manager_get_client_pointer (device_manager); device = gdk_device_manager_get_client_pointer (device_manager);
gdk_drag_context_set_device (result->context, device); gdk_drag_context_set_device (result->context, device);
@ -1253,6 +1253,7 @@ source_context_new (GdkWindow *window,
source_drag_context *result; source_drag_context *result;
GdkDragContextPrivateWin32 *private; GdkDragContextPrivateWin32 *private;
GdkDevice *device; GdkDevice *device;
GdkDeviceManager *device_manager;
result = g_new0 (source_drag_context, 1); result = g_new0 (source_drag_context, 1);
@ -1262,7 +1263,7 @@ source_context_new (GdkWindow *window,
result->context->protocol = GDK_DRAG_PROTO_OLE2; result->context->protocol = GDK_DRAG_PROTO_OLE2;
result->context->is_source = TRUE; result->context->is_source = TRUE;
device_manager = gdk_display_get_device_manager (_gtk_display); device_manager = gdk_display_get_device_manager (_gdk_display);
device = gdk_device_manager_get_client_pointer (device_manager); device = gdk_device_manager_get_client_pointer (device_manager);
gdk_drag_context_set_device (result->context, device); gdk_drag_context_set_device (result->context, device);
@ -1488,7 +1489,7 @@ gdk_dropfiles_filter (GdkXEvent *xev,
context->protocol = GDK_DRAG_PROTO_WIN32_DROPFILES; context->protocol = GDK_DRAG_PROTO_WIN32_DROPFILES;
context->is_source = FALSE; context->is_source = FALSE;
device_manager = gdk_display_get_device_manager (_gtk_display); device_manager = gdk_display_get_device_manager (_gdk_display);
device = gdk_device_manager_get_client_pointer (device_manager); device = gdk_device_manager_get_client_pointer (device_manager);
gdk_drag_context_set_device (context, device); gdk_drag_context_set_device (context, device);
@ -1724,7 +1725,7 @@ local_send_enter (GdkDragContext *context,
new_context->protocol = GDK_DRAG_PROTO_LOCAL; new_context->protocol = GDK_DRAG_PROTO_LOCAL;
new_context->is_source = FALSE; new_context->is_source = FALSE;
device_manager = gdk_display_get_device_manager (_gtk_display); device_manager = gdk_display_get_device_manager (_gdk_display);
device = gdk_device_manager_get_client_pointer (device_manager); device = gdk_device_manager_get_client_pointer (device_manager);
gdk_drag_context_set_device (new_context, device); gdk_drag_context_set_device (new_context, device);
@ -1859,13 +1860,13 @@ gdk_drag_begin (GdkWindow *window,
{ {
GdkDragContext *new_context; GdkDragContext *new_context;
GdkDevice *device; GdkDevice *device;
GdkDeviceManager device_manager; GdkDeviceManager *device_manager;
g_return_val_if_fail (window != NULL, NULL); g_return_val_if_fail (window != NULL, NULL);
new_context = gdk_drag_context_new (); new_context = gdk_drag_context_new ();
device_manager = gdk_display_get_device_manager (_gtk_display); device_manager = gdk_display_get_device_manager (_gdk_display);
device = gdk_device_manager_get_client_pointer (device_manager); device = gdk_device_manager_get_client_pointer (device_manager);
gdk_drag_context_set_device (new_context, device); gdk_drag_context_set_device (new_context, device);

View File

@ -112,32 +112,11 @@ _gdk_win32_drawable_acquire_dc (GdkDrawable *drawable)
return NULL; return NULL;
if (!impl->hdc) if (!impl->hdc)
{
if (GDK_IS_PIXMAP_IMPL_WIN32 (impl))
{
impl->hdc = CreateCompatibleDC (NULL);
if (!impl->hdc)
WIN32_GDI_FAILED ("CreateCompatibleDC");
if (impl->hdc)
{
impl->saved_dc_bitmap = SelectObject (impl->hdc,
impl->handle);
if (!impl->saved_dc_bitmap)
{
WIN32_GDI_FAILED ("CreateCompatibleDC");
DeleteDC (impl->hdc);
impl->hdc = NULL;
}
}
}
else
{ {
impl->hdc = GetDC (impl->handle); impl->hdc = GetDC (impl->handle);
if (!impl->hdc) if (!impl->hdc)
WIN32_GDI_FAILED ("GetDC"); WIN32_GDI_FAILED ("GetDC");
} }
}
if (impl->hdc) if (impl->hdc)
{ {
@ -175,9 +154,6 @@ _gdk_win32_drawable_release_dc (GdkDrawable *drawable)
if (impl->hdc) if (impl->hdc)
{ {
if (GDK_IS_PIXMAP_IMPL_WIN32 (impl))
GDI_CALL (DeleteDC, (impl->hdc));
else
GDI_CALL (ReleaseDC, (impl->handle, impl->hdc)); GDI_CALL (ReleaseDC, (impl->handle, impl->hdc));
impl->hdc = NULL; impl->hdc = NULL;
} }

View File

@ -1193,102 +1193,6 @@ synthesize_enter_or_leave_event (GdkWindow *window,
_gdk_device_wintab_update_window_coords (window); _gdk_device_wintab_update_window_coords (window);
} }
static void
synthesize_expose_events (GdkWindow *window)
{
RECT r;
HDC hdc;
GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (((GdkWindowObject *) window)->impl);
GList *list = gdk_window_get_children (window);
GList *head = list;
GdkEvent *event;
int k;
while (list)
{
synthesize_expose_events ((GdkWindow *) list->data);
list = list->next;
}
g_list_free (head);
if (((GdkWindowObject *) window)->input_only)
;
else if (!(hdc = GetDC (impl->handle)))
WIN32_GDI_FAILED ("GetDC");
else
{
if ((k = GetClipBox (hdc, &r)) == ERROR)
WIN32_GDI_FAILED ("GetClipBox");
else if (k != NULLREGION)
{
event = gdk_event_new (GDK_EXPOSE);
event->expose.window = window;
event->expose.area.x = r.left;
event->expose.area.y = r.top;
event->expose.area.width = r.right - r.left;
event->expose.area.height = r.bottom - r.top;
event->expose.region = cairo_region_create_rectangle (&(event->expose.area));
event->expose.count = 0;
append_event (event);
}
GDI_CALL (ReleaseDC, (impl->handle, hdc));
}
}
static void
update_colors (GdkWindow *window,
gboolean top)
{
HDC hdc;
GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (((GdkWindowObject *) window)->impl);
GList *list = gdk_window_get_children (window);
GList *head = list;
GDK_NOTE (COLORMAP, (top ? g_print ("update_colors:") : (void) 0));
while (list)
{
update_colors ((GdkWindow *) list->data, FALSE);
list = list->next;
}
g_list_free (head);
if (((GdkWindowObject *) window)->input_only ||
impl->colormap == NULL)
return;
if (!(hdc = GetDC (impl->handle)))
WIN32_GDI_FAILED ("GetDC");
else
{
GdkColormapPrivateWin32 *cmapp = GDK_WIN32_COLORMAP_DATA (impl->colormap);
HPALETTE holdpal;
gint k;
if ((holdpal = SelectPalette (hdc, cmapp->hpal, TRUE)) == NULL)
WIN32_GDI_FAILED ("SelectPalette");
else if ((k = RealizePalette (hdc)) == GDI_ERROR)
WIN32_GDI_FAILED ("RealizePalette");
else
{
GDK_NOTE (COLORMAP,
(k > 0 ?
g_print (" %p pal=%p: realized %d colors\n"
"update_colors:",
impl->handle, cmapp->hpal, k) :
(void) 0,
g_print (" %p", impl->handle)));
GDI_CALL (UpdateColors, (hdc));
SelectPalette (hdc, holdpal, TRUE);
RealizePalette (hdc);
}
GDI_CALL (ReleaseDC, (impl->handle, hdc));
}
GDK_NOTE (COLORMAP, (top ? g_print ("\n") : (void) 0));
}
/* The check_extended flag controls whether to check if the windows want /* The check_extended flag controls whether to check if the windows want
* events from extended input devices and if the message should be skipped * events from extended input devices and if the message should be skipped
* because an extended input device is active * because an extended input device is active
@ -1840,7 +1744,6 @@ gdk_event_translate (MSG *msg,
GdkDeviceGrabInfo *pointer_grab = NULL; GdkDeviceGrabInfo *pointer_grab = NULL;
GdkWindow *grab_window = NULL; GdkWindow *grab_window = NULL;
static gint update_colors_counter = 0;
gint button; gint button;
GdkAtom target; GdkAtom target;
@ -2438,35 +2341,6 @@ gdk_event_translate (MSG *msg,
(g_print (" %d", HIWORD (msg->wParam)), 0) : 0)); (g_print (" %d", HIWORD (msg->wParam)), 0) : 0));
break; break;
case WM_QUERYNEWPALETTE:
if (gdk_visual_get_system ()->type == GDK_VISUAL_PSEUDO_COLOR)
{
synthesize_expose_events (window);
update_colors_counter = 0;
}
return_val = TRUE;
break;
case WM_PALETTECHANGED:
GDK_NOTE (EVENTS_OR_COLORMAP, g_print (" %p", (HWND) msg->wParam));
if (gdk_visual_get_system ()->type != GDK_VISUAL_PSEUDO_COLOR)
break;
return_val = TRUE;
if (msg->hwnd == (HWND) msg->wParam)
break;
if (++update_colors_counter == 5)
{
synthesize_expose_events (window);
update_colors_counter = 0;
break;
}
update_colors (window, TRUE);
break;
case WM_MOUSEACTIVATE: case WM_MOUSEACTIVATE:
{ {
GdkWindow *tmp; GdkWindow *tmp;

View File

@ -29,6 +29,7 @@
#include "gtkmarshalers.h" #include "gtkmarshalers.h"
#include "gtkplug.h" #include "gtkplug.h"
#include "gtkplugprivate.h" #include "gtkplugprivate.h"
#include "gtkdebug.h"
#include "win32/gdkwin32.h" #include "win32/gdkwin32.h"

View File

@ -34,6 +34,7 @@
#include "gtkprivate.h" #include "gtkprivate.h"
#include "gtksocket.h" #include "gtksocket.h"
#include "gtksocketprivate.h" #include "gtksocketprivate.h"
#include "gtkdebug.h"
#include "win32/gdkwin32.h" #include "win32/gdkwin32.h"

View File

@ -250,7 +250,7 @@ gtk_win32_embed_widget_realize (GtkWidget *widget)
static void static void
gtk_win32_embed_widget_show (GtkWidget *widget) gtk_win32_embed_widget_show (GtkWidget *widget)
{ {
GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE); gtk_widget_set_visible (widget, TRUE);
gtk_widget_realize (widget); gtk_widget_realize (widget);
gtk_container_check_resize (GTK_CONTAINER (widget)); gtk_container_check_resize (GTK_CONTAINER (widget));
@ -260,7 +260,7 @@ gtk_win32_embed_widget_show (GtkWidget *widget)
static void static void
gtk_win32_embed_widget_hide (GtkWidget *widget) gtk_win32_embed_widget_hide (GtkWidget *widget)
{ {
GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE); gtk_widget_set_visible (widget, FALSE);
gtk_widget_unmap (widget); gtk_widget_unmap (widget);
} }