Commit Graph

133 Commits

Author SHA1 Message Date
Руслан Ижбулатов
26c24328d5 GDK: Add cursor theme support to W32 backend
Load themed cursors from the same places they are loaded on freedesktop systems,
but use W32 API functions to do so (works for .cur/.ani cursors instead of X
cursors).

Refactor the code for cursor handling. Prefer loading cursors by name.

Do not load actual cursors when loading the theme. Find the files and remember
the arguments/calls for loading them instead. Keeping HCURSOR instance in the
hashmap would result in multiple GdkCursors using the same HCURSOR. Given that
we use DestroyCursor() to off them, this would cause problems (at the very
least - DestroyCursor() would fail).

Store GdkCursor instances in a cache. Update cached cursors when theme changes.

Recognize "system" theme as a special (and default) case. When it is set,
prefer system cursors and fall back to Adwaita cursors and (as a last resort)
built-in X cursors. Otherwise prefer theme cursors and fall back to system and
X cursors.

Force GTK to use "left_ptr" cursor when no cursor is set. Using NULL makes
it use the system default "arrow", which is not the intended behaviour when
a non-system theme is selected.

Ignore cursor size setting and query the OS for the required cursor size, as
Windows (almost) does not allow setting cursors of arbitrary size.

https://bugzilla.gnome.org/show_bug.cgi?id=749287
2015-05-20 08:42:24 +00:00
Руслан Ижбулатов
641fbd86d7 GDK: Use GdkCursor objects to keep track of W32 cursors, not HCURSOR
In particular this means that cursors are disposed of by the way of
g_object_unref(), not DestroyCursor (which is documented to not to be
used on certain kinds of cursors, and we can't tell which is which).

It should also alleviate any concerns about destroying cursors that
are still in use by other windows, except for cases where we would
somehow get our hands on a HCURSOR that someone else is using and we
make a GdkCursor out of it and later unref and finalize it while it
is still in use.

It also removes the need to call CopyCursor(), which makes animated
cursors into non-animated ones as a side-effect (supposed to be a bug,
but try explaining that to MS). Now cursors should be animated (if
the are set up as such in the OS).

https://bugzilla.gnome.org/show_bug.cgi?id=697477
2015-05-20 08:40:43 +00:00
Руслан Ижбулатов
cd54a54346 GDK-W32: remove trailing whitespace everywhere 2015-04-29 21:12:14 +00:00
Руслан Ижбулатов
5ed5d11632 W32: bump _WIN32_WINNT and WINVER to 0x600 (Vista)
Move gdkprivate-win32.h include to ensure that this change affects gdkevents-win32.c
2015-04-29 21:12:14 +00:00
Руслан Ижбулатов
d44921a152 Enable RGBA windows on W32
Requires Vista and newer.

* Create surfaces with cairo_win32_surface_create_with_format
* Provide an rgba visual that can be distinguished from the system visual
* Make rgba visual the best available visual
* Enable alpha-transparency for all windows that we control
* Check for appropriate cairo capabilities at configure time
  (W32 - 1.14.3 newer than 2015-04-14; others - 1.14.0)

* Check for composition support before enabling CSDs
* Re-enable transparency on WM_DWMCOMPOSITIONCHANGED
Windows that were created while composition was enabled and that were CSDed
as a result and will look ugly (thick black borders or no borders at all) once
composition is disabled.
If composition is enabled afterwards, they will return back to normal.
This happens, for example, when RDP session is opened to a desktop where a GTK
application is running. For W7/Vista windows will only re-gain transparency after
the RDP session is closed. For W8 transparency will only be gone momentarily.

Windows that were created while composition was disabled will not be CSDed
automatically and will use SSD (WM decorations), while windows that are CSDed
manually will get a thin square border.
If composition is enabled afterwards, these windows will not change.
This is most noticeable for system menus (popup menus are often generated
on the fly, system menus are created once) and some dialogues (About dialogue,
for example).

https://bugzilla.gnome.org/show_bug.cgi?id=727316
2015-04-29 21:12:13 +00:00
Jose Rostagno
bc1ac40d2a Simplify code a bit after xp support drop
https://bugzilla.gnome.org/show_bug.cgi?id=748156
2015-04-27 06:40:43 -04:00
Руслан Ижбулатов
c0e0a1508b W32: Support horizontal mouse wheel scrolling
https://bugzilla.gnome.org/show_bug.cgi?id=748014
2015-04-17 04:38:34 +00:00
Chun-wei Fan
b85f0ccc67 gdk-win32: Really Implement GdkScreen->is_composited()
The current GdkScreen->is_composited() is a stub as we were having Windows
XP being supported, which does not support Desktop Window Manager (DWM),
which is used by Windows for composition.

Windows Vista and later support DWM, and it is always enabled on Windows 8/
Server 2012 and later.

Please note that as we are dropping XP support in this cycle, this is the
commit that would say goodbye to Windows XP support for GTK+-3.x, by
linking directly to dwmapi.dll.  This means, we only check whether we are
on Windows 8 or Server 2012 (or later) to see whether we unconditionally
have composition enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=741849
2015-04-17 11:23:53 +08:00
Руслан Ижбулатов
fee41fb616 Revert "W32: Implement composition check for GDK"
This reverts commit 7ae5a56948.

Pushed by accident.
2014-04-10 17:58:58 +00:00
Руслан Ижбулатов
7ae5a56948 W32: Implement composition check for GDK
Also move DWM function grabbing and make those functions available to all of GDK-Win32.

https://bugzilla.gnome.org/show_bug.cgi?id=727316
2014-04-10 17:49:20 +00:00
Chun-wei Fan
0e01f9cc9c GDK/GTK on Windows: Fix build
Due to the work on gdk_cursor_new_from_surface (commit b2113b73),
get_cursor_for_pixbuf() in GdkDisplayClass was converted to
get_cursor_for_surface(), which means the GDK Win32 backend needs to be
updated for the code to build and run on Windows, plus some function
prototypes and declarations/calls need to be updated as well.

https://bugzilla.gnome.org/show_bug.cgi?id=705980
2013-08-26 10:29:23 +08:00
Руслан Ижбулатов
b0016252cf Pass screen to visual init (no default screen is available yet)
https://bugzilla.gnome.org/show_bug.cgi?id=700444
2013-06-11 11:16:04 +02:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Alexander Larsson
a2b879fe53 win32: Make grab cursors work again 2011-11-10 21:32:50 +01:00
Alexander Larsson
52be8cb9e9 win32: Fix some warnings 2011-11-10 17:41:11 +01:00
Alexander Larsson
1737ffeeb9 win32: Fix modal_hint handling
Modal hints are not really a stack. All windows that are modal
are allowed to get input, not just the top one.

This fixes bug #604156
2011-11-10 17:41:07 +01:00
Alexander Larsson
a1828e8b60 win32: Make flush/sync work like in X
gdk_flush() should gdk_display_sync() on all open displays.

Both for display_flush and display_sync it seems useful to call
GdiFlush, but we don't have anything extra to do for display_sync,
as there is no inherent roundtrip on win32.

This should close bug #84314
2011-11-10 17:41:06 +01:00
Alexander Larsson
2dbc05f756 win32: Ensure we always send a configure event when changing size/pos
There are some cases where we don't get a WINDOWPOSCHANGE such that
we generate a configure event, even if we called gdk_window_move_resize()
or similar. For instance:
* The window is fullscreen
* The window is maximized
* The specified pos/size is the same as the current one

However, as per X11 ConfigureNotify semantics we *always* want one, or
we could run into issue like e.g. bug #537296 where we're waiting for
the CONFIGURE to call gdk_window_thaw_toplevel_updates_libgtk_only().
2011-11-10 17:41:04 +01:00
Alexander Larsson
36a28d616f win32: Ignore client requested window move/size during SIZEMOVE
This will just be fighting the user like in e.g.
https://bugzilla.gnome.org/show_bug.cgi?id=64428
2011-11-10 17:41:00 +01:00
Alexander Larsson
ade6d093e2 win32: Fix up initialization order of input subsystem
We were getting warnings due to windows being created before input
subsystems were fully initialized.
2011-11-10 17:40:51 +01:00
Marc-André Lureau
1afc29d869 win32: resurect Windows clipboard selection notification
This is a rewrite of e6fa7394ba, with
misc fixes that should help with some bugs Tim was talking about.

https://bugzilla.gnome.org/show_bug.cgi?id=652239
2011-11-10 17:40:48 +01:00
Hans Breuer
b41ee31a16 win32: no more GdkNativeWindow and related changes
- replace GdkNativeWindow with HWND, remove type casts
 - no more GdkDisplayClass::get_drag_protocol but GdkWindowImpl::get_drag_protocol
 - remove *_client_message*()
2011-02-06 15:07:13 +01:00
Benjamin Otte
ec750bed0c gdk: Remove colormap debug category
We don't have colormaps anymore.
2011-01-21 02:54:09 +01:00
Fridrich Štrba
a606ea62a1 Fix win32 build 2011-01-11 17:28:37 +01:00
Hans Breuer
1d838f586c win32: gdk3 resurrection
There are sure regressions but basic stuff seems to be working
again after all the API breakage done with comments like
"Win32 and Quartz need to be ported still."
2011-01-02 13:33:04 +01:00
Matthias Clasen
2186203422 Remove unused get_offsets functions from headers 2010-12-21 12:06:59 -05:00
Benjamin Otte
e624656c20 API: Remove GdkColormap 2010-09-26 15:11:34 +02:00
Benjamin Otte
522becccc0 gdk: Remove pixmap debug category
It's not used anywhere anymore.
2010-09-26 15:11:30 +02:00
Benjamin Otte
f74f9b2766 gdk: Remove GdkPixmap
All iusers of it are gone, so it's now time to let go.
cairo_surface_t is a full replacement, combined with
gdk_window_create_similar_surface().
2010-09-26 15:11:30 +02:00
Tor Lillqvist
56f71f0123 Fix Win32 build
Builds now, except for the ms-windows theme engine. It doesn't really
work, though.
2010-08-23 18:55:54 +03:00
Benjamin Otte
6a48a042c7 API: remove GdkGC
XXX: Some traces in the win32 code are left. I suppose they'd best be
replaced using Cairo.
2010-08-10 21:02:29 +02:00
Benjamin Otte
14fe04ec89 API: remove GdkImage
It was unused and buggy.
2010-08-10 21:02:26 +02:00
Benjamin Otte
6f5084551a API: remove gdk_drawable_copy_to_image() 2010-08-10 21:02:26 +02:00
Tor Lillqvist
34e8bd9dba Fix build breakage on Windows caused by the region changes
Patches by Sam Thursfield, from bug #623476.
2010-07-05 12:57:13 +03:00
Benjamin Otte
300e6b84cd s/GdkRegion/cairo_region_t/ in all of gtk
https://bugzilla.gnome.org/show_bug.cgi?id=613284
2010-06-29 16:06:38 +02:00
Christian Dywan
655dcff096 Remove deprecated GdkFont
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=604196

Signed-off-by: Javier Jardón <jjardon@gnome.org>
2010-06-28 23:38:03 +02:00
Javier Jardón
c3987f9ee2 [GdkGC] Remove deprecated GdkFont from GdkGCValues structure 2010-06-28 23:38:03 +02:00
Tor Lillqvist
eb21a7df29 Work on OLE2-based generic DND
Intermediate commit of work in progress on integrating the old code
for OLE2-based generic drag and drop from Arhaeopteryx Software, from
a long time ago in the GTK+ 1.3 timeframe. Does still not work and is
as before not compiled in unless OLE2_DND is defined in
gdkdnd-win32.c. (Thus, for inter-process DND, still only WM_DROPFILES
style dropping of files on GTK+ apps works.)

Related slight refactoring of other code that shouldn't change how it
works. Add more global variables for run-time constants (once
initialized) representing well-known GdkAtoms and registered Windows
clipboard formats, as they with the generic DND code will be needed in
several source files. Some improved debugging output.
2009-12-16 13:10:21 +02:00
Tor Lillqvist
c196ac2b63 Make more GdkAtom variables visible in all gdk/win32 files
Make the GdkAtoms for the image formats extern and usable from all
gdk/win32 files.
2009-12-16 13:10:20 +02:00
Tor Lillqvist
c1ddd8f9bc Make the gdk/win32 event debug printing function non-static
Make print_event() extern and rename it to _gdk_win32_print_event() so
it can be used from all gdk/win32 source files.
2009-12-16 13:10:19 +02:00
Javier Jardon
98ea183c13 Use G_STRLOC instead __FILE__ and __LINE__
Patch from bug #599225
2009-10-21 21:48:00 +03:00
Shixin Zeng
277d840616 Deprecate also GdkFontPrivateWin32 2009-08-20 23:57:41 +03:00
Alexander Larsson
b1df568239 Some win32 cleanups 2009-07-01 12:06:57 +02:00
Cody Russell
49a0ec6e95 Updates 2009-04-02 10:16:30 +02:00
Cody Russell
a93c6cd6e1 CSW Win32 work in progress - builds but does not work yet. 2009-04-02 10:16:29 +02:00
Tor Lillqvist
e029e0014d Bug 573067 - Intra-app dnd of text behavior on Windows is wrong
2009-03-11  Tor Lillqvist  <tml@iki.fi>

	Bug 573067 - Intra-app dnd of text behavior on Windows is wrong

	* gdk/win32/gdkdnd-win32.c (local_send_motion) (gdk_drag_motion):
	The default action should be move, not copy. Tweak how the
	GdkDragAction fields in GdkDragContexts are changed. Seems to help
	the problem.

	Add more debugging printout for --gdk-debug=dnd to many functions.

	* gdk/win32/gdkmain-win32.c
	* gdk/win32/gdkprivate-win32.h: (_gdk_win32_drag_protocol_to_string)
	(_gdk_win32_drag_action_to_string): New functions for use in
	debugging printouts.


svn path=/trunk/; revision=22522
2009-03-11 14:09:13 +00:00
Tor Lillqvist
3f4c73d0d5 Bug 559408 - Transparency lost when images are copied between GTK+ and the
2009-01-29  Tor Lillqvist  <tml@novell.com>

	Bug 559408 - Transparency lost when images are copied between GTK+
	and the clipboard on Windows

	The code in gdkselection-win32.c is simplified quite a lot. When
	an image is stored on the clipboard from GTK+, only the "PNG" and
	CF_DIB formats are advertised. PNG is our preferred format because
	it can losslessly represent any image that gdk-pixbuf can handle,
	even with alpha, unambiguously. CF_DIB is also advertised because
	of its ubiquitous support in Windows software.

	Delayed rendering is used as before, so for other data than text
	nothing is actually stored on the clipboard until some app asks
	for it.

	It's pointless to advertise images formats like "image/png" or
	"image/x-MS-bmp" that no other Windows application is going to
	look for anyway. Likewise it's pointless to store text under
	formats like "text/plain" or "UTF8_STRING". Just store
	CF_UNICODETEXT. CF_TEXT will be available as a synthesized format
	anyways.

	Office 2007 offers and asks for images in PNG format using the
	registered clipboard format name "PNG", so we do likewise. If the
	"PNG" format is available that is preferred when copying to GTK+
	from the clipboard.

	Unfortunately Word 2007 still uses CF_DIB without handling
	alpha. But PowerPoint 2007 uses PNG if available and handles alpha
	correctly. Both Word and Powerpoint offer PNG with alpha nicely.

	Firefox and IE7 offer images that contain alpha as 32-bit version
	3 BI_RGB DIBs with the undocumented "extra" bytes actually being
	alpha. Also, alpha is premultiplied into the RGB bytes, presumably
	because that is how AlphaBlend() wants such DIBs. That is also
	taken care of. At least for Firefox it easy to be sure that a
	CF_DIB on the clipboard is from Firefox.

	Also some general stylistic cleanup, comment improvements, and
	improvements of debugging printout especially in the clipboard
	handling. Those are not detailled below.

	* gdk/win32/gdkprivate-win32.h
	* gdk/win32/gdkglobals-win32.c
	* gdk/win32/gdkgmain-win32.c: Move some globals that were used
	only in gdkselection-win32.c to be local to that file.

	* gdk/win32/gdkproperty-win32.c (gdk_property_change): Don't
	bother checking if text to be placed on the clipboard consists of
	only ASCII.

	* gdk/win32/gdkselection-win32.c: Add static variables for a list
	of GdkPixbuf-supported formats, well-known registered clipboard
	formats for images, and for GdkAtoms for well-known image and text
	formats.

	(_gdk_win32_selection_init): Initialize above static variables.

	(selection_property_store) (gdk_selection_property_get)
	(_gdk_selection_property_delete): Don't use a FIFO of GdkSelProps
	for a window after all, it breaks testtext. See bug #163844.

	(gdk_selection_convert): When converting to the TARGETS format,
	i.e. when the caller wants to know what clipboard formats are
	available, if PNG is available we report just that and skip
	CF_DIB, JPEG and GIF even if advertised.

	If CF_UNICODETEXT is available, report only UTF8_STRING.

	When converting to the UTF8_STRING format, i.e. when the caller
	wants text from the clipboard, try just CF_UNICODETEXT. There is
	no point in trying CF_TEXT as Windows will synthesize
	CF_UNICODETEXT from CF_TEXT anyway, if some app has stored just
	CF_TEXT.

	When converting to the image/bmp format, i.e. when the caller
	wants an CF_DIB image from the clipboard, we check if the DIB is a
	version 3 32-bit BI_RGB one that is likely to actually contain
	alpha in the "extra" bytes. Such a DIB is likely to have
	premultiplied alpha even, at least in the case of Firefox 3 and
	IE7. We then edit the DIB in-place into a version 5 one in
	BI_BITFIELDS format and undo the alpha premultiplication.

	In any case, prepend a BMP file header before letting go of the
	data which will be fed to the gdk-pixbuf bmp loader by upper
	levels.

	(gdk_win32_selection_add_targets): If some kind of pixmap image
	format is being added, actually advertise just PNG and
	CF_DIB. Note that alpha won't be stored on the clipboard through
	CF_DIB. This is because gdk-pixbuf's bmp loader doesn't save
	alpha. Furthermore, few if any non-GTK+ Windows apps seem to
	understand a version 5 DIB with proper alpha anyway.

	(_gdk_win32_selection_convert_to_dib): Simplified muchly.



svn path=/trunk/; revision=22255
2009-01-30 01:16:47 +00:00
Tor Lillqvist
55d7d50e13 Bug 132501 - Make utility window translate to tool window in win32
2008-10-04  Tor Lillqvist  <tml@novell.com>

	Bug 132501 - Make utility window translate to tool window in win32

	Implement the utility window type hint. Such windows are kept on
	top of other windows. Makes GIMP's toolbox and dock windows behave
	more like in GNOME under metacity. Apply the same logic also to
	windows marked with the dialog window type hint, and windows that
	are transient for some other window. I'll call such windows
	"transient-type" below.

	* gdk/win32/gdkevents-win32.c (doesnt_want_key): Drop unused
	variables.

	(ensure_stacking_on_unminimize)
	(ensure_stacking_on_window_pos_changing)
	(ensure_stacking_on_activate_app): New functions to implement the
	desired stacking order. Make sure that a window that is not
	transient-type stays below any transient-type windows of the
	application. When activating a non-transient-type window make sure
	it rises as high as possible.

	(gdk_event_translate): Call above functions on
	WM_WINDOWPOSCHANGING, WM_ACTIVATEAPP and on WM_SIZE when
	unminimizing. Improve debugging printout.

	* gdk/win32/gdkwindow-win32.c (get_effective_window_decorations):
	Handle utility windows like toolbar windows.

	(gdk_window_new_internal) (update_style_bits): Give utility
	windows the WS_EX_TOOLWINDOW extended style.

	(gdk_window_set_title): If debugging "misc" or "events", make the
	handle of top-level windows show up in their title bars. Very
	useful when looking at debugging output.

	(gdk_window_set_keep_above) (gdk_window_set_keep_below)
	(gdk_window_set_modal_hint) (gdk_window_set_skip_taskbar_hint)
	(gdk_window_set_skip_pager_hint): Add and improve debugging
	printout.

	(gdk_window_set_type_hint): Print hint symbolically in GDK_NOTE().

2008-10-04  Tor Lillqvist  <tml@novell.com>

	* gdk/win32/gdkmain-win32.c (_gdk_win32_window_exstyle_to_string)
	(_gdk_win32_window_pos_bits_to_string): New debugging printout
	functions. Decode the WS_EX_* and SWP_* bits.

	* gdk/win32/gdkprivate-win32.h: Declare them. Define
	GDK_DEBUG_MISC_OR_EVENTS for use in GDK_NOTE() to match either
	"misc" or "events".


svn path=/trunk/; revision=21587
2008-10-05 00:00:10 +00:00
Cody Russell
e625b41a1d Bug 541162 – [Win32] Update for the new GdkWindowImpl stuff
2008-07-02  Cody Russell  <bratsche@gnome.org>

        Bug 541162 – [Win32] Update for the new GdkWindowImpl stuff

        * gdk/win32/gdkprivate-win32.h:
        * gdk/win32/gdkgeometry-win32.c:
        * gdk/win32/gdkevents-win32.c:
        * gdk/win32/gdkwindow-win32.c: Update Win32 backend according to
        the newly refactored GdkWindow code.


svn path=/trunk/; revision=20729
2008-07-02 06:06:29 +00:00
Johan Dahlin
d97cdbdf53 Include "config.h" instead of <config.h> Command used: find -name
2008-06-21  Johan Dahlin  <jdahlin@async.com.br>

    * *.[ch]: Include "config.h" instead of <config.h>
    Command used:
    find -name \*.[ch]|xargs perl -p -i -e 's/^#include <config.h>/#include "config.h"/g'
    Rubberstamped by Mitch and Tim


svn path=/trunk/; revision=20669
2008-06-22 14:28:52 +00:00