gtk2/gdk/win32/gdkinput-win32.c

1384 lines
41 KiB
C
Raw Normal View History

/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
* Copyright (C) 1998-2007 Tor Lillqvist
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "gdk.h"
#include "gdkinput.h"
Large changes to the Win32 backend, partially made necessary by the 2000-05-02 Tor Lillqvist <tml@iki.fi> Large changes to the Win32 backend, partially made necessary by the changes to the backend-independent internal structures. Attempts to implement similar backing store stuff as on X11. The current (CVS) version of the Win32 backend is *not* as stable as it was before the no-flicker branch was merged. A zipfile with that version is available from http://www.gimp.org/win32/. That should be use by "production" code until this CVS version is usable. (But note, the Win32 backend has never been claimed to be "production quality".) * README.win32: Add the above comment about versions. * gdk/gdkwindow.c: Don't use backing store for now on Win32. * gdk/gdk.def: Update. * gdk/gdkfont.h: Declare temporary Win32-only functions. Will presumably be replaced by some more better mechanism as 1.4 gets closer to release shape. * gdk/makefile.{cygwin,msc}: Update. * gdk/win32/*.c: Correct inclusions of the backend-specific and internal headers. Change code according to changes in these. Use gdk_drawable_*, not gdk_window_* where necessary. * gdk/win32/gdkdnd-win32.c: Use MISC selector for GDK_NOTE, not our old DND. * gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_text): Don't try to interpret single characters as UTF-8. Thanks to Hans Breuer. Use correct function name in warning messages. * gdk/win32/gdkevents-win32.c: Use correct parameter lists for the GSourceFuncs gdk_event_prepare and gdk_event_check. (gdk_event_get_graphics_expose): Do implement, use PeekMessage. Thanks to Hans Breuer. (event_mask_string): Debugging function to print an GdkEventMask. (gdk_pointer_grab): Use it. * gdk/win32/gdkfont-win32.c: The Unicode subrange that the (old) book I used claimed was Hangul actually is CJK Unified Ideographs Extension A. Also, Hangul Syllables were missing. Improve logging. * gdk/win32/gdkgc-win32.c: Largish changes. * gdk/win32/gdkim-win32.c (gdk_set_locale): Use g_win32_getlocale() from GLib, and not setlocale() to get current locale name. * gdk/win32/gdkprivate-win32.h * gdk/win32/gdkwin32.h: Move stuff from gdkprivate-win32.h to gdkwin32.h, similarily as in the X11 backend. * gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Bugfix, assignment was used instead of equals in if test. Thanks to Hans Breuer. * gdk/win32/makefile.{cygwin,msc} * gtk/makefile.{cygwin,msc}: Updates. Better kludge to get the path to the Win32 headers that works also with the mingw compiler. * gtk/gtkstyle.c: Include <string.h>.
2000-05-01 22:06:49 +00:00
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
#include "gdkinput-win32.h"
#define PACKETDATA (PK_CONTEXT | PK_CURSOR | PK_BUTTONS | PK_X | PK_Y | PK_NORMAL_PRESSURE | PK_ORIENTATION)
/* We want everything in absolute mode */
#define PACKETMODE (0)
#include <pktdef.h>
#define DEBUG_WINTAB 1 /* Verbose debug messages enabled */
#define PROXIMITY_OUT_DELAY 200 /* In milliseconds, see set_ignore_core */
#define TWOPI (2.*G_PI)
/* Forward declarations */
static GdkDevicePrivate *gdk_input_find_dev_from_ctx (HCTX hctx,
UINT id);
static GList *wintab_contexts = NULL;
static GdkWindow *wintab_window = NULL;
static GdkWindow *x_grab_window = NULL; /* Window that currently holds
* the extended inputs grab
*/
static GdkEventMask x_grab_mask;
static gboolean x_grab_owner_events;
typedef UINT (WINAPI *t_WTInfoA) (UINT a, UINT b, LPVOID c);
typedef BOOL (WINAPI *t_WTEnable) (HCTX a, BOOL b);
typedef HCTX (WINAPI *t_WTOpenA) (HWND a, LPLOGCONTEXTA b, BOOL c);
typedef BOOL (WINAPI *t_WTOverlap) (HCTX a, BOOL b);
typedef BOOL (WINAPI *t_WTPacket) (HCTX a, UINT b, LPVOID c);
typedef int (WINAPI *t_WTQueueSizeSet) (HCTX a, int b);
static t_WTInfoA p_WTInfoA;
static t_WTEnable p_WTEnable;
static t_WTOpenA p_WTOpenA;
static t_WTOverlap p_WTOverlap;
static t_WTPacket p_WTPacket;
static t_WTQueueSizeSet p_WTQueueSizeSet;
static GdkDevicePrivate *
gdk_input_find_dev_from_ctx (HCTX hctx,
UINT cursor)
{
Make gdkx.h the only installed header from gdk/x11. All structures in Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com> Make gdkx.h the only installed header from gdk/x11. All structures in gdk/x11 are opaque. * gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h: Don't install gdk{drawable,pixmap,window}-x11.h. * gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c: Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11, GdkVisualClass into C files. * gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static. * gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c, gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c} Add public functions to replace previously exported direct structure access. gdk_x11_colormap_get_{xdisplay,xcolormap} gdk_x11_cursor_get_{xdisplay,xcursor}, gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual, gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage}, gdk_x11_gc_get_{xdisplay,ximage} * gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo, GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals. Fix a number of variables and functions that were exported "accidentally" from GDK. * gdk/**.[ch]: gdk => _gdk for gdk_visual_init, gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit, gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data, gdk_event_notify, gdk_queued_events, gdk_queued_tail, gdk_event_new, gdk_events_queue, gdk_events_unqueue, gdk_event_queue_find_first, gdk_event_queue_remove_link, gdk_event_queue_append, gdk_event_button_generate, gdk_debug_flags, gdk_default_filters, gdk_parent_root. * gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c, gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}: gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks, gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window, gdk_use_xshm, gdk_input_ignore_core. * gdk/x11/xsettings-common.h (xsettings_list_insert): Add #defines to namespace functions into the private _gdk_ namespace. * gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window () to replace gdk_parent_root exported variable. Adjust and deprecate GDK_ROOT_PARENT(). * demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix GDK_ROOT_PARENT usage, remove includes of port-specific headers. * gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for _gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core, gdk_input_devices, _gdk_input_windows, gdk_init_input_core. * gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c} docs/Changes-2.0.txt: Remove gdk_wm_protocols, gdk_wm_delete_window functions, gdk_wm_take_focus, use gdk_atom_intern() instead. * gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h} gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h} gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h} gtk/gtkselection.c Unexport gdk_selection_property, just use gdk_atom_intern ("GDK_SELECTION"). * gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}: Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type, GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate, GdkVisualprivate, gdk_x11_gc_flush. Make a number of public exports of variables into functions to increase encapsulation. * gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer, move to gdkinternals.h. Add gdk_device_get_core_pointer (). * gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code, gdk_error_warnings. * gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h} docs/Changes-2.0.txt: s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen() s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow() Add gdk_x11_get_default_xdisplay(). * gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class, Don't export gdk_progclass, move --class command line option and handling to common portion of GDK. Miscellaneous fixes: * gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix g_return_val_if_fail that should have been g_return_if_fail. * gdk/gdkinternals.h gdk/gdkprivate.h: Move gdk_synthesize_window_state() to the semi-public gdkprivate.h. * gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded X11 dependency. * gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO: Remove unused gdk_key_repeat_disable/restore. * linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def: Remove unused gdk_null_window_warnings variable. * gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox; it can be retrieved from the repository; it is too far from functional to be worth having people check out; it would be easier to start from scratch, I suspect. * gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID(). * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. Add some space for future expansion to multihead. * gdk/gdkdrawable.h: Add four reserved function pointers for future expansion of GdkDrawableClass. * gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
GList *tmp_list = _gdk_input_devices;
GdkDevicePrivate *gdkdev;
while (tmp_list)
{
gdkdev = (GdkDevicePrivate *) (tmp_list->data);
if (gdkdev->hctx == hctx && gdkdev->cursor == cursor)
return gdkdev;
tmp_list = tmp_list->next;
}
return NULL;
}
#if DEBUG_WINTAB
static void
print_lc(LOGCONTEXT *lc)
{
g_print ("lcName = %s\n", lc->lcName);
g_print ("lcOptions =");
if (lc->lcOptions & CXO_SYSTEM) g_print (" CXO_SYSTEM");
if (lc->lcOptions & CXO_PEN) g_print (" CXO_PEN");
if (lc->lcOptions & CXO_MESSAGES) g_print (" CXO_MESSAGES");
if (lc->lcOptions & CXO_MARGIN) g_print (" CXO_MARGIN");
if (lc->lcOptions & CXO_MGNINSIDE) g_print (" CXO_MGNINSIDE");
if (lc->lcOptions & CXO_CSRMESSAGES) g_print (" CXO_CSRMESSAGES");
g_print ("\n");
g_print ("lcStatus =");
if (lc->lcStatus & CXS_DISABLED) g_print (" CXS_DISABLED");
if (lc->lcStatus & CXS_OBSCURED) g_print (" CXS_OBSCURED");
if (lc->lcStatus & CXS_ONTOP) g_print (" CXS_ONTOP");
g_print ("\n");
g_print ("lcLocks =");
if (lc->lcLocks & CXL_INSIZE) g_print (" CXL_INSIZE");
if (lc->lcLocks & CXL_INASPECT) g_print (" CXL_INASPECT");
if (lc->lcLocks & CXL_SENSITIVITY) g_print (" CXL_SENSITIVITY");
if (lc->lcLocks & CXL_MARGIN) g_print (" CXL_MARGIN");
g_print ("\n");
g_print ("lcMsgBase = %#x, lcDevice = %#x, lcPktRate = %d\n",
lc->lcMsgBase, lc->lcDevice, lc->lcPktRate);
g_print ("lcPktData =");
if (lc->lcPktData & PK_CONTEXT) g_print (" PK_CONTEXT");
if (lc->lcPktData & PK_STATUS) g_print (" PK_STATUS");
if (lc->lcPktData & PK_TIME) g_print (" PK_TIME");
if (lc->lcPktData & PK_CHANGED) g_print (" PK_CHANGED");
if (lc->lcPktData & PK_SERIAL_NUMBER) g_print (" PK_SERIAL_NUMBER");
if (lc->lcPktData & PK_CURSOR) g_print (" PK_CURSOR");
if (lc->lcPktData & PK_BUTTONS) g_print (" PK_BUTTONS");
if (lc->lcPktData & PK_X) g_print (" PK_X");
if (lc->lcPktData & PK_Y) g_print (" PK_Y");
if (lc->lcPktData & PK_Z) g_print (" PK_Z");
if (lc->lcPktData & PK_NORMAL_PRESSURE) g_print (" PK_NORMAL_PRESSURE");
if (lc->lcPktData & PK_TANGENT_PRESSURE) g_print (" PK_TANGENT_PRESSURE");
if (lc->lcPktData & PK_ORIENTATION) g_print (" PK_ORIENTATION");
if (lc->lcPktData & PK_ROTATION) g_print (" PK_ROTATION");
g_print ("\n");
g_print ("lcPktMode =");
if (lc->lcPktMode & PK_CONTEXT) g_print (" PK_CONTEXT");
if (lc->lcPktMode & PK_STATUS) g_print (" PK_STATUS");
if (lc->lcPktMode & PK_TIME) g_print (" PK_TIME");
if (lc->lcPktMode & PK_CHANGED) g_print (" PK_CHANGED");
if (lc->lcPktMode & PK_SERIAL_NUMBER) g_print (" PK_SERIAL_NUMBER");
if (lc->lcPktMode & PK_CURSOR) g_print (" PK_CURSOR");
if (lc->lcPktMode & PK_BUTTONS) g_print (" PK_BUTTONS");
if (lc->lcPktMode & PK_X) g_print (" PK_X");
if (lc->lcPktMode & PK_Y) g_print (" PK_Y");
if (lc->lcPktMode & PK_Z) g_print (" PK_Z");
if (lc->lcPktMode & PK_NORMAL_PRESSURE) g_print (" PK_NORMAL_PRESSURE");
if (lc->lcPktMode & PK_TANGENT_PRESSURE) g_print (" PK_TANGENT_PRESSURE");
if (lc->lcPktMode & PK_ORIENTATION) g_print (" PK_ORIENTATION");
if (lc->lcPktMode & PK_ROTATION) g_print (" PK_ROTATION");
g_print ("\n");
g_print ("lcMoveMask =");
if (lc->lcMoveMask & PK_CONTEXT) g_print (" PK_CONTEXT");
if (lc->lcMoveMask & PK_STATUS) g_print (" PK_STATUS");
if (lc->lcMoveMask & PK_TIME) g_print (" PK_TIME");
if (lc->lcMoveMask & PK_CHANGED) g_print (" PK_CHANGED");
if (lc->lcMoveMask & PK_SERIAL_NUMBER) g_print (" PK_SERIAL_NUMBER");
if (lc->lcMoveMask & PK_CURSOR) g_print (" PK_CURSOR");
if (lc->lcMoveMask & PK_BUTTONS) g_print (" PK_BUTTONS");
if (lc->lcMoveMask & PK_X) g_print (" PK_X");
if (lc->lcMoveMask & PK_Y) g_print (" PK_Y");
if (lc->lcMoveMask & PK_Z) g_print (" PK_Z");
if (lc->lcMoveMask & PK_NORMAL_PRESSURE) g_print (" PK_NORMAL_PRESSURE");
if (lc->lcMoveMask & PK_TANGENT_PRESSURE) g_print (" PK_TANGENT_PRESSURE");
if (lc->lcMoveMask & PK_ORIENTATION) g_print (" PK_ORIENTATION");
if (lc->lcMoveMask & PK_ROTATION) g_print (" PK_ROTATION");
g_print ("\n");
g_print ("lcBtnDnMask = %#x, lcBtnUpMask = %#x\n",
(guint) lc->lcBtnDnMask, (guint) lc->lcBtnUpMask);
g_print ("lcInOrgX = %ld, lcInOrgY = %ld, lcInOrgZ = %ld\n",
lc->lcInOrgX, lc->lcInOrgY, lc->lcInOrgZ);
g_print ("lcInExtX = %ld, lcInExtY = %ld, lcInExtZ = %ld\n",
lc->lcInExtX, lc->lcInExtY, lc->lcInExtZ);
g_print ("lcOutOrgX = %ld, lcOutOrgY = %ld, lcOutOrgZ = %ld\n",
lc->lcOutOrgX, lc->lcOutOrgY, lc->lcOutOrgZ);
g_print ("lcOutExtX = %ld, lcOutExtY = %ld, lcOutExtZ = %ld\n",
lc->lcOutExtX, lc->lcOutExtY, lc->lcOutExtZ);
g_print ("lcSensX = %g, lcSensY = %g, lcSensZ = %g\n",
lc->lcSensX / 65536., lc->lcSensY / 65536., lc->lcSensZ / 65536.);
g_print ("lcSysMode = %d\n", lc->lcSysMode);
g_print ("lcSysOrgX = %d, lcSysOrgY = %d\n",
lc->lcSysOrgX, lc->lcSysOrgY);
g_print ("lcSysExtX = %d, lcSysExtY = %d\n",
lc->lcSysExtX, lc->lcSysExtY);
g_print ("lcSysSensX = %g, lcSysSensY = %g\n",
lc->lcSysSensX / 65536., lc->lcSysSensY / 65536.);
}
static void
print_cursor (int index)
{
int size;
int i;
char *name;
BOOL active;
WTPKT wtpkt;
BYTE buttons;
BYTE buttonbits;
char *btnnames;
char *p;
BYTE buttonmap[32];
BYTE sysbtnmap[32];
BYTE npbutton;
UINT npbtnmarks[2];
UINT *npresponse;
BYTE tpbutton;
UINT tpbtnmarks[2];
UINT *tpresponse;
DWORD physid;
UINT mode;
UINT minpktdata;
UINT minbuttons;
UINT capabilities;
size = (*p_WTInfoA) (WTI_CURSORS + index, CSR_NAME, NULL);
name = g_malloc (size + 1);
(*p_WTInfoA) (WTI_CURSORS + index, CSR_NAME, name);
g_print ("NAME: %s\n", name);
(*p_WTInfoA) (WTI_CURSORS + index, CSR_ACTIVE, &active);
g_print ("ACTIVE: %s\n", active ? "YES" : "NO");
(*p_WTInfoA) (WTI_CURSORS + index, CSR_PKTDATA, &wtpkt);
g_print ("PKTDATA: %#x:", (guint) wtpkt);
#define BIT(x) if (wtpkt & PK_##x) g_print (" " #x)
BIT (CONTEXT);
BIT (STATUS);
BIT (TIME);
BIT (CHANGED);
BIT (SERIAL_NUMBER);
BIT (BUTTONS);
BIT (X);
BIT (Y);
BIT (Z);
BIT (NORMAL_PRESSURE);
BIT (TANGENT_PRESSURE);
BIT (ORIENTATION);
BIT (ROTATION);
#undef BIT
g_print ("\n");
(*p_WTInfoA) (WTI_CURSORS + index, CSR_BUTTONS, &buttons);
g_print ("BUTTONS: %d\n", buttons);
(*p_WTInfoA) (WTI_CURSORS + index, CSR_BUTTONBITS, &buttonbits);
g_print ("BUTTONBITS: %d\n", buttonbits);
size = (*p_WTInfoA) (WTI_CURSORS + index, CSR_BTNNAMES, NULL);
g_print ("BTNNAMES:");
if (size > 0)
{
btnnames = g_malloc (size + 1);
(*p_WTInfoA) (WTI_CURSORS + index, CSR_BTNNAMES, btnnames);
p = btnnames;
while (*p)
{
g_print (" %s", p);
p += strlen (p) + 1;
}
}
g_print ("\n");
(*p_WTInfoA) (WTI_CURSORS + index, CSR_BUTTONMAP, buttonmap);
g_print ("BUTTONMAP:");
for (i = 0; i < buttons; i++)
g_print (" %d", buttonmap[i]);
g_print ("\n");
(*p_WTInfoA) (WTI_CURSORS + index, CSR_SYSBTNMAP, sysbtnmap);
g_print ("SYSBTNMAP:");
for (i = 0; i < buttons; i++)
g_print (" %d", sysbtnmap[i]);
g_print ("\n");
(*p_WTInfoA) (WTI_CURSORS + index, CSR_NPBUTTON, &npbutton);
g_print ("NPBUTTON: %d\n", npbutton);
(*p_WTInfoA) (WTI_CURSORS + index, CSR_NPBTNMARKS, npbtnmarks);
g_print ("NPBTNMARKS: %d %d\n", npbtnmarks[0], npbtnmarks[1]);
size = (*p_WTInfoA) (WTI_CURSORS + index, CSR_NPRESPONSE, NULL);
g_print ("NPRESPONSE:");
if (size > 0)
{
npresponse = g_malloc (size);
(*p_WTInfoA) (WTI_CURSORS + index, CSR_NPRESPONSE, npresponse);
for (i = 0; i < size / sizeof (UINT); i++)
g_print (" %d", npresponse[i]);
}
g_print ("\n");
(*p_WTInfoA) (WTI_CURSORS + index, CSR_TPBUTTON, &tpbutton);
g_print ("TPBUTTON: %d\n", tpbutton);
(*p_WTInfoA) (WTI_CURSORS + index, CSR_TPBTNMARKS, tpbtnmarks);
g_print ("TPBTNMARKS: %d %d\n", tpbtnmarks[0], tpbtnmarks[1]);
size = (*p_WTInfoA) (WTI_CURSORS + index, CSR_TPRESPONSE, NULL);
g_print ("TPRESPONSE:");
if (size > 0)
{
tpresponse = g_malloc (size);
(*p_WTInfoA) (WTI_CURSORS + index, CSR_TPRESPONSE, tpresponse);
for (i = 0; i < size / sizeof (UINT); i++)
g_print (" %d", tpresponse[i]);
}
g_print ("\n");
(*p_WTInfoA) (WTI_CURSORS + index, CSR_PHYSID, &physid);
g_print ("PHYSID: %#x\n", (guint) physid);
(*p_WTInfoA) (WTI_CURSORS + index, CSR_CAPABILITIES, &capabilities);
g_print ("CAPABILITIES: %#x:", capabilities);
#define BIT(x) if (capabilities & CRC_##x) g_print (" " #x)
BIT (MULTIMODE);
BIT (AGGREGATE);
BIT (INVERT);
#undef BIT
g_print ("\n");
if (capabilities & CRC_MULTIMODE)
{
(*p_WTInfoA) (WTI_CURSORS + index, CSR_MODE, &mode);
g_print ("MODE: %d\n", mode);
}
if (capabilities & CRC_AGGREGATE)
{
(*p_WTInfoA) (WTI_CURSORS + index, CSR_MINPKTDATA, &minpktdata);
g_print ("MINPKTDATA: %d\n", minpktdata);
(*p_WTInfoA) (WTI_CURSORS + index, CSR_MINBUTTONS, &minbuttons);
g_print ("MINBUTTONS: %d\n", minbuttons);
}
}
#endif
void
_gdk_input_wintab_init_check (void)
{
static gboolean wintab_initialized = FALSE;
GdkDevicePrivate *gdkdev;
GdkWindowAttr wa;
WORD specversion;
HCTX *hctx;
UINT ndevices, ncursors, ncsrtypes, firstcsr, hardware;
BOOL active;
DWORD physid;
AXIS axis_x, axis_y, axis_npressure, axis_or[3];
int i, k;
int devix, cursorix;
char devname[100], csrname[100];
BOOL defcontext_done;
HMODULE wintab32;
if (wintab_initialized)
return;
wintab_initialized = TRUE;
wintab_contexts = NULL;
if (_gdk_input_ignore_wintab)
return;
if ((wintab32 = LoadLibrary ("wintab32.dll")) == NULL)
return;
if ((p_WTInfoA = (t_WTInfoA) GetProcAddress (wintab32, "WTInfoA")) == NULL)
return;
if ((p_WTEnable = (t_WTEnable) GetProcAddress (wintab32, "WTEnable")) == NULL)
return;
if ((p_WTOpenA = (t_WTOpenA) GetProcAddress (wintab32, "WTOpenA")) == NULL)
return;
if ((p_WTOverlap = (t_WTOverlap) GetProcAddress (wintab32, "WTOverlap")) == NULL)
return;
if ((p_WTPacket = (t_WTPacket) GetProcAddress (wintab32, "WTPacket")) == NULL)
return;
if ((p_WTQueueSizeSet = (t_WTQueueSizeSet) GetProcAddress (wintab32, "WTQueueSizeSet")) == NULL)
return;
if (!(*p_WTInfoA) (0, 0, NULL))
return;
(*p_WTInfoA) (WTI_INTERFACE, IFC_SPECVERSION, &specversion);
GDK_NOTE (INPUT, g_print ("Wintab interface version %d.%d\n",
HIBYTE (specversion), LOBYTE (specversion)));
(*p_WTInfoA) (WTI_INTERFACE, IFC_NDEVICES, &ndevices);
(*p_WTInfoA) (WTI_INTERFACE, IFC_NCURSORS, &ncursors);
#if DEBUG_WINTAB
GDK_NOTE (INPUT, g_print ("NDEVICES: %d, NCURSORS: %d\n",
ndevices, ncursors));
#endif
/* Create a dummy window to receive wintab events */
wa.wclass = GDK_INPUT_OUTPUT;
wa.event_mask = GDK_ALL_EVENTS_MASK;
wa.width = 2;
wa.height = 2;
wa.x = -100;
wa.y = -100;
wa.window_type = GDK_WINDOW_TOPLEVEL;
if ((wintab_window = gdk_window_new (NULL, &wa, GDK_WA_X|GDK_WA_Y)) == NULL)
{
g_warning ("gdk_input_wintab_init: gdk_window_new failed");
return;
}
g_object_ref (wintab_window);
for (devix = 0; devix < ndevices; devix++)
{
LOGCONTEXT lc;
/* We open the Wintab device (hmm, what if there are several?) as a
* system pointing device, i.e. it controls the normal Windows
* cursor. This seems much more natural.
*/
(*p_WTInfoA) (WTI_DEVICES + devix, DVC_NAME, devname);
(*p_WTInfoA) (WTI_DEVICES + devix, DVC_NCSRTYPES, &ncsrtypes);
(*p_WTInfoA) (WTI_DEVICES + devix, DVC_FIRSTCSR, &firstcsr);
(*p_WTInfoA) (WTI_DEVICES + devix, DVC_HARDWARE, &hardware);
(*p_WTInfoA) (WTI_DEVICES + devix, DVC_X, &axis_x);
(*p_WTInfoA) (WTI_DEVICES + devix, DVC_Y, &axis_y);
(*p_WTInfoA) (WTI_DEVICES + devix, DVC_NPRESSURE, &axis_npressure);
(*p_WTInfoA) (WTI_DEVICES + devix, DVC_ORIENTATION, axis_or);
defcontext_done = FALSE;
if (HIBYTE (specversion) > 1 || LOBYTE (specversion) >= 1)
{
/* Try to get device-specific default context */
/* Some drivers, e.g. Aiptek, don't provide this info */
if ((*p_WTInfoA) (WTI_DSCTXS + devix, 0, &lc) > 0)
defcontext_done = TRUE;
#if DEBUG_WINTAB
if (defcontext_done)
GDK_NOTE (INPUT, (g_print("Using device-specific default context\n")));
else
GDK_NOTE (INPUT, (g_print("Note: Driver did not provide device specific default context info despite claiming to support version 1.1\n")));
#endif
}
if (!defcontext_done)
(*p_WTInfoA) (WTI_DEFSYSCTX, 0, &lc);
#if DEBUG_WINTAB
GDK_NOTE (INPUT, (g_print("Default context:\n"), print_lc(&lc)));
#endif
lc.lcOptions |= CXO_MESSAGES;
lc.lcStatus = 0;
lc.lcMsgBase = WT_DEFBASE;
lc.lcPktRate = 50;
lc.lcPktData = PACKETDATA;
lc.lcPktMode = PACKETMODE;
lc.lcMoveMask = PACKETDATA;
lc.lcBtnUpMask = lc.lcBtnDnMask = ~0;
lc.lcOutOrgX = axis_x.axMin;
lc.lcOutOrgY = axis_y.axMin;
lc.lcOutExtX = axis_x.axMax - axis_x.axMin;
lc.lcOutExtY = axis_y.axMax - axis_y.axMin;
lc.lcOutExtY = -lc.lcOutExtY; /* We want Y growing downward */
#if DEBUG_WINTAB
GDK_NOTE (INPUT, (g_print("context for device %d:\n", devix),
print_lc(&lc)));
#endif
hctx = g_new (HCTX, 1);
if ((*hctx = (*p_WTOpenA) (GDK_WINDOW_HWND (wintab_window), &lc, TRUE)) == NULL)
{
g_warning ("gdk_input_wintab_init: WTOpen failed");
return;
}
GDK_NOTE (INPUT, g_print ("opened Wintab device %d %p\n",
devix, *hctx));
wintab_contexts = g_list_append (wintab_contexts, hctx);
#if 0
(*p_WTEnable) (*hctx, TRUE);
#endif
(*p_WTOverlap) (*hctx, TRUE);
#if DEBUG_WINTAB
GDK_NOTE (INPUT, (g_print("context for device %d after WTOpen:\n", devix),
print_lc(&lc)));
#endif
/* Increase packet queue size to reduce the risk of lost packets.
* According to the specs, if the function fails we must try again
* with a smaller queue size.
*/
GDK_NOTE (INPUT, g_print("Attempting to increase queue size\n"));
for (i = 32; i >= 1; i >>= 1)
{
if ((*p_WTQueueSizeSet) (*hctx, i))
{
GDK_NOTE (INPUT, g_print("Queue size set to %d\n", i));
break;
}
}
if (!i)
GDK_NOTE (INPUT, g_print("Whoops, no queue size could be set\n"));
for (cursorix = firstcsr; cursorix < firstcsr + ncsrtypes; cursorix++)
{
#ifdef DEBUG_WINTAB
GDK_NOTE (INPUT, (g_print("Cursor %d:\n", cursorix), print_cursor (cursorix)));
#endif
active = FALSE;
(*p_WTInfoA) (WTI_CURSORS + cursorix, CSR_ACTIVE, &active);
if (!active)
continue;
/* Wacom tablets seem to report cursors corresponding to
* nonexistent pens or pucks. At least my ArtPad II reports
* six cursors: a puck, pressure stylus and eraser stylus,
* and then the same three again. I only have a
* pressure-sensitive pen. The puck instances, and the
* second instances of the styluses report physid zero. So
* at least for Wacom, skip cursors with physid zero.
*/
(*p_WTInfoA) (WTI_CURSORS + cursorix, CSR_PHYSID, &physid);
if (strcmp (devname, "WACOM Tablet") == 0 && physid == 0)
continue;
gdkdev = g_object_new (GDK_TYPE_DEVICE, NULL);
(*p_WTInfoA) (WTI_CURSORS + cursorix, CSR_NAME, csrname);
gdkdev->info.name = g_strconcat (devname, " ", csrname, NULL);
gdkdev->info.source = GDK_SOURCE_PEN;
gdkdev->info.mode = GDK_MODE_SCREEN;
gdkdev->info.has_cursor = TRUE;
gdkdev->hctx = *hctx;
gdkdev->cursor = cursorix;
(*p_WTInfoA) (WTI_CURSORS + cursorix, CSR_PKTDATA, &gdkdev->pktdata);
gdkdev->info.num_axes = 0;
if (gdkdev->pktdata & PK_X)
gdkdev->info.num_axes++;
if (gdkdev->pktdata & PK_Y)
gdkdev->info.num_axes++;
if (gdkdev->pktdata & PK_NORMAL_PRESSURE)
gdkdev->info.num_axes++;
/* The wintab driver for the Wacom ArtPad II reports
* PK_ORIENTATION in CSR_PKTDATA, but the tablet doesn't
* actually sense tilt. Catch this by noticing that the
* orientation axis's azimuth resolution is zero.
*/
if ((gdkdev->pktdata & PK_ORIENTATION)
&& axis_or[0].axResolution == 0)
gdkdev->pktdata &= ~PK_ORIENTATION;
if (gdkdev->pktdata & PK_ORIENTATION)
gdkdev->info.num_axes += 2; /* x and y tilt */
gdkdev->info.axes = g_new (GdkDeviceAxis, gdkdev->info.num_axes);
gdkdev->axes = g_new (GdkAxisInfo, gdkdev->info.num_axes);
gdkdev->last_axis_data = g_new (gint, gdkdev->info.num_axes);
k = 0;
if (gdkdev->pktdata & PK_X)
{
gdkdev->axes[k].resolution = axis_x.axResolution / 65535.;
gdkdev->axes[k].min_value = axis_x.axMin;
gdkdev->axes[k].max_value = axis_x.axMax;
gdkdev->info.axes[k].use = GDK_AXIS_X;
gdkdev->info.axes[k].min = axis_x.axMin;
gdkdev->info.axes[k].max = axis_x.axMax;
k++;
}
if (gdkdev->pktdata & PK_Y)
{
gdkdev->axes[k].resolution = axis_y.axResolution / 65535.;
gdkdev->axes[k].min_value = axis_y.axMin;
gdkdev->axes[k].max_value = axis_y.axMax;
gdkdev->info.axes[k].use = GDK_AXIS_Y;
gdkdev->info.axes[k].min = axis_y.axMin;
gdkdev->info.axes[k].max = axis_y.axMax;
k++;
}
if (gdkdev->pktdata & PK_NORMAL_PRESSURE)
{
gdkdev->axes[k].resolution = axis_npressure.axResolution / 65535.;
gdkdev->axes[k].min_value = axis_npressure.axMin;
gdkdev->axes[k].max_value = axis_npressure.axMax;
gdkdev->info.axes[k].use = GDK_AXIS_PRESSURE;
/* GIMP seems to expect values in the range 0-1 */
gdkdev->info.axes[k].min = 0.0; /*axis_npressure.axMin;*/
gdkdev->info.axes[k].max = 1.0; /*axis_npressure.axMax;*/
k++;
}
if (gdkdev->pktdata & PK_ORIENTATION)
{
GdkAxisUse axis;
gdkdev->orientation_axes[0] = axis_or[0];
gdkdev->orientation_axes[1] = axis_or[1];
for (axis = GDK_AXIS_XTILT; axis <= GDK_AXIS_YTILT; axis++)
{
/* Wintab gives us aximuth and altitude, which
* we convert to x and y tilt in the -1000..1000 range
*/
gdkdev->axes[k].resolution = 1000;
gdkdev->axes[k].min_value = -1000;
gdkdev->axes[k].max_value = 1000;
gdkdev->info.axes[k].use = axis;
gdkdev->info.axes[k].min = -1000;
gdkdev->info.axes[k].max = 1000;
k++;
}
}
gdkdev->info.num_keys = 0;
gdkdev->info.keys = NULL;
GDK_NOTE (INPUT, g_print ("device: (%d) %s axes: %d\n",
cursorix,
gdkdev->info.name,
gdkdev->info.num_axes));
for (i = 0; i < gdkdev->info.num_axes; i++)
GDK_NOTE (INPUT, g_print ("... axis %d: %d--%d@%d\n",
i,
gdkdev->axes[i].min_value,
gdkdev->axes[i].max_value,
gdkdev->axes[i].resolution));
_gdk_input_devices = g_list_append (_gdk_input_devices,
gdkdev);
}
}
}
static void
decode_tilt (gint *axis_data,
AXIS *axes,
PACKET *packet)
{
/* As I don't have a tilt-sensing tablet,
* I cannot test this code.
*/
double az, el;
az = TWOPI * packet->pkOrientation.orAzimuth /
(axes[0].axResolution / 65536.);
el = TWOPI * packet->pkOrientation.orAltitude /
(axes[1].axResolution / 65536.);
/* X tilt */
axis_data[0] = cos (az) * cos (el) * 1000;
/* Y tilt */
axis_data[1] = sin (az) * cos (el) * 1000;
}
static void
gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev,
GdkInputWindow *input_window,
gint *axis_data,
gdouble *axis_out,
gdouble *x_out,
gdouble *y_out)
{
GdkWindowImplWin32 *impl, *root_impl;
int i;
int x_axis = 0;
int y_axis = 0;
double device_width, device_height;
double x_offset, y_offset, x_scale, y_scale;
impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (input_window->window)->impl);
for (i=0; i<gdkdev->info.num_axes; i++)
{
switch (gdkdev->info.axes[i].use)
{
case GDK_AXIS_X:
x_axis = i;
break;
case GDK_AXIS_Y:
y_axis = i;
break;
default:
break;
}
}
device_width = gdkdev->axes[x_axis].max_value -
gdkdev->axes[x_axis].min_value;
device_height = gdkdev->axes[y_axis].max_value -
gdkdev->axes[y_axis].min_value;
if (gdkdev->info.mode == GDK_MODE_SCREEN)
{
root_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (_gdk_root)->impl);
x_scale = root_impl->width / device_width;
y_scale = root_impl->height / device_height;
x_offset = - input_window->root_x;
y_offset = - input_window->root_y;
}
else /* GDK_MODE_WINDOW */
{
double device_aspect = (device_height*gdkdev->axes[y_axis].resolution) /
(device_width*gdkdev->axes[x_axis].resolution);
if (device_aspect * impl->width >= impl->height)
{
/* device taller than window */
x_scale = impl->width / device_width;
y_scale = (x_scale * gdkdev->axes[x_axis].resolution)
/ gdkdev->axes[y_axis].resolution;
x_offset = 0;
y_offset = -(device_height * y_scale -
impl->height)/2;
}
else
{
/* window taller than device */
y_scale = impl->height / device_height;
x_scale = (y_scale * gdkdev->axes[y_axis].resolution)
/ gdkdev->axes[x_axis].resolution;
y_offset = 0;
x_offset = - (device_width * x_scale - impl->width)/2;
}
}
for (i=0; i<gdkdev->info.num_axes; i++)
{
switch (gdkdev->info.axes[i].use)
{
case GDK_AXIS_X:
axis_out[i] = x_offset + x_scale*axis_data[x_axis];
if (x_out)
*x_out = axis_out[i];
break;
case GDK_AXIS_Y:
axis_out[i] = y_offset + y_scale*axis_data[y_axis];
if (y_out)
*y_out = axis_out[i];
break;
default:
axis_out[i] =
(gdkdev->info.axes[i].max * (axis_data[i] - gdkdev->axes[i].min_value) +
gdkdev->info.axes[i].min * (gdkdev->axes[i].max_value - axis_data[i])) /
(gdkdev->axes[i].max_value - gdkdev->axes[i].min_value);
break;
}
}
}
static void
gdk_input_get_root_relative_geometry (HWND w,
int *x_ret,
int *y_ret)
{
RECT rect;
GetWindowRect (w, &rect);
if (x_ret)
*x_ret = rect.left + _gdk_offset_x;
if (y_ret)
*y_ret = rect.top + _gdk_offset_y;
}
void
gdk/win32/gdkinput-win32.h Drop the GdkEvent* parameter, it wasn't used. 2003-08-07 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkinput-win32.h * gdk/win32/gdkinput-win32.c (_gdk_input_configure_event, _gdk_input_enter_event): Drop the GdkEvent* parameter, it wasn't used. * gdk/win32/gdkevents-win32.c (gdk_event_translate): Adapt caller accordingly, in fact an uninitialised variable was dereferenced. [Win32] Add support for multiple monitors. * gdk/win32/gdkprivate-win32.h * gdk/win32/gdkglobals-win32.c: New global variables for multiple-monitor info: _gdk_num_monitors, _gdk_monitors, and _gdk_offset_x and _gdk_offset_y. * gdk/win32/gdkdisplay-win32.c (count_monitor, enum_monitor): New functions, enumeration functions passed to EnumDisplayMonitors(). (gdk_display_open): If the EnumDisplayMonitors() and GetMonitorInfo() API is present (on Win98, Win2000 and newer), use if to find out monitor info. Calculate the offset between Win32 coordinates (relative to the primary monitor's origin (and thus negative on monitors to the left of or above it), and GDK's (visible coordinates should be non-negative). * gdk/win32/gdkscreen-win32 (gdk_screen_get_n_monitors, gdk_screen_get_monitor_geometry): Use information collected above. (gdk_window_move, gdk_window_move_resize_window_get_geometry): Subtract _gdk_offset_{x,y} from GDK root window coordinates. (gdk_window_get_geometry, gdk_window_get_origin, gdk_window_get_frame_extents): For top-level windows, add _gdk_offset_{x,y} to GDK root window coordinates Still need to handle multiple monitors in gdk_window_fullscreen(). Probably should make the window fullscreen on the monitor where the cursor is? * gdk/win32/gdkevents-win32.c: Add _gdk_offset_{x,y} to all GDK root window coordinates in GdkEvents. [Win32] Fix geometry hint handling. Add support for resize increment and base size, and aspect ratio geometry hints. The "gridded geometry" test in testgtk now works beautifully. * gdk/win32/gdkwindow-win32.c (gdk_window_set_geometry_hints): Turns out this function shouldn't actually ever modify the window's size, just store the hints. (Old code kept for a while inside #if 0.) (gdk_window_set_hints): Remove presumably broken code that handles the position hints, this function is obsolete anyway. * gdk/win32/gdkevents-win32.c: Drop the current_{x,y}_root variables, not used. (adjust_drag): New function, used to implement resize increment hints. (gdk_event_translate): Handle WM_SIZING, implement resize increment and base size, and aspect ratio geometry hints here. The WM_GETMINMAXINFO handler takes care of the minimum and maximum size hints as before. Fix the WM_GETMINMAXINFO handler to take into account window decorations. No need to modify the ptMaxPosition and ptMaxSize fields in the MINMAXINFO struct, the defaults are fine. * gdk/win32/gdkprivate-win32.h * gdk/win32/gdkwindow-win32.c (_gdk_win32_adjust_client_rect, _gdk_win32_get_adjusted_client_rect): New helper functions.
2003-08-07 22:17:18 +00:00
_gdk_input_configure_event (GdkWindow *window)
{
GdkInputWindow *input_window;
int root_x, root_y;
input_window = _gdk_input_window_find (window);
g_return_if_fail (window != NULL);
gdk_input_get_root_relative_geometry (GDK_WINDOW_HWND (window),
&root_x, &root_y);
input_window->root_x = root_x;
input_window->root_y = root_y;
}
void
gdk/win32/gdkinput-win32.h Drop the GdkEvent* parameter, it wasn't used. 2003-08-07 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkinput-win32.h * gdk/win32/gdkinput-win32.c (_gdk_input_configure_event, _gdk_input_enter_event): Drop the GdkEvent* parameter, it wasn't used. * gdk/win32/gdkevents-win32.c (gdk_event_translate): Adapt caller accordingly, in fact an uninitialised variable was dereferenced. [Win32] Add support for multiple monitors. * gdk/win32/gdkprivate-win32.h * gdk/win32/gdkglobals-win32.c: New global variables for multiple-monitor info: _gdk_num_monitors, _gdk_monitors, and _gdk_offset_x and _gdk_offset_y. * gdk/win32/gdkdisplay-win32.c (count_monitor, enum_monitor): New functions, enumeration functions passed to EnumDisplayMonitors(). (gdk_display_open): If the EnumDisplayMonitors() and GetMonitorInfo() API is present (on Win98, Win2000 and newer), use if to find out monitor info. Calculate the offset between Win32 coordinates (relative to the primary monitor's origin (and thus negative on monitors to the left of or above it), and GDK's (visible coordinates should be non-negative). * gdk/win32/gdkscreen-win32 (gdk_screen_get_n_monitors, gdk_screen_get_monitor_geometry): Use information collected above. (gdk_window_move, gdk_window_move_resize_window_get_geometry): Subtract _gdk_offset_{x,y} from GDK root window coordinates. (gdk_window_get_geometry, gdk_window_get_origin, gdk_window_get_frame_extents): For top-level windows, add _gdk_offset_{x,y} to GDK root window coordinates Still need to handle multiple monitors in gdk_window_fullscreen(). Probably should make the window fullscreen on the monitor where the cursor is? * gdk/win32/gdkevents-win32.c: Add _gdk_offset_{x,y} to all GDK root window coordinates in GdkEvents. [Win32] Fix geometry hint handling. Add support for resize increment and base size, and aspect ratio geometry hints. The "gridded geometry" test in testgtk now works beautifully. * gdk/win32/gdkwindow-win32.c (gdk_window_set_geometry_hints): Turns out this function shouldn't actually ever modify the window's size, just store the hints. (Old code kept for a while inside #if 0.) (gdk_window_set_hints): Remove presumably broken code that handles the position hints, this function is obsolete anyway. * gdk/win32/gdkevents-win32.c: Drop the current_{x,y}_root variables, not used. (adjust_drag): New function, used to implement resize increment hints. (gdk_event_translate): Handle WM_SIZING, implement resize increment and base size, and aspect ratio geometry hints here. The WM_GETMINMAXINFO handler takes care of the minimum and maximum size hints as before. Fix the WM_GETMINMAXINFO handler to take into account window decorations. No need to modify the ptMaxPosition and ptMaxSize fields in the MINMAXINFO struct, the defaults are fine. * gdk/win32/gdkprivate-win32.h * gdk/win32/gdkwindow-win32.c (_gdk_win32_adjust_client_rect, _gdk_win32_get_adjusted_client_rect): New helper functions.
2003-08-07 22:17:18 +00:00
_gdk_input_enter_event (GdkWindow *window)
{
GdkInputWindow *input_window;
int root_x, root_y;
input_window = _gdk_input_window_find (window);
g_return_if_fail (window != NULL);
gdk_input_get_root_relative_geometry (GDK_WINDOW_HWND (window), &root_x, &root_y);
input_window->root_x = root_x;
input_window->root_y = root_y;
}
/*
* Get the currently active keyboard modifiers (ignoring the mouse buttons)
* We could use gdk_window_get_pointer but that function does a lot of other
* expensive things besides getting the modifiers. This code is somewhat based
* on build_pointer_event_state from gdkevents-win32.c
*/
static guint
get_modifier_key_state (void)
{
guint state;
state = 0;
/* High-order bit is up/down, low order bit is toggled/untoggled */
if (GetKeyState (VK_CONTROL) < 0)
state |= GDK_CONTROL_MASK;
if (GetKeyState (VK_SHIFT) < 0)
state |= GDK_SHIFT_MASK;
if (GetKeyState (VK_MENU) < 0)
state |= GDK_MOD1_MASK;
if (GetKeyState (VK_CAPITAL) & 0x1)
state |= GDK_LOCK_MASK;
return state;
}
static guint ignore_core_timer = 0;
static gboolean
ignore_core_timefunc (gpointer data)
{
/* The delay has passed */
_gdk_input_ignore_core = FALSE;
ignore_core_timer = 0;
return FALSE; /* remove timeout */
}
/*
* Set or unset the _gdk_input_ignore_core variable that tells GDK
* to ignore events for the core pointer when the tablet is in proximity
* The unsetting is delayed slightly so that if a tablet event arrives
* just after proximity out, it does not cause a core pointer event
* which e.g. causes GIMP to switch tools.
*/
static void
set_ignore_core (gboolean ignore)
{
if (ignore)
{
_gdk_input_ignore_core = TRUE;
/* Remove any pending clear */
if (ignore_core_timer)
{
g_source_remove (ignore_core_timer);
ignore_core_timer = 0;
}
}
else
if (!ignore_core_timer)
ignore_core_timer = gdk_threads_add_timeout (PROXIMITY_OUT_DELAY,
ignore_core_timefunc, NULL);
}
gboolean
_gdk_input_other_event (GdkEvent *event,
MSG *msg,
GdkWindow *window)
{
Changes multihead reorganizing code for win32 support, mostly from a patch Wed Jun 5 18:34:47 2002 Owen Taylor <otaylor@redhat.com> Changes multihead reorganizing code for win32 support, mostly from a patch by Hans Breuer. * gdk/gdkcolor.c gdk/x11/gdkcolor-x11.c gdk/gdkcursor.c gdk/x11/gdkcursor-x11.c gdk/gdkevents.c gdk/x11/gdkevents-x11.c gdk/gdkfont.c gdk/x11/gdkfont-x11.c gdk/gdkkeys.c gdk/x11/gdkkeys-x11.c gdk/gdkimage.c gdk/x11/gdkimage-x11.c gdk/gdkscreen.c gdk/x11/gdkmain-x11.c gdk/gdkdisplay.c gdk/gdkevents-x11.c gdk/gdkpango.c gdk/x11/gdkpango-x11.c gdk/gdkselection.c gdk/x11/gdkselection-x11.c gdk/gdkwindow.c gdk/x11/gdkwindow-x11.c gdk/gdkvisual.c gdk/x11/gdkvisual-x11.c: Move port-independent singlehead wrapper functions into port-independent part of GDK. (#80009) * gdk/win32/gdkcolor-win32.c gdk/win32/gdkcursor-win32.c gdk/win32/gdkevents-win32.c gdk/win32/gdkfont-win32.c gdk/win32/gdkimage-win32.c gdk/win32/gdkkeys-win32.c gdk/win32/gdkmain-win32.c gdk/win32/gdkproperty-win32.c gdk/win32/gdkselection-win32.c gdk/win32/gkwindow-win32.c: Turn singlehead functions into "multihead" functions that ignore their GdkDisplay or GdkScreen arguments. * gdk/win32/gdkdrawable-win32.c gdk/win32/gdkevents-win32.c gdk/win32/gdkinput-win32.c gdk/win32/gdkprivate-win32.h: Misc multihead-compatibility changes. * gtk/gtk.def gdk/gdk.def: Update for multihead functions. * gdk/gdkcolormap.h gdk/gdkvisual.h gdk/x11/gdkcolormap-x11.c gdk/x11/gdkvisual-x11.c: Remove the screen fields from the public parts of the colormap/visual structures, add accessors instead. * gdk/gdkpixbuf-render.c gdk/gdkpixmap.c gdk/gdkrgb.c gdk/x11/gdkcolormap-x11.c gdk/x11/gdkimage-x11.c gdk/x11/gdkimage-x11.c gdk/x11/gdkprivate-x11.h gtk/gtkgc.c gtk/gtkstyle.c gtk/gtkwidget.c: Use accessors to get the screen for colormaps, visuals; move the fields into the private structures for the x11 backend. * gdk/gdkdisplay.[ch] gdk/x11/gdkdisplay-x11.[ch] gdk/gdkscreen.[ch] gdk/x11/gdkscreen-x11.c: Remove virtualization of screen and display functions. (#79990, patch from Erwann Chenede) * gdk/win32/gdkdisplay-x11.c gdk/win32/gdkscreen-win32.c gdk/win32/{Makefile.am, makefile.msc, makefile.mingw}: New files containing stub implementations of Display, Screen functions. * gdk/x11/gdkscreen-x11.[ch] gdk/x11/gdkdisplay-x11.[ch] gdk/x11/gdkx.h: Clean up function exports and what headers they are in. (#79954) * gdk/x11/gdkx.h: Fix macro that was referring to a non-existant screen->screen_num. (In the patch for #79972, Erwann Chenede) * gdk/gdkscreen.c gdk/gdkwindow.c gdk/x11/gdkinternals.h gdk/x11/gdkscreen-x11.c: Fix gdk_screen_get_window_at_pointer() to use window hooks. (#79972, patch partly from Erwann Chenede) * gdk/x11/gdkdisplay-x11.c gdk/x11/gdkevents-x11.c: Fix some warnings.
2002-06-06 00:26:42 +00:00
GdkDisplay *display;
GdkWindowObject *obj, *grab_obj;
GdkInputWindow *input_window;
GdkDevicePrivate *gdkdev = NULL;
GdkEventMask masktest;
guint key_state;
POINT pt;
PACKET packet;
gint k;
gint x, y;
guint translated_buttons, button_diff, button_mask;
/* Translation from tablet button state to GDK button state for
* buttons 1-3 - swap button 2 and 3.
*/
static guint button_map[8] = {0, 1, 4, 5, 2, 3, 6, 7};
if (event->any.window != wintab_window)
1999-11-17 00:45:37 +00:00
{
g_warning ("_gdk_input_other_event: not wintab_window?");
1999-11-17 00:45:37 +00:00
return FALSE;
}
window = gdk_window_at_pointer (&x, &y);
if (window == NULL)
window = _gdk_root;
g_object_ref (window);
Changes multihead reorganizing code for win32 support, mostly from a patch Wed Jun 5 18:34:47 2002 Owen Taylor <otaylor@redhat.com> Changes multihead reorganizing code for win32 support, mostly from a patch by Hans Breuer. * gdk/gdkcolor.c gdk/x11/gdkcolor-x11.c gdk/gdkcursor.c gdk/x11/gdkcursor-x11.c gdk/gdkevents.c gdk/x11/gdkevents-x11.c gdk/gdkfont.c gdk/x11/gdkfont-x11.c gdk/gdkkeys.c gdk/x11/gdkkeys-x11.c gdk/gdkimage.c gdk/x11/gdkimage-x11.c gdk/gdkscreen.c gdk/x11/gdkmain-x11.c gdk/gdkdisplay.c gdk/gdkevents-x11.c gdk/gdkpango.c gdk/x11/gdkpango-x11.c gdk/gdkselection.c gdk/x11/gdkselection-x11.c gdk/gdkwindow.c gdk/x11/gdkwindow-x11.c gdk/gdkvisual.c gdk/x11/gdkvisual-x11.c: Move port-independent singlehead wrapper functions into port-independent part of GDK. (#80009) * gdk/win32/gdkcolor-win32.c gdk/win32/gdkcursor-win32.c gdk/win32/gdkevents-win32.c gdk/win32/gdkfont-win32.c gdk/win32/gdkimage-win32.c gdk/win32/gdkkeys-win32.c gdk/win32/gdkmain-win32.c gdk/win32/gdkproperty-win32.c gdk/win32/gdkselection-win32.c gdk/win32/gkwindow-win32.c: Turn singlehead functions into "multihead" functions that ignore their GdkDisplay or GdkScreen arguments. * gdk/win32/gdkdrawable-win32.c gdk/win32/gdkevents-win32.c gdk/win32/gdkinput-win32.c gdk/win32/gdkprivate-win32.h: Misc multihead-compatibility changes. * gtk/gtk.def gdk/gdk.def: Update for multihead functions. * gdk/gdkcolormap.h gdk/gdkvisual.h gdk/x11/gdkcolormap-x11.c gdk/x11/gdkvisual-x11.c: Remove the screen fields from the public parts of the colormap/visual structures, add accessors instead. * gdk/gdkpixbuf-render.c gdk/gdkpixmap.c gdk/gdkrgb.c gdk/x11/gdkcolormap-x11.c gdk/x11/gdkimage-x11.c gdk/x11/gdkimage-x11.c gdk/x11/gdkprivate-x11.h gtk/gtkgc.c gtk/gtkstyle.c gtk/gtkwidget.c: Use accessors to get the screen for colormaps, visuals; move the fields into the private structures for the x11 backend. * gdk/gdkdisplay.[ch] gdk/x11/gdkdisplay-x11.[ch] gdk/gdkscreen.[ch] gdk/x11/gdkscreen-x11.c: Remove virtualization of screen and display functions. (#79990, patch from Erwann Chenede) * gdk/win32/gdkdisplay-x11.c gdk/win32/gdkscreen-win32.c gdk/win32/{Makefile.am, makefile.msc, makefile.mingw}: New files containing stub implementations of Display, Screen functions. * gdk/x11/gdkscreen-x11.[ch] gdk/x11/gdkdisplay-x11.[ch] gdk/x11/gdkx.h: Clean up function exports and what headers they are in. (#79954) * gdk/x11/gdkx.h: Fix macro that was referring to a non-existant screen->screen_num. (In the patch for #79972, Erwann Chenede) * gdk/gdkscreen.c gdk/gdkwindow.c gdk/x11/gdkinternals.h gdk/x11/gdkscreen-x11.c: Fix gdk_screen_get_window_at_pointer() to use window hooks. (#79972, patch partly from Erwann Chenede) * gdk/x11/gdkdisplay-x11.c gdk/x11/gdkevents-x11.c: Fix some warnings.
2002-06-06 00:26:42 +00:00
display = gdk_drawable_get_display (window);
Massive changes. Too many to list here, but I'll try a summary: 2002-02-17 Tor Lillqvist <tml@iki.fi> * gdk/win32/*.c: Massive changes. Too many to list here, but I'll try a summary: 1) Unify GdkPixmap and GdkImage implementation: For each GdkPixmap, allocate a GdkImage, and vice versa. GdkPixmapImplWin32Data has a pointer to the GdkImage. GdkImage::windowing_data is a pointer to the GdkPixmap. This simplifies many pixmap and image related functions a lot, and reduces duplicated code snippets. For instance, there is only one place in gdk/win32 where CreateDIBSection() is called, in the function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap) to a Windows region is almost trivial, with the bitmap bits being readily accessible in the associated GdkImage. All blitting between GdkPixmaps, GdkWindows and GdkImages goes through handled the _gdk_win32_blit() function, which calls different functions to handle the cases of blitting from pixmaps, inside windows (scrolling), or from windows, which all require somewhat different handling. 2) Support 256-color mode. This has long been very broken, now it works more or less OK. Keep the logical palette for each colormap as small as possible while allocating and freeing colors. Select and realize the logical palette associated with a GdkColormap into a DC before drawing or blitting. When the display is in 256-color mode, make it possible for the user to override the size of the palette(s) used with either the GDK_WIN32_MAX_COLORS environment variable, or a -max-colors command line option. It is possible to reduce the palette size all the way down to using just the 16 static colors (which causes the system visual to be of type GDK_VISUAL_STATIC_COLOR. This could possibly be useful if one desperately wants to avoid color flashing. (Note that in order for this to work properly, an as of yet not commited fix to gdkrgb.c is needed.) Handle the palette messages. On WM_PALETTECHANGED, call UpdateColors() for the given window hierarchy. Do this only if a window in some other top-level window hierarchy caused the palette change (realized a palette). Do this max five times in a row (an arbitrarily chosen limit), though, otherwise redraw by generating expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole window hierarchy by generating GDK_EXPOSE events. 3) Code cleanup in general. For instance, remove the "emulated" X11 structs ColormapStruct, Visual and XStandardColormap. Use the new GDK_DEBUG_* flags for debugging output in the relevant source files. Remove the unused colormap hash table in gdkcolor-win32.c 4) Plug some resource leaks. 2002-02-14 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use g_filename_to_uri() to actually create legal URIs in the text/uri-list data.
2002-02-17 00:25:05 +00:00
GDK_NOTE (EVENTS_OR_INPUT,
g_print ("_gdk_input_other_event: window=%p %+d%+d\n",
Massive changes. Too many to list here, but I'll try a summary: 2002-02-17 Tor Lillqvist <tml@iki.fi> * gdk/win32/*.c: Massive changes. Too many to list here, but I'll try a summary: 1) Unify GdkPixmap and GdkImage implementation: For each GdkPixmap, allocate a GdkImage, and vice versa. GdkPixmapImplWin32Data has a pointer to the GdkImage. GdkImage::windowing_data is a pointer to the GdkPixmap. This simplifies many pixmap and image related functions a lot, and reduces duplicated code snippets. For instance, there is only one place in gdk/win32 where CreateDIBSection() is called, in the function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap) to a Windows region is almost trivial, with the bitmap bits being readily accessible in the associated GdkImage. All blitting between GdkPixmaps, GdkWindows and GdkImages goes through handled the _gdk_win32_blit() function, which calls different functions to handle the cases of blitting from pixmaps, inside windows (scrolling), or from windows, which all require somewhat different handling. 2) Support 256-color mode. This has long been very broken, now it works more or less OK. Keep the logical palette for each colormap as small as possible while allocating and freeing colors. Select and realize the logical palette associated with a GdkColormap into a DC before drawing or blitting. When the display is in 256-color mode, make it possible for the user to override the size of the palette(s) used with either the GDK_WIN32_MAX_COLORS environment variable, or a -max-colors command line option. It is possible to reduce the palette size all the way down to using just the 16 static colors (which causes the system visual to be of type GDK_VISUAL_STATIC_COLOR. This could possibly be useful if one desperately wants to avoid color flashing. (Note that in order for this to work properly, an as of yet not commited fix to gdkrgb.c is needed.) Handle the palette messages. On WM_PALETTECHANGED, call UpdateColors() for the given window hierarchy. Do this only if a window in some other top-level window hierarchy caused the palette change (realized a palette). Do this max five times in a row (an arbitrarily chosen limit), though, otherwise redraw by generating expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole window hierarchy by generating GDK_EXPOSE events. 3) Code cleanup in general. For instance, remove the "emulated" X11 structs ColormapStruct, Visual and XStandardColormap. Use the new GDK_DEBUG_* flags for debugging output in the relevant source files. Remove the unused colormap hash table in gdkcolor-win32.c 4) Plug some resource leaks. 2002-02-14 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use g_filename_to_uri() to actually create legal URIs in the text/uri-list data.
2002-02-17 00:25:05 +00:00
GDK_WINDOW_HWND (window), x, y));
if (msg->message == WT_PACKET)
{
if (!(*p_WTPacket) ((HCTX) msg->lParam, msg->wParam, &packet))
return FALSE;
}
obj = GDK_WINDOW_OBJECT (window);
switch (msg->message)
{
case WT_PACKET:
/* Don't produce any button or motion events while a window is being
* moved or resized, see bug #151090.
*/
if (_sizemove_in_progress)
{
GDK_NOTE (EVENTS_OR_INPUT, g_print ("... ignored when moving/sizing\n"));
return FALSE;
}
if (window == _gdk_root && x_grab_window == NULL)
{
GDK_NOTE (EVENTS_OR_INPUT, g_print ("... is root\n"));
return FALSE;
}
if ((gdkdev = gdk_input_find_dev_from_ctx ((HCTX) msg->lParam,
packet.pkCursor)) == NULL)
return FALSE;
if (gdkdev->info.mode == GDK_MODE_DISABLED)
return FALSE;
k = 0;
if (gdkdev->pktdata & PK_X)
gdkdev->last_axis_data[k++] = packet.pkX;
if (gdkdev->pktdata & PK_Y)
gdkdev->last_axis_data[k++] = packet.pkY;
if (gdkdev->pktdata & PK_NORMAL_PRESSURE)
gdkdev->last_axis_data[k++] = packet.pkNormalPressure;
if (gdkdev->pktdata & PK_ORIENTATION)
{
decode_tilt (gdkdev->last_axis_data + k,
gdkdev->orientation_axes, &packet);
k += 2;
}
g_assert (k == gdkdev->info.num_axes);
translated_buttons = button_map[packet.pkButtons & 0x07] | (packet.pkButtons & ~0x07);
if (translated_buttons != gdkdev->button_state)
{
/* At least one button has changed state so produce a button event
* If more than one button has changed state (unlikely),
* just care about the first and act on the next the next time
* we get a packet
*/
button_diff = translated_buttons ^ gdkdev->button_state;
/* Gdk buttons are numbered 1.. */
event->button.button = 1;
for (button_mask = 1; button_mask != 0x80000000;
button_mask <<= 1, event->button.button++)
{
if (button_diff & button_mask)
{
/* Found a button that has changed state */
break;
}
}
if (!(translated_buttons & button_mask))
{
event->any.type = GDK_BUTTON_RELEASE;
masktest = GDK_BUTTON_RELEASE_MASK;
}
else
{
event->any.type = GDK_BUTTON_PRESS;
masktest = GDK_BUTTON_PRESS_MASK;
}
gdkdev->button_state ^= button_mask;
}
else
{
event->any.type = GDK_MOTION_NOTIFY;
masktest = GDK_POINTER_MOTION_MASK;
if (gdkdev->button_state & (1 << 0))
masktest |= GDK_BUTTON_MOTION_MASK | GDK_BUTTON1_MOTION_MASK;
if (gdkdev->button_state & (1 << 1))
masktest |= GDK_BUTTON_MOTION_MASK | GDK_BUTTON2_MOTION_MASK;
if (gdkdev->button_state & (1 << 2))
masktest |= GDK_BUTTON_MOTION_MASK | GDK_BUTTON3_MOTION_MASK;
}
/* See if input is grabbed */
/* FIXME: x_grab_owner_events should probably be handled somehow */
if (x_grab_window != NULL)
{
grab_obj = GDK_WINDOW_OBJECT (x_grab_window);
if (!GDK_WINDOW_IMPL_WIN32 (grab_obj->impl)->extension_events_selected
|| !(grab_obj->extension_events & masktest)
|| !(x_grab_mask && masktest))
{
GDK_NOTE (EVENTS_OR_INPUT,
g_print ("... grabber doesn't want it\n"));
return FALSE;
}
GDK_NOTE (EVENTS_OR_INPUT, g_print ("... to grabber\n"));
g_object_ref(x_grab_window);
g_object_unref(window);
window = x_grab_window;
obj = grab_obj;
}
/* Now we can check if the window wants the event, and
* propagate if necessary.
*/
loop:
if (!GDK_WINDOW_IMPL_WIN32 (obj->impl)->extension_events_selected
|| !(obj->extension_events & masktest))
{
GDK_NOTE (EVENTS_OR_INPUT, g_print ("... not selected\n"));
if (obj->parent == GDK_WINDOW_OBJECT (_gdk_root))
return FALSE;
/* It is not good to propagate the extended events up to the parent
* if this window wants normal (not extended) motion/button events */
if (obj->event_mask & masktest)
{
GDK_NOTE (EVENTS_OR_INPUT,
g_print ("... wants ordinary event, ignoring this\n"));
return FALSE;
}
pt.x = x;
pt.y = y;
ClientToScreen (GDK_WINDOW_HWND (window), &pt);
g_object_unref (window);
window = (GdkWindow *) obj->parent;
obj = GDK_WINDOW_OBJECT (window);
g_object_ref (window);
ScreenToClient (GDK_WINDOW_HWND (window), &pt);
x = pt.x;
y = pt.y;
GDK_NOTE (EVENTS_OR_INPUT, g_print ("... propagating to %p %+d%+d\n",
Massive changes. Too many to list here, but I'll try a summary: 2002-02-17 Tor Lillqvist <tml@iki.fi> * gdk/win32/*.c: Massive changes. Too many to list here, but I'll try a summary: 1) Unify GdkPixmap and GdkImage implementation: For each GdkPixmap, allocate a GdkImage, and vice versa. GdkPixmapImplWin32Data has a pointer to the GdkImage. GdkImage::windowing_data is a pointer to the GdkPixmap. This simplifies many pixmap and image related functions a lot, and reduces duplicated code snippets. For instance, there is only one place in gdk/win32 where CreateDIBSection() is called, in the function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap) to a Windows region is almost trivial, with the bitmap bits being readily accessible in the associated GdkImage. All blitting between GdkPixmaps, GdkWindows and GdkImages goes through handled the _gdk_win32_blit() function, which calls different functions to handle the cases of blitting from pixmaps, inside windows (scrolling), or from windows, which all require somewhat different handling. 2) Support 256-color mode. This has long been very broken, now it works more or less OK. Keep the logical palette for each colormap as small as possible while allocating and freeing colors. Select and realize the logical palette associated with a GdkColormap into a DC before drawing or blitting. When the display is in 256-color mode, make it possible for the user to override the size of the palette(s) used with either the GDK_WIN32_MAX_COLORS environment variable, or a -max-colors command line option. It is possible to reduce the palette size all the way down to using just the 16 static colors (which causes the system visual to be of type GDK_VISUAL_STATIC_COLOR. This could possibly be useful if one desperately wants to avoid color flashing. (Note that in order for this to work properly, an as of yet not commited fix to gdkrgb.c is needed.) Handle the palette messages. On WM_PALETTECHANGED, call UpdateColors() for the given window hierarchy. Do this only if a window in some other top-level window hierarchy caused the palette change (realized a palette). Do this max five times in a row (an arbitrarily chosen limit), though, otherwise redraw by generating expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole window hierarchy by generating GDK_EXPOSE events. 3) Code cleanup in general. For instance, remove the "emulated" X11 structs ColormapStruct, Visual and XStandardColormap. Use the new GDK_DEBUG_* flags for debugging output in the relevant source files. Remove the unused colormap hash table in gdkcolor-win32.c 4) Plug some resource leaks. 2002-02-14 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use g_filename_to_uri() to actually create legal URIs in the text/uri-list data.
2002-02-17 00:25:05 +00:00
GDK_WINDOW_HWND (window), x, y));
goto loop;
}
input_window = _gdk_input_window_find (window);
g_assert (input_window != NULL);
if (gdkdev->info.mode == GDK_MODE_WINDOW
&& input_window->mode == GDK_EXTENSION_EVENTS_CURSOR)
return FALSE;
event->any.window = window;
key_state = get_modifier_key_state ();
if (event->any.type == GDK_BUTTON_PRESS
|| event->any.type == GDK_BUTTON_RELEASE)
{
gdk/win32/gdkprivate-win32.h Rename all global variables and functions to 2002-11-12 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkprivate-win32.h * gdk/win32/*.c: Rename all global variables and functions to start with underscore. Merge from stable: More work on the Win32 backend. The cause of some scrolling problems was that SetWindowPos() and ScrollWindowEx() don't blit those parts of the window they think are invalid. As we didn't keep Windows's update region in synch with GDK's, Windows thought those areas that in fact had been updated were invalid. Calling ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to be an elegant and efficient solution, removing from Windows's update region those areas we are about to repaint proactively. In some cases garbage leftover values were used for the clip origin in GdkGCWin32. This showed up as odd blank areas around the pixmaps included in the Text Widget in gtk-demo. Having the clip region either as a GdkRegion or a HRGN in GdkGCWin32 was unnecessary, it's better to just use a HRGN. The translation and antiexpose queue handling in gdkgeometry-win32.c seems unnecessary (and not implementable in the same way as on X11 anyway, no serial numbers) on Windows, ifdeffed out. Don't (try to) do guffaw scrolling as there is no static window gravity on Windows. Guffaw scrolling would be unnecessary anyway, as there is the ScrollWindow() API. This improves the behaviour of the Text Widget demo in gtk-demo a lot. But I have no idea how the lack of static win gravity should be handled in other places where the X11 code uses it. Especially _gdk_window_move_resize_child(). There is still some problem in expose handling. By moving an obscuring window back and forth over testgtk's main window, for instance, every now and then you typically get narrow vertical or horizontal strips of pixels that haven't been properly redrawn after being exposed. A fencepost error somewhere? Otherwise, all of testgtk and gtk-demo except "big windows" now seem to work pretty well. Bug #79720 should be fixed now. * gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string, gdk_win32_print_paletteentries, gdk_win32_print_system_palette, gdk_win32_print_hpalette) * gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description) * gdk/win32/gdkevents-win32.c (gdk_win32_message_name): Move all debugging helper functions to gdkmain-win32.c. * gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles): Rewrite. Make static. Must take tile origin parameters, too. (gdk_win32_draw_rectangle): Pass the tile/stipple origin to _gdk_win32_draw_tiles(). Remove #if 0 code. (blit_inside_window): Don't call ScrollDC(), that didn't work at all like I thought. A simple call to BitBlt() is enough. * gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused latin_locale_loaded variable. (_gdk_win32_get_next_tick): New function. Used to make sure timestamps of events are always increasing, both in events generated from the window procedure and in events gotten via PeekMessage(). Not sure whether this is actually useful, but it seemed as a good idea. (real_window_procedure): Don't use a local GdkEventPrivate variable. Don't attempt any compression of configure or expose events here, handled elsewhere. (erase_background): Accumulate window offsets when traversing up the parent chain for GDK_PARENT_RELATIVE_BG, in order to get correct alignment of background pixmaps. Don't fill with BLACK_BRUSH if GDK_NO_BG. (gdk_event_get_graphics_expose): A bit more verbose debugging output. (gdk_event_translate): Use _gdk_win32_get_next_tick(). In the WM_PAINT handler, don't check for empty update rect. When we get a WM_PAINT, the update region isn't empty. And if it for some strange reason is, that will be handled later anyway. Call GetUpdateRgn() before calling BeginPaint() and EndPaint() (which empty the update region). * gdk/win32/gdkdnd-win32.c * gdk/win32/gdkinput-win32.c: Use _gdk_win32_get_next_tick(). * gdk/win32/gdkfont-win32.c: Use %p to print HFONTs. (gdk_text_size): Remove, unused. * gdk/win32/gdkgc-win32.c: Set clip origins to zero when appropriate. (gdk_gc_copy): Increase refcount on colormap if present. (gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple, combine it with clip region after selecting into the DC. (_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region. (_gdk_win3_gdkregion_to_hrgn): New function, code snippet extracted from gdk_win32_hdc_get(). * gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue handling. (gdk_window_copy_area_scroll): Increase clipRect to avoid ScrollWindowEx() not scrolling pixels it thinks are invalid. Scroll also children with the ScrollWindowEx() call. No need to call gdk_window_move() on the children. (gdk_window_scroll): Don't do guffaw scrolling. (gdk_window_compute_position): Fix typo, used win32_y where x was intended. (gdk_window_premove, gdk_window_postmove, gdk_window_clip_changed): Add debugging output. (_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn() on the region. (_gdk_window_process_expose): No use for the serial number parameter now. Instead of a rectangle, take a region parameter, as Windows gives us one in WM_PAINT. * gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string, _gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string, _gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string, _gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string, _gdk_win32_gdkregion_to_string): New debugging functions. (static_printf): Helper function for the above. sprintfs into a static circular buffer, return value should be used "soon". * gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory leak, free list after use. (gdk_window_gravity_works): Remove, we know that there is no such thing on Windows. (gdk_window_set_static_bit_gravity, gdk_window_set_static_win_gravity): Ditto, remove, they didn't do anything anyway. (_gdk_windowing_window_init, gdk_window_foreign_new): Call _gdk_window_init_position() like in the X11 backend. (gdk_window_reparent): Don't call the now nonexistent gdk_window_set_static_win_gravity(). No idea what should be done instead. (gdk_window_get_geometry): The returned x and y should be relative to parent. Used to be always zero.. (gdk_window_set_static_gravities): Return FALSE if trying to set static gravity. * gdk/win32/gdkprivate-win32.h: Drop the clip_region field from GdkGCWin32. Only use the HRGN hcliprgn. Declare new functions. * gdk/win32/*.c: Use new debugging functions. * gdk/win32/rc/gdk.rc.in: Update copyright year.
2002-11-12 22:17:48 +00:00
event->button.time = _gdk_win32_get_next_tick (msg->time);
event->button.device = &gdkdev->info;
event->button.axes = g_new(gdouble, gdkdev->info.num_axes);
gdk_input_translate_coordinates (gdkdev, input_window,
gdkdev->last_axis_data,
event->button.axes,
&event->button.x,
&event->button.y);
/* Also calculate root coordinates. Note that input_window->root_x
is in GDK root coordinates. */
event->button.x_root = event->button.x + input_window->root_x;
event->button.y_root = event->button.y + input_window->root_y;
event->button.state = ((gdkdev->button_state << 8)
& (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK
| GDK_BUTTON3_MASK | GDK_BUTTON4_MASK
| GDK_BUTTON5_MASK))
| key_state;
Massive changes. Too many to list here, but I'll try a summary: 2002-02-17 Tor Lillqvist <tml@iki.fi> * gdk/win32/*.c: Massive changes. Too many to list here, but I'll try a summary: 1) Unify GdkPixmap and GdkImage implementation: For each GdkPixmap, allocate a GdkImage, and vice versa. GdkPixmapImplWin32Data has a pointer to the GdkImage. GdkImage::windowing_data is a pointer to the GdkPixmap. This simplifies many pixmap and image related functions a lot, and reduces duplicated code snippets. For instance, there is only one place in gdk/win32 where CreateDIBSection() is called, in the function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap) to a Windows region is almost trivial, with the bitmap bits being readily accessible in the associated GdkImage. All blitting between GdkPixmaps, GdkWindows and GdkImages goes through handled the _gdk_win32_blit() function, which calls different functions to handle the cases of blitting from pixmaps, inside windows (scrolling), or from windows, which all require somewhat different handling. 2) Support 256-color mode. This has long been very broken, now it works more or less OK. Keep the logical palette for each colormap as small as possible while allocating and freeing colors. Select and realize the logical palette associated with a GdkColormap into a DC before drawing or blitting. When the display is in 256-color mode, make it possible for the user to override the size of the palette(s) used with either the GDK_WIN32_MAX_COLORS environment variable, or a -max-colors command line option. It is possible to reduce the palette size all the way down to using just the 16 static colors (which causes the system visual to be of type GDK_VISUAL_STATIC_COLOR. This could possibly be useful if one desperately wants to avoid color flashing. (Note that in order for this to work properly, an as of yet not commited fix to gdkrgb.c is needed.) Handle the palette messages. On WM_PALETTECHANGED, call UpdateColors() for the given window hierarchy. Do this only if a window in some other top-level window hierarchy caused the palette change (realized a palette). Do this max five times in a row (an arbitrarily chosen limit), though, otherwise redraw by generating expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole window hierarchy by generating GDK_EXPOSE events. 3) Code cleanup in general. For instance, remove the "emulated" X11 structs ColormapStruct, Visual and XStandardColormap. Use the new GDK_DEBUG_* flags for debugging output in the relevant source files. Remove the unused colormap hash table in gdkcolor-win32.c 4) Plug some resource leaks. 2002-02-14 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use g_filename_to_uri() to actually create legal URIs in the text/uri-list data.
2002-02-17 00:25:05 +00:00
GDK_NOTE (EVENTS_OR_INPUT,
g_print ("WINTAB button %s:%d %g,%g\n",
(event->button.type == GDK_BUTTON_PRESS ?
"press" : "release"),
event->button.button,
event->button.x, event->button.y));
}
else
{
gdk/win32/gdkprivate-win32.h Rename all global variables and functions to 2002-11-12 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkprivate-win32.h * gdk/win32/*.c: Rename all global variables and functions to start with underscore. Merge from stable: More work on the Win32 backend. The cause of some scrolling problems was that SetWindowPos() and ScrollWindowEx() don't blit those parts of the window they think are invalid. As we didn't keep Windows's update region in synch with GDK's, Windows thought those areas that in fact had been updated were invalid. Calling ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to be an elegant and efficient solution, removing from Windows's update region those areas we are about to repaint proactively. In some cases garbage leftover values were used for the clip origin in GdkGCWin32. This showed up as odd blank areas around the pixmaps included in the Text Widget in gtk-demo. Having the clip region either as a GdkRegion or a HRGN in GdkGCWin32 was unnecessary, it's better to just use a HRGN. The translation and antiexpose queue handling in gdkgeometry-win32.c seems unnecessary (and not implementable in the same way as on X11 anyway, no serial numbers) on Windows, ifdeffed out. Don't (try to) do guffaw scrolling as there is no static window gravity on Windows. Guffaw scrolling would be unnecessary anyway, as there is the ScrollWindow() API. This improves the behaviour of the Text Widget demo in gtk-demo a lot. But I have no idea how the lack of static win gravity should be handled in other places where the X11 code uses it. Especially _gdk_window_move_resize_child(). There is still some problem in expose handling. By moving an obscuring window back and forth over testgtk's main window, for instance, every now and then you typically get narrow vertical or horizontal strips of pixels that haven't been properly redrawn after being exposed. A fencepost error somewhere? Otherwise, all of testgtk and gtk-demo except "big windows" now seem to work pretty well. Bug #79720 should be fixed now. * gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string, gdk_win32_print_paletteentries, gdk_win32_print_system_palette, gdk_win32_print_hpalette) * gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description) * gdk/win32/gdkevents-win32.c (gdk_win32_message_name): Move all debugging helper functions to gdkmain-win32.c. * gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles): Rewrite. Make static. Must take tile origin parameters, too. (gdk_win32_draw_rectangle): Pass the tile/stipple origin to _gdk_win32_draw_tiles(). Remove #if 0 code. (blit_inside_window): Don't call ScrollDC(), that didn't work at all like I thought. A simple call to BitBlt() is enough. * gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused latin_locale_loaded variable. (_gdk_win32_get_next_tick): New function. Used to make sure timestamps of events are always increasing, both in events generated from the window procedure and in events gotten via PeekMessage(). Not sure whether this is actually useful, but it seemed as a good idea. (real_window_procedure): Don't use a local GdkEventPrivate variable. Don't attempt any compression of configure or expose events here, handled elsewhere. (erase_background): Accumulate window offsets when traversing up the parent chain for GDK_PARENT_RELATIVE_BG, in order to get correct alignment of background pixmaps. Don't fill with BLACK_BRUSH if GDK_NO_BG. (gdk_event_get_graphics_expose): A bit more verbose debugging output. (gdk_event_translate): Use _gdk_win32_get_next_tick(). In the WM_PAINT handler, don't check for empty update rect. When we get a WM_PAINT, the update region isn't empty. And if it for some strange reason is, that will be handled later anyway. Call GetUpdateRgn() before calling BeginPaint() and EndPaint() (which empty the update region). * gdk/win32/gdkdnd-win32.c * gdk/win32/gdkinput-win32.c: Use _gdk_win32_get_next_tick(). * gdk/win32/gdkfont-win32.c: Use %p to print HFONTs. (gdk_text_size): Remove, unused. * gdk/win32/gdkgc-win32.c: Set clip origins to zero when appropriate. (gdk_gc_copy): Increase refcount on colormap if present. (gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple, combine it with clip region after selecting into the DC. (_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region. (_gdk_win3_gdkregion_to_hrgn): New function, code snippet extracted from gdk_win32_hdc_get(). * gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue handling. (gdk_window_copy_area_scroll): Increase clipRect to avoid ScrollWindowEx() not scrolling pixels it thinks are invalid. Scroll also children with the ScrollWindowEx() call. No need to call gdk_window_move() on the children. (gdk_window_scroll): Don't do guffaw scrolling. (gdk_window_compute_position): Fix typo, used win32_y where x was intended. (gdk_window_premove, gdk_window_postmove, gdk_window_clip_changed): Add debugging output. (_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn() on the region. (_gdk_window_process_expose): No use for the serial number parameter now. Instead of a rectangle, take a region parameter, as Windows gives us one in WM_PAINT. * gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string, _gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string, _gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string, _gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string, _gdk_win32_gdkregion_to_string): New debugging functions. (static_printf): Helper function for the above. sprintfs into a static circular buffer, return value should be used "soon". * gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory leak, free list after use. (gdk_window_gravity_works): Remove, we know that there is no such thing on Windows. (gdk_window_set_static_bit_gravity, gdk_window_set_static_win_gravity): Ditto, remove, they didn't do anything anyway. (_gdk_windowing_window_init, gdk_window_foreign_new): Call _gdk_window_init_position() like in the X11 backend. (gdk_window_reparent): Don't call the now nonexistent gdk_window_set_static_win_gravity(). No idea what should be done instead. (gdk_window_get_geometry): The returned x and y should be relative to parent. Used to be always zero.. (gdk_window_set_static_gravities): Return FALSE if trying to set static gravity. * gdk/win32/gdkprivate-win32.h: Drop the clip_region field from GdkGCWin32. Only use the HRGN hcliprgn. Declare new functions. * gdk/win32/*.c: Use new debugging functions. * gdk/win32/rc/gdk.rc.in: Update copyright year.
2002-11-12 22:17:48 +00:00
event->motion.time = _gdk_win32_get_next_tick (msg->time);
event->motion.is_hint = FALSE;
event->motion.device = &gdkdev->info;
event->motion.axes = g_new(gdouble, gdkdev->info.num_axes);
gdk_input_translate_coordinates (gdkdev, input_window,
gdkdev->last_axis_data,
event->motion.axes,
&event->motion.x,
&event->motion.y);
/* Also calculate root coordinates. Note that input_window->root_x
is in GDK root coordinates. */
event->motion.x_root = event->motion.x + input_window->root_x;
event->motion.y_root = event->motion.y + input_window->root_y;
event->motion.state = ((gdkdev->button_state << 8)
& (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK
| GDK_BUTTON3_MASK | GDK_BUTTON4_MASK
| GDK_BUTTON5_MASK))
| key_state;
Massive changes. Too many to list here, but I'll try a summary: 2002-02-17 Tor Lillqvist <tml@iki.fi> * gdk/win32/*.c: Massive changes. Too many to list here, but I'll try a summary: 1) Unify GdkPixmap and GdkImage implementation: For each GdkPixmap, allocate a GdkImage, and vice versa. GdkPixmapImplWin32Data has a pointer to the GdkImage. GdkImage::windowing_data is a pointer to the GdkPixmap. This simplifies many pixmap and image related functions a lot, and reduces duplicated code snippets. For instance, there is only one place in gdk/win32 where CreateDIBSection() is called, in the function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap) to a Windows region is almost trivial, with the bitmap bits being readily accessible in the associated GdkImage. All blitting between GdkPixmaps, GdkWindows and GdkImages goes through handled the _gdk_win32_blit() function, which calls different functions to handle the cases of blitting from pixmaps, inside windows (scrolling), or from windows, which all require somewhat different handling. 2) Support 256-color mode. This has long been very broken, now it works more or less OK. Keep the logical palette for each colormap as small as possible while allocating and freeing colors. Select and realize the logical palette associated with a GdkColormap into a DC before drawing or blitting. When the display is in 256-color mode, make it possible for the user to override the size of the palette(s) used with either the GDK_WIN32_MAX_COLORS environment variable, or a -max-colors command line option. It is possible to reduce the palette size all the way down to using just the 16 static colors (which causes the system visual to be of type GDK_VISUAL_STATIC_COLOR. This could possibly be useful if one desperately wants to avoid color flashing. (Note that in order for this to work properly, an as of yet not commited fix to gdkrgb.c is needed.) Handle the palette messages. On WM_PALETTECHANGED, call UpdateColors() for the given window hierarchy. Do this only if a window in some other top-level window hierarchy caused the palette change (realized a palette). Do this max five times in a row (an arbitrarily chosen limit), though, otherwise redraw by generating expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole window hierarchy by generating GDK_EXPOSE events. 3) Code cleanup in general. For instance, remove the "emulated" X11 structs ColormapStruct, Visual and XStandardColormap. Use the new GDK_DEBUG_* flags for debugging output in the relevant source files. Remove the unused colormap hash table in gdkcolor-win32.c 4) Plug some resource leaks. 2002-02-14 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use g_filename_to_uri() to actually create legal URIs in the text/uri-list data.
2002-02-17 00:25:05 +00:00
GDK_NOTE (EVENTS_OR_INPUT,
g_print ("WINTAB motion: %g,%g\n",
event->motion.x, event->motion.y));
}
return TRUE;
case WT_PROXIMITY:
if (LOWORD (msg->lParam) == 0)
{
event->proximity.type = GDK_PROXIMITY_OUT;
set_ignore_core (FALSE);
}
else
{
event->proximity.type = GDK_PROXIMITY_IN;
set_ignore_core (TRUE);
}
gdk/win32/gdkprivate-win32.h Rename all global variables and functions to 2002-11-12 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkprivate-win32.h * gdk/win32/*.c: Rename all global variables and functions to start with underscore. Merge from stable: More work on the Win32 backend. The cause of some scrolling problems was that SetWindowPos() and ScrollWindowEx() don't blit those parts of the window they think are invalid. As we didn't keep Windows's update region in synch with GDK's, Windows thought those areas that in fact had been updated were invalid. Calling ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to be an elegant and efficient solution, removing from Windows's update region those areas we are about to repaint proactively. In some cases garbage leftover values were used for the clip origin in GdkGCWin32. This showed up as odd blank areas around the pixmaps included in the Text Widget in gtk-demo. Having the clip region either as a GdkRegion or a HRGN in GdkGCWin32 was unnecessary, it's better to just use a HRGN. The translation and antiexpose queue handling in gdkgeometry-win32.c seems unnecessary (and not implementable in the same way as on X11 anyway, no serial numbers) on Windows, ifdeffed out. Don't (try to) do guffaw scrolling as there is no static window gravity on Windows. Guffaw scrolling would be unnecessary anyway, as there is the ScrollWindow() API. This improves the behaviour of the Text Widget demo in gtk-demo a lot. But I have no idea how the lack of static win gravity should be handled in other places where the X11 code uses it. Especially _gdk_window_move_resize_child(). There is still some problem in expose handling. By moving an obscuring window back and forth over testgtk's main window, for instance, every now and then you typically get narrow vertical or horizontal strips of pixels that haven't been properly redrawn after being exposed. A fencepost error somewhere? Otherwise, all of testgtk and gtk-demo except "big windows" now seem to work pretty well. Bug #79720 should be fixed now. * gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string, gdk_win32_print_paletteentries, gdk_win32_print_system_palette, gdk_win32_print_hpalette) * gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description) * gdk/win32/gdkevents-win32.c (gdk_win32_message_name): Move all debugging helper functions to gdkmain-win32.c. * gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles): Rewrite. Make static. Must take tile origin parameters, too. (gdk_win32_draw_rectangle): Pass the tile/stipple origin to _gdk_win32_draw_tiles(). Remove #if 0 code. (blit_inside_window): Don't call ScrollDC(), that didn't work at all like I thought. A simple call to BitBlt() is enough. * gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused latin_locale_loaded variable. (_gdk_win32_get_next_tick): New function. Used to make sure timestamps of events are always increasing, both in events generated from the window procedure and in events gotten via PeekMessage(). Not sure whether this is actually useful, but it seemed as a good idea. (real_window_procedure): Don't use a local GdkEventPrivate variable. Don't attempt any compression of configure or expose events here, handled elsewhere. (erase_background): Accumulate window offsets when traversing up the parent chain for GDK_PARENT_RELATIVE_BG, in order to get correct alignment of background pixmaps. Don't fill with BLACK_BRUSH if GDK_NO_BG. (gdk_event_get_graphics_expose): A bit more verbose debugging output. (gdk_event_translate): Use _gdk_win32_get_next_tick(). In the WM_PAINT handler, don't check for empty update rect. When we get a WM_PAINT, the update region isn't empty. And if it for some strange reason is, that will be handled later anyway. Call GetUpdateRgn() before calling BeginPaint() and EndPaint() (which empty the update region). * gdk/win32/gdkdnd-win32.c * gdk/win32/gdkinput-win32.c: Use _gdk_win32_get_next_tick(). * gdk/win32/gdkfont-win32.c: Use %p to print HFONTs. (gdk_text_size): Remove, unused. * gdk/win32/gdkgc-win32.c: Set clip origins to zero when appropriate. (gdk_gc_copy): Increase refcount on colormap if present. (gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple, combine it with clip region after selecting into the DC. (_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region. (_gdk_win3_gdkregion_to_hrgn): New function, code snippet extracted from gdk_win32_hdc_get(). * gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue handling. (gdk_window_copy_area_scroll): Increase clipRect to avoid ScrollWindowEx() not scrolling pixels it thinks are invalid. Scroll also children with the ScrollWindowEx() call. No need to call gdk_window_move() on the children. (gdk_window_scroll): Don't do guffaw scrolling. (gdk_window_compute_position): Fix typo, used win32_y where x was intended. (gdk_window_premove, gdk_window_postmove, gdk_window_clip_changed): Add debugging output. (_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn() on the region. (_gdk_window_process_expose): No use for the serial number parameter now. Instead of a rectangle, take a region parameter, as Windows gives us one in WM_PAINT. * gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string, _gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string, _gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string, _gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string, _gdk_win32_gdkregion_to_string): New debugging functions. (static_printf): Helper function for the above. sprintfs into a static circular buffer, return value should be used "soon". * gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory leak, free list after use. (gdk_window_gravity_works): Remove, we know that there is no such thing on Windows. (gdk_window_set_static_bit_gravity, gdk_window_set_static_win_gravity): Ditto, remove, they didn't do anything anyway. (_gdk_windowing_window_init, gdk_window_foreign_new): Call _gdk_window_init_position() like in the X11 backend. (gdk_window_reparent): Don't call the now nonexistent gdk_window_set_static_win_gravity(). No idea what should be done instead. (gdk_window_get_geometry): The returned x and y should be relative to parent. Used to be always zero.. (gdk_window_set_static_gravities): Return FALSE if trying to set static gravity. * gdk/win32/gdkprivate-win32.h: Drop the clip_region field from GdkGCWin32. Only use the HRGN hcliprgn. Declare new functions. * gdk/win32/*.c: Use new debugging functions. * gdk/win32/rc/gdk.rc.in: Update copyright year.
2002-11-12 22:17:48 +00:00
event->proximity.time = _gdk_win32_get_next_tick (msg->time);
event->proximity.device = &gdkdev->info;
Massive changes. Too many to list here, but I'll try a summary: 2002-02-17 Tor Lillqvist <tml@iki.fi> * gdk/win32/*.c: Massive changes. Too many to list here, but I'll try a summary: 1) Unify GdkPixmap and GdkImage implementation: For each GdkPixmap, allocate a GdkImage, and vice versa. GdkPixmapImplWin32Data has a pointer to the GdkImage. GdkImage::windowing_data is a pointer to the GdkPixmap. This simplifies many pixmap and image related functions a lot, and reduces duplicated code snippets. For instance, there is only one place in gdk/win32 where CreateDIBSection() is called, in the function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap) to a Windows region is almost trivial, with the bitmap bits being readily accessible in the associated GdkImage. All blitting between GdkPixmaps, GdkWindows and GdkImages goes through handled the _gdk_win32_blit() function, which calls different functions to handle the cases of blitting from pixmaps, inside windows (scrolling), or from windows, which all require somewhat different handling. 2) Support 256-color mode. This has long been very broken, now it works more or less OK. Keep the logical palette for each colormap as small as possible while allocating and freeing colors. Select and realize the logical palette associated with a GdkColormap into a DC before drawing or blitting. When the display is in 256-color mode, make it possible for the user to override the size of the palette(s) used with either the GDK_WIN32_MAX_COLORS environment variable, or a -max-colors command line option. It is possible to reduce the palette size all the way down to using just the 16 static colors (which causes the system visual to be of type GDK_VISUAL_STATIC_COLOR. This could possibly be useful if one desperately wants to avoid color flashing. (Note that in order for this to work properly, an as of yet not commited fix to gdkrgb.c is needed.) Handle the palette messages. On WM_PALETTECHANGED, call UpdateColors() for the given window hierarchy. Do this only if a window in some other top-level window hierarchy caused the palette change (realized a palette). Do this max five times in a row (an arbitrarily chosen limit), though, otherwise redraw by generating expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole window hierarchy by generating GDK_EXPOSE events. 3) Code cleanup in general. For instance, remove the "emulated" X11 structs ColormapStruct, Visual and XStandardColormap. Use the new GDK_DEBUG_* flags for debugging output in the relevant source files. Remove the unused colormap hash table in gdkcolor-win32.c 4) Plug some resource leaks. 2002-02-14 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use g_filename_to_uri() to actually create legal URIs in the text/uri-list data.
2002-02-17 00:25:05 +00:00
GDK_NOTE (EVENTS_OR_INPUT,
g_print ("WINTAB proximity %s\n",
(event->proximity.type == GDK_PROXIMITY_IN ?
"in" : "out")));
return TRUE;
}
return FALSE;
}
gboolean
_gdk_input_enable_window (GdkWindow *window,
GdkDevicePrivate *gdkdev)
{
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
impl->extension_events_selected = TRUE;
return TRUE;
}
gboolean
_gdk_input_disable_window (GdkWindow *window,
GdkDevicePrivate *gdkdev)
{
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
impl->extension_events_selected = FALSE;
return TRUE;
}
gint
_gdk_input_grab_pointer (GdkWindow *window,
gint owner_events,
GdkEventMask event_mask,
GdkWindow *confine_to,
guint32 time)
{
GdkInputWindow *input_window, *new_window;
gboolean need_ungrab;
GdkDevicePrivate *gdkdev;
GList *tmp_list;
Make gdkx.h the only installed header from gdk/x11. All structures in Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com> Make gdkx.h the only installed header from gdk/x11. All structures in gdk/x11 are opaque. * gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h: Don't install gdk{drawable,pixmap,window}-x11.h. * gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c: Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11, GdkVisualClass into C files. * gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static. * gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c, gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c} Add public functions to replace previously exported direct structure access. gdk_x11_colormap_get_{xdisplay,xcolormap} gdk_x11_cursor_get_{xdisplay,xcursor}, gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual, gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage}, gdk_x11_gc_get_{xdisplay,ximage} * gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo, GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals. Fix a number of variables and functions that were exported "accidentally" from GDK. * gdk/**.[ch]: gdk => _gdk for gdk_visual_init, gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit, gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data, gdk_event_notify, gdk_queued_events, gdk_queued_tail, gdk_event_new, gdk_events_queue, gdk_events_unqueue, gdk_event_queue_find_first, gdk_event_queue_remove_link, gdk_event_queue_append, gdk_event_button_generate, gdk_debug_flags, gdk_default_filters, gdk_parent_root. * gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c, gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}: gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks, gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window, gdk_use_xshm, gdk_input_ignore_core. * gdk/x11/xsettings-common.h (xsettings_list_insert): Add #defines to namespace functions into the private _gdk_ namespace. * gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window () to replace gdk_parent_root exported variable. Adjust and deprecate GDK_ROOT_PARENT(). * demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix GDK_ROOT_PARENT usage, remove includes of port-specific headers. * gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for _gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core, gdk_input_devices, _gdk_input_windows, gdk_init_input_core. * gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c} docs/Changes-2.0.txt: Remove gdk_wm_protocols, gdk_wm_delete_window functions, gdk_wm_take_focus, use gdk_atom_intern() instead. * gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h} gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h} gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h} gtk/gtkselection.c Unexport gdk_selection_property, just use gdk_atom_intern ("GDK_SELECTION"). * gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}: Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type, GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate, GdkVisualprivate, gdk_x11_gc_flush. Make a number of public exports of variables into functions to increase encapsulation. * gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer, move to gdkinternals.h. Add gdk_device_get_core_pointer (). * gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code, gdk_error_warnings. * gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h} docs/Changes-2.0.txt: s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen() s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow() Add gdk_x11_get_default_xdisplay(). * gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class, Don't export gdk_progclass, move --class command line option and handling to common portion of GDK. Miscellaneous fixes: * gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix g_return_val_if_fail that should have been g_return_if_fail. * gdk/gdkinternals.h gdk/gdkprivate.h: Move gdk_synthesize_window_state() to the semi-public gdkprivate.h. * gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded X11 dependency. * gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO: Remove unused gdk_key_repeat_disable/restore. * linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def: Remove unused gdk_null_window_warnings variable. * gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox; it can be retrieved from the repository; it is too far from functional to be worth having people check out; it would be easier to start from scratch, I suspect. * gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID(). * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. Add some space for future expansion to multihead. * gdk/gdkdrawable.h: Add four reserved function pointers for future expansion of GdkDrawableClass. * gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
tmp_list = _gdk_input_windows;
new_window = NULL;
need_ungrab = FALSE;
GDK_NOTE (INPUT, g_print ("_gdk_input_grab_pointer: %p %d %p\n",
Bypass calls to the grab/ungrab functions in gdkinput-win32.c, as they 2002-03-06 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkevents-win32.c (gdk_pointer_grab, gdk_pointer_ungrab): Bypass calls to the grab/ungrab functions in gdkinput-win32.c, as they don't effectively do anything anyway. (build_key_event_state): Set MOD2 bit if key is in AltGr group. (gdk_event_translate): Call _gdk_windowing_window_get_offsets() each time the offsets are used, on the window they refer to, instead of once in the beginning. The window in question might change due to event propagation. (gdk_event_translate): Set key event group to 0 for non-AltGr keys. Do set the SHIFT bit in the key event state also for ISO_Left_Tab. Now backtabbing finally works again. * gdk/win32/gdkunput-win32.c: Minor debugging output change. * gdk/win32/gdkkeys-win32.c (update_keymap): Set VK_TAB mapping to Gdk_Tab and GDK_ISO_Left_Tab, like on X11. (gdk_keymap_translate_keyboard_state): Add similar code as in the non-XKB case on X11 to generate a more correct consumed_modifiers. Add debugging output. (gdk_keyval_name): Use the U+xxxx format for UCS characters encoded as keyvals. Never return NULL, but hex number representation if keyval not in table. * gdk/win32/gdkwindow-win32.c (gdk_window_focus): Call SetFocus(). Doesn't seem to have any harmful effect, and probably is close to what this function is supposed to do. But it didn't fix GtkCombo as I had hoped. (gdk_window_set_type_hint): Don't intern the _NET_WM_* atoms that weren't used and wouldn't have any meaning on Win32 anyway.
2002-03-06 00:36:08 +00:00
GDK_WINDOW_HWND (window),
owner_events,
Bypass calls to the grab/ungrab functions in gdkinput-win32.c, as they 2002-03-06 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkevents-win32.c (gdk_pointer_grab, gdk_pointer_ungrab): Bypass calls to the grab/ungrab functions in gdkinput-win32.c, as they don't effectively do anything anyway. (build_key_event_state): Set MOD2 bit if key is in AltGr group. (gdk_event_translate): Call _gdk_windowing_window_get_offsets() each time the offsets are used, on the window they refer to, instead of once in the beginning. The window in question might change due to event propagation. (gdk_event_translate): Set key event group to 0 for non-AltGr keys. Do set the SHIFT bit in the key event state also for ISO_Left_Tab. Now backtabbing finally works again. * gdk/win32/gdkunput-win32.c: Minor debugging output change. * gdk/win32/gdkkeys-win32.c (update_keymap): Set VK_TAB mapping to Gdk_Tab and GDK_ISO_Left_Tab, like on X11. (gdk_keymap_translate_keyboard_state): Add similar code as in the non-XKB case on X11 to generate a more correct consumed_modifiers. Add debugging output. (gdk_keyval_name): Use the U+xxxx format for UCS characters encoded as keyvals. Never return NULL, but hex number representation if keyval not in table. * gdk/win32/gdkwindow-win32.c (gdk_window_focus): Call SetFocus(). Doesn't seem to have any harmful effect, and probably is close to what this function is supposed to do. But it didn't fix GtkCombo as I had hoped. (gdk_window_set_type_hint): Don't intern the _NET_WM_* atoms that weren't used and wouldn't have any meaning on Win32 anyway.
2002-03-06 00:36:08 +00:00
(confine_to ? GDK_WINDOW_HWND (confine_to) : 0)));
while (tmp_list)
{
input_window = (GdkInputWindow *)tmp_list->data;
if (input_window->window == window)
new_window = input_window;
else if (input_window->grabbed)
{
input_window->grabbed = FALSE;
need_ungrab = TRUE;
}
tmp_list = tmp_list->next;
}
if (new_window)
{
new_window->grabbed = TRUE;
x_grab_window = window;
x_grab_mask = event_mask;
x_grab_owner_events = owner_events;
/* FIXME: Do we need to handle confine_to and time? */
Make gdkx.h the only installed header from gdk/x11. All structures in Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com> Make gdkx.h the only installed header from gdk/x11. All structures in gdk/x11 are opaque. * gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h: Don't install gdk{drawable,pixmap,window}-x11.h. * gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c: Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11, GdkVisualClass into C files. * gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static. * gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c, gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c} Add public functions to replace previously exported direct structure access. gdk_x11_colormap_get_{xdisplay,xcolormap} gdk_x11_cursor_get_{xdisplay,xcursor}, gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual, gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage}, gdk_x11_gc_get_{xdisplay,ximage} * gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo, GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals. Fix a number of variables and functions that were exported "accidentally" from GDK. * gdk/**.[ch]: gdk => _gdk for gdk_visual_init, gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit, gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data, gdk_event_notify, gdk_queued_events, gdk_queued_tail, gdk_event_new, gdk_events_queue, gdk_events_unqueue, gdk_event_queue_find_first, gdk_event_queue_remove_link, gdk_event_queue_append, gdk_event_button_generate, gdk_debug_flags, gdk_default_filters, gdk_parent_root. * gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c, gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}: gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks, gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window, gdk_use_xshm, gdk_input_ignore_core. * gdk/x11/xsettings-common.h (xsettings_list_insert): Add #defines to namespace functions into the private _gdk_ namespace. * gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window () to replace gdk_parent_root exported variable. Adjust and deprecate GDK_ROOT_PARENT(). * demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix GDK_ROOT_PARENT usage, remove includes of port-specific headers. * gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for _gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core, gdk_input_devices, _gdk_input_windows, gdk_init_input_core. * gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c} docs/Changes-2.0.txt: Remove gdk_wm_protocols, gdk_wm_delete_window functions, gdk_wm_take_focus, use gdk_atom_intern() instead. * gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h} gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h} gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h} gtk/gtkselection.c Unexport gdk_selection_property, just use gdk_atom_intern ("GDK_SELECTION"). * gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}: Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type, GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate, GdkVisualprivate, gdk_x11_gc_flush. Make a number of public exports of variables into functions to increase encapsulation. * gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer, move to gdkinternals.h. Add gdk_device_get_core_pointer (). * gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code, gdk_error_warnings. * gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h} docs/Changes-2.0.txt: s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen() s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow() Add gdk_x11_get_default_xdisplay(). * gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class, Don't export gdk_progclass, move --class command line option and handling to common portion of GDK. Miscellaneous fixes: * gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix g_return_val_if_fail that should have been g_return_if_fail. * gdk/gdkinternals.h gdk/gdkprivate.h: Move gdk_synthesize_window_state() to the semi-public gdkprivate.h. * gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded X11 dependency. * gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO: Remove unused gdk_key_repeat_disable/restore. * linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def: Remove unused gdk_null_window_warnings variable. * gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox; it can be retrieved from the repository; it is too far from functional to be worth having people check out; it would be easier to start from scratch, I suspect. * gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID(). * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. Add some space for future expansion to multihead. * gdk/gdkdrawable.h: Add four reserved function pointers for future expansion of GdkDrawableClass. * gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
tmp_list = _gdk_input_devices;
while (tmp_list)
{
gdkdev = (GdkDevicePrivate *)tmp_list->data;
if (!GDK_IS_CORE (gdkdev) && gdkdev->hctx)
{
#if 0
/* XXX */
gdk_input_common_find_events (window, gdkdev,
event_mask,
event_classes, &num_classes);
result = XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
GDK_WINDOW_XWINDOW (window),
owner_events, num_classes, event_classes,
GrabModeAsync, GrabModeAsync, time);
/* FIXME: if failure occurs on something other than the first
device, things will be badly inconsistent */
if (result != Success)
return result;
#endif
}
tmp_list = tmp_list->next;
}
}
else
{
x_grab_window = NULL;
#if 0
tmp_list = _gdk_input_devices;
while (tmp_list)
{
gdkdev = (GdkDevicePrivate *)tmp_list->data;
if (!GDK_IS_CORE (gdkdev) && gdkdev->hctx &&
((gdkdev->button_state != 0) || need_ungrab))
{
#if 0
/* XXX */
XUngrabDevice (gdk_display, gdkdev->xdevice, time);
#endif
gdkdev->button_state = 0;
}
tmp_list = tmp_list->next;
}
#endif
}
return GDK_GRAB_SUCCESS;
}
void
_gdk_input_ungrab_pointer (guint32 time)
{
GdkInputWindow *input_window;
GdkDevicePrivate *gdkdev;
GList *tmp_list;
GDK_NOTE (INPUT, g_print ("_gdk_input_ungrab_pointer\n"));
Make gdkx.h the only installed header from gdk/x11. All structures in Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com> Make gdkx.h the only installed header from gdk/x11. All structures in gdk/x11 are opaque. * gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h: Don't install gdk{drawable,pixmap,window}-x11.h. * gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c: Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11, GdkVisualClass into C files. * gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static. * gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c, gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c} Add public functions to replace previously exported direct structure access. gdk_x11_colormap_get_{xdisplay,xcolormap} gdk_x11_cursor_get_{xdisplay,xcursor}, gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual, gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage}, gdk_x11_gc_get_{xdisplay,ximage} * gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo, GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals. Fix a number of variables and functions that were exported "accidentally" from GDK. * gdk/**.[ch]: gdk => _gdk for gdk_visual_init, gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit, gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data, gdk_event_notify, gdk_queued_events, gdk_queued_tail, gdk_event_new, gdk_events_queue, gdk_events_unqueue, gdk_event_queue_find_first, gdk_event_queue_remove_link, gdk_event_queue_append, gdk_event_button_generate, gdk_debug_flags, gdk_default_filters, gdk_parent_root. * gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c, gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}: gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks, gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window, gdk_use_xshm, gdk_input_ignore_core. * gdk/x11/xsettings-common.h (xsettings_list_insert): Add #defines to namespace functions into the private _gdk_ namespace. * gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window () to replace gdk_parent_root exported variable. Adjust and deprecate GDK_ROOT_PARENT(). * demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix GDK_ROOT_PARENT usage, remove includes of port-specific headers. * gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for _gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core, gdk_input_devices, _gdk_input_windows, gdk_init_input_core. * gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c} docs/Changes-2.0.txt: Remove gdk_wm_protocols, gdk_wm_delete_window functions, gdk_wm_take_focus, use gdk_atom_intern() instead. * gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h} gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h} gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h} gtk/gtkselection.c Unexport gdk_selection_property, just use gdk_atom_intern ("GDK_SELECTION"). * gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}: Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type, GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate, GdkVisualprivate, gdk_x11_gc_flush. Make a number of public exports of variables into functions to increase encapsulation. * gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer, move to gdkinternals.h. Add gdk_device_get_core_pointer (). * gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code, gdk_error_warnings. * gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h} docs/Changes-2.0.txt: s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen() s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow() Add gdk_x11_get_default_xdisplay(). * gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class, Don't export gdk_progclass, move --class command line option and handling to common portion of GDK. Miscellaneous fixes: * gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix g_return_val_if_fail that should have been g_return_if_fail. * gdk/gdkinternals.h gdk/gdkprivate.h: Move gdk_synthesize_window_state() to the semi-public gdkprivate.h. * gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded X11 dependency. * gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO: Remove unused gdk_key_repeat_disable/restore. * linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def: Remove unused gdk_null_window_warnings variable. * gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox; it can be retrieved from the repository; it is too far from functional to be worth having people check out; it would be easier to start from scratch, I suspect. * gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID(). * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. Add some space for future expansion to multihead. * gdk/gdkdrawable.h: Add four reserved function pointers for future expansion of GdkDrawableClass. * gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
tmp_list = _gdk_input_windows;
while (tmp_list)
{
input_window = (GdkInputWindow *)tmp_list->data;
if (input_window->grabbed)
break;
tmp_list = tmp_list->next;
}
if (tmp_list) /* we found a grabbed window */
{
input_window->grabbed = FALSE;
Make gdkx.h the only installed header from gdk/x11. All structures in Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com> Make gdkx.h the only installed header from gdk/x11. All structures in gdk/x11 are opaque. * gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h: Don't install gdk{drawable,pixmap,window}-x11.h. * gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c: Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11, GdkVisualClass into C files. * gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static. * gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c, gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c} Add public functions to replace previously exported direct structure access. gdk_x11_colormap_get_{xdisplay,xcolormap} gdk_x11_cursor_get_{xdisplay,xcursor}, gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual, gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage}, gdk_x11_gc_get_{xdisplay,ximage} * gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo, GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals. Fix a number of variables and functions that were exported "accidentally" from GDK. * gdk/**.[ch]: gdk => _gdk for gdk_visual_init, gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit, gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data, gdk_event_notify, gdk_queued_events, gdk_queued_tail, gdk_event_new, gdk_events_queue, gdk_events_unqueue, gdk_event_queue_find_first, gdk_event_queue_remove_link, gdk_event_queue_append, gdk_event_button_generate, gdk_debug_flags, gdk_default_filters, gdk_parent_root. * gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c, gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}: gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks, gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window, gdk_use_xshm, gdk_input_ignore_core. * gdk/x11/xsettings-common.h (xsettings_list_insert): Add #defines to namespace functions into the private _gdk_ namespace. * gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window () to replace gdk_parent_root exported variable. Adjust and deprecate GDK_ROOT_PARENT(). * demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix GDK_ROOT_PARENT usage, remove includes of port-specific headers. * gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for _gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core, gdk_input_devices, _gdk_input_windows, gdk_init_input_core. * gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c} docs/Changes-2.0.txt: Remove gdk_wm_protocols, gdk_wm_delete_window functions, gdk_wm_take_focus, use gdk_atom_intern() instead. * gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h} gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h} gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h} gtk/gtkselection.c Unexport gdk_selection_property, just use gdk_atom_intern ("GDK_SELECTION"). * gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}: Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type, GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate, GdkVisualprivate, gdk_x11_gc_flush. Make a number of public exports of variables into functions to increase encapsulation. * gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer, move to gdkinternals.h. Add gdk_device_get_core_pointer (). * gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code, gdk_error_warnings. * gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h} docs/Changes-2.0.txt: s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen() s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow() Add gdk_x11_get_default_xdisplay(). * gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class, Don't export gdk_progclass, move --class command line option and handling to common portion of GDK. Miscellaneous fixes: * gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix g_return_val_if_fail that should have been g_return_if_fail. * gdk/gdkinternals.h gdk/gdkprivate.h: Move gdk_synthesize_window_state() to the semi-public gdkprivate.h. * gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded X11 dependency. * gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO: Remove unused gdk_key_repeat_disable/restore. * linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def: Remove unused gdk_null_window_warnings variable. * gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox; it can be retrieved from the repository; it is too far from functional to be worth having people check out; it would be easier to start from scratch, I suspect. * gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID(). * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. Add some space for future expansion to multihead. * gdk/gdkdrawable.h: Add four reserved function pointers for future expansion of GdkDrawableClass. * gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
tmp_list = _gdk_input_devices;
while (tmp_list)
{
gdkdev = (GdkDevicePrivate *)tmp_list->data;
#if 0
/* XXX */
if (!GDK_IS_CORE (gdkdev) && gdkdev->xdevice)
XUngrabDevice (gdk_display, gdkdev->xdevice, time);
#endif
tmp_list = tmp_list->next;
}
}
x_grab_window = NULL;
}
gboolean
_gdk_device_get_history (GdkDevice *device,
GdkWindow *window,
guint32 start,
guint32 stop,
GdkTimeCoord ***events,
gint *n_events)
{
return FALSE;
}
void
gdk_device_get_state (GdkDevice *device,
GdkWindow *window,
gdouble *axes,
GdkModifierType *mask)
{
g_return_if_fail (device != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
if (GDK_IS_CORE (device))
{
gint x_int, y_int;
gdk_window_get_pointer (window, &x_int, &y_int, mask);
if (axes)
{
axes[0] = x_int;
axes[1] = y_int;
}
}
else
{
GdkDevicePrivate *gdkdev;
GdkInputWindow *input_window;
gdkdev = (GdkDevicePrivate *)device;
/* For now just use the last known button and axis state of the device.
* Since graphical tablets send an insane amount of motion events each
* second, the info should be fairly up to date */
if (mask)
{
gdk_window_get_pointer (window, NULL, NULL, mask);
*mask &= 0xFF; /* Mask away core pointer buttons */
*mask |= ((gdkdev->button_state << 8)
& (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK
| GDK_BUTTON3_MASK | GDK_BUTTON4_MASK
| GDK_BUTTON5_MASK));
}
input_window = _gdk_input_window_find (window);
g_return_if_fail (input_window != NULL);
/* For some reason, input_window is sometimes NULL when I use The GIMP 2
* (bug #141543?). Avoid crashing if debugging is disabled. */
if (axes && gdkdev->last_axis_data && input_window)
gdk_input_translate_coordinates (gdkdev, input_window,
gdkdev->last_axis_data,
axes, NULL, NULL);
}
}
void
_gdk_input_set_tablet_active (void)
{
GList *tmp_list;
HCTX *hctx;
/* Bring the contexts to the top of the overlap order when one of the
* application's windows is activated */
if (!wintab_contexts)
return; /* No tablet devices found, or Wintab not initialized yet */
GDK_NOTE (INPUT, g_print ("_gdk_input_set_tablet_active: "
"Bringing Wintab contexts to the top of the overlap order\n"));
tmp_list = wintab_contexts;
while (tmp_list)
{
hctx = (HCTX *) (tmp_list->data);
(*p_WTOverlap) (*hctx, TRUE);
tmp_list = tmp_list->next;
}
}
void
_gdk_input_init (GdkDisplay *display)
{
Make gdkx.h the only installed header from gdk/x11. All structures in Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com> Make gdkx.h the only installed header from gdk/x11. All structures in gdk/x11 are opaque. * gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h: Don't install gdk{drawable,pixmap,window}-x11.h. * gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c: Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11, GdkVisualClass into C files. * gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static. * gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c, gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c} Add public functions to replace previously exported direct structure access. gdk_x11_colormap_get_{xdisplay,xcolormap} gdk_x11_cursor_get_{xdisplay,xcursor}, gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual, gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage}, gdk_x11_gc_get_{xdisplay,ximage} * gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo, GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals. Fix a number of variables and functions that were exported "accidentally" from GDK. * gdk/**.[ch]: gdk => _gdk for gdk_visual_init, gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit, gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data, gdk_event_notify, gdk_queued_events, gdk_queued_tail, gdk_event_new, gdk_events_queue, gdk_events_unqueue, gdk_event_queue_find_first, gdk_event_queue_remove_link, gdk_event_queue_append, gdk_event_button_generate, gdk_debug_flags, gdk_default_filters, gdk_parent_root. * gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c, gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}: gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks, gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window, gdk_use_xshm, gdk_input_ignore_core. * gdk/x11/xsettings-common.h (xsettings_list_insert): Add #defines to namespace functions into the private _gdk_ namespace. * gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window () to replace gdk_parent_root exported variable. Adjust and deprecate GDK_ROOT_PARENT(). * demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix GDK_ROOT_PARENT usage, remove includes of port-specific headers. * gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for _gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core, gdk_input_devices, _gdk_input_windows, gdk_init_input_core. * gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c} docs/Changes-2.0.txt: Remove gdk_wm_protocols, gdk_wm_delete_window functions, gdk_wm_take_focus, use gdk_atom_intern() instead. * gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h} gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h} gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h} gtk/gtkselection.c Unexport gdk_selection_property, just use gdk_atom_intern ("GDK_SELECTION"). * gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}: Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type, GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate, GdkVisualprivate, gdk_x11_gc_flush. Make a number of public exports of variables into functions to increase encapsulation. * gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer, move to gdkinternals.h. Add gdk_device_get_core_pointer (). * gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code, gdk_error_warnings. * gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h} docs/Changes-2.0.txt: s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen() s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow() Add gdk_x11_get_default_xdisplay(). * gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class, Don't export gdk_progclass, move --class command line option and handling to common portion of GDK. Miscellaneous fixes: * gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix g_return_val_if_fail that should have been g_return_if_fail. * gdk/gdkinternals.h gdk/gdkprivate.h: Move gdk_synthesize_window_state() to the semi-public gdkprivate.h. * gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded X11 dependency. * gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO: Remove unused gdk_key_repeat_disable/restore. * linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def: Remove unused gdk_null_window_warnings variable. * gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox; it can be retrieved from the repository; it is too far from functional to be worth having people check out; it would be easier to start from scratch, I suspect. * gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID(). * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. Add some space for future expansion to multihead. * gdk/gdkdrawable.h: Add four reserved function pointers for future expansion of GdkDrawableClass. * gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
_gdk_input_ignore_core = FALSE;
_gdk_input_devices = NULL;
_gdk_init_input_core (display);
#ifdef WINTAB_NO_LAZY_INIT
/* Normally, Wintab is only initialized when the application performs
* an action that requires it, such as enabling extended input events
* for a window or enumerating the devices.
*/
_gdk_input_wintab_init_check ();
#endif /* WINTAB_NO_LAZY_INIT */
_gdk_input_devices = g_list_append (_gdk_input_devices, display->core_pointer);
}