Commit Graph

936 Commits

Author SHA1 Message Date
Matthias Clasen
1dfe28fa56 win32: Set the right source device
https://bugzilla.gnome.org/show_bug.cgi?id=734738
2014-08-15 13:04:57 -04:00
Руслан Ижбулатов
a0faf5a51c Fix various warnings
https://bugzilla.gnome.org/show_bug.cgi?id=734737
2014-08-13 23:41:56 +00:00
Руслан Ижбулатов
1b9fa975af Fix some print format warnings
https://bugzilla.gnome.org/show_bug.cgi?id=734736
2014-08-13 23:40:59 +00:00
Руслан Ижбулатов
694c8d32d5 Fix various warnings about unused things
https://bugzilla.gnome.org/show_bug.cgi?id=734735
2014-08-13 23:38:47 +00:00
Chun-wei Fan
781846e564 gdkwindow-win32.c: Fix build on Visual C++
Since MSVC is more strict about the types that we try to do a compare, cast
old_ptr as HWND, as we know that it is a pointer...

https://bugzilla.gnome.org/show_bug.cgi?id=733768
2014-08-06 15:13:09 +08:00
Руслан Ижбулатов
31d08bd85e When wrapping a foreign W32 window, don't forget to store its HWND
When that window is later used as a parent for a GDK child, the call to
CreateWindow*() will fail, because its HWND is 0.

https://bugzilla.gnome.org/show_bug.cgi?id=733768
2014-08-05 06:37:24 +00:00
Руслан Ижбулатов
d43fb29c5a Suppress a warning from SetWindowLongPtr()
https://bugzilla.gnome.org/show_bug.cgi?id=726224
2014-08-04 13:55:11 +00:00
Руслан Ижбулатов
6dede1a0b7 W32: Don't crash when opacity is set for non-toplevel
X11 backend doesn't, and for good reason - main code body does not check
that the window it sets opacity for is, in fact, toplevel.
Just silently fail to do anything for non-toplevel windows.

https://bugzilla.gnome.org/show_bug.cgi?id=733769
2014-08-02 14:22:22 +00:00
Руслан Ижбулатов
a235dd6a6c GDK W32: add environment variable to override system font scaling
Support environment variable GDK_WIN32_FONT_RESOLUTION that can be set to
a desired dpi (72, 96, 130, etc) to override system settings. Useful for
debugging, since changing system font scaling requires the user to log off
and log on again.

https://bugzilla.gnome.org/show_bug.cgi?id=734038
2014-07-31 14:27:14 +00:00
Руслан Ижбулатов
f38498ed84 GDK W32: support font scaling
Respect system font scaling (Control Panel -> Display -> Font Size) and
convey that information to GDK (which then passes it to Pango).

https://bugzilla.gnome.org/show_bug.cgi?id=734038
2014-07-31 14:01:56 +00:00
Руслан Ижбулатов
a23c29c0fb W32: Implement rudimentary WM_NCHITTEST handling
Use (cairo) input shape of the window to check whether a point is inside or not
inside the window.
If it is, let the default window procedure do its thing (which seems to be
working all right in all known cases).
If it isn't, override the default window procedure and tell WM what we think.

Don't do any of the above if the window has CSD-incompatible styles (WS_BORDER
or WS_THICKFRAME).

This is a crude kind of substitute for window input shape support (which W32
does not seem to have). Still probably enough to be positive about input shapes
support.

https://bugzilla.gnome.org/show_bug.cgi?id=733679
2014-07-29 01:31:49 +00:00
Руслан Ижбулатов
9e11bb3335 Remove gdk_win32_input_shape_combine_region()
This function currently calls gdk_win32_window_shape_combine_region(),
which is wrong, because it leads to SetWindowRgn() being called with
non-NULL region, which makes W32 disable theming (particularly - decoration
theming), which makes decorations revert back to old GDI-drawn Windows 2000
variant, which looks out of place and interacts *badly* with alpha channel
(because GDI).

https://bugzilla.gnome.org/show_bug.cgi?id=733671
2014-07-24 16:01:06 +00:00
Ignacio Casal Quinteiro
b553ce2b2f win32: remove set but not used variables 2014-07-23 23:37:52 +02:00
Matthias Clasen
1e205dcb05 win32: fix the build
A recent cleanup gone wrong,
https://bugzilla.gnome.org/show_bug.cgi?id=732454
2014-07-03 08:13:29 -04:00
Jasper St. Pierre
58715796d2 gdkwindow: Provide a default implementation of process_updates_recurse
As a quick code cleanup.
2014-06-22 10:20:50 -04:00
Jasper St. Pierre
0dfd506b3c gdkwidow: Make queue_antiexpose optional 2014-06-21 18:45:41 -04:00
Jasper St. Pierre
8ae546857c gdkwindow-win32: Remove queue_antiexpose implementation
Since the Win32 code never actually called InvalidateRgn or used the
Win32 update area at all, that meant the only thing that could possibly
invalidate the window was the Win32 window manager as part of scrolling
or resizing, which would also send it a WM_PAINT message.

But the WM_PAINT handling called BeginPaint / EndPaint, which clears the
update area completely! We also draw out-of-band, not directly when
handling WM_PAINT, so there's no way that the update area inside the
Win32 WM would match our local one.

There is no possible way that this queue_antiexpose implementation could
do anything. Remove it.
2014-06-21 18:45:40 -04:00
Jasper St. Pierre
4d8cd2f7cf gdkevents-win32: Remove dead code 2014-06-21 18:45:40 -04:00
Jasper St. Pierre
c767d504c5 gdkwindow: Don't bother with a return parameter for queue_antiexpose
Standard refcounting works perfectly well. Don't give us the opportunity
for more memory leaks.
2014-06-21 18:45:39 -04:00
Jasper St. Pierre
d48adf9cee gdkwindow: Remove the internal cairo_surface used for out-of-band painting
Traditionally, the way painting was done in GTK+ was with the
"expose-event" handler, where you'd use GDK methods to do drawing on
your surface. In GTK+ 2.24, we added cairo support with gdk_cairo_create,
so you could paint your graphics with cairo.

Since then, we've added client-side windows, double buffering, the paint
clock, and various other enhancements, and the modern way to do drawing
is to connect to the "draw" signal on GtkWidget, which hands you a
cairo_t. To do double-buffering, the cairo_t we hand you is actually on
a secret surface, not the actual backing store of the window, and when
the draw handler completes we blit it into the main backing store
atomically.

The code to do this is with the APIs gdk_window_begin_paint_region,
which creates the temporary surface, and gdk_window_end_paint which
blits it back into the backing store. GTK+'s implementation of the
"draw" signal uses these APIs.

We've always sort-of supported people calling gdk_cairo_create
"outside" of a begin_paint / end_paint like old times, but then you're
not getting the benefit of double-buffering, and it's harder for GDK to
optimize.

Additionally, newer backends like Mir and Wayland can't actually support
this model, since they're based on double-buffering and swapping buffers
at various points in time. If we hand you a random cairo_t, we have no
idea when is a good time to swap.

Remove support for this.

This is technically a GDK API break: a warning is added in cases where
gdk_cairo_create is called outside of a paint cycle, and the returned
surface is a dummy that won't ever be composited back onto the main
surface. Testing with complex applications like Ardour didn't produce
any warnings.
2014-06-20 20:41:54 -04:00
Matthias Clasen
5d7c79574b Use Adwaita on Windows too
Having the same, usable, default appearance acroll platforms
trumps having a more-or-less working native theme. The default
will be Adwaita on all platforms. The native ms-windows theme
is of course still available.
2014-06-13 16:49:59 -04:00
Chun-wei Fan
58b48fa209 gdkselection-win32.c: Declare Variables At Top Of Block
...so that builds on Visual C++ can be fixed.
2014-05-16 12:25:36 +08:00
Marc-André Lureau
4480bf382a gdk/win32: VK_SNAPSHOT maps to GDK_Print
Also, I am not sure the above VK_PRINT -> GDK_Print mapping is
correct, but it doesn't hurt yet.

https://bugzilla.gnome.org/show_bug.cgi?id=686170
2014-04-24 16:31:09 +02:00
Marc-André Lureau
2230fea0b6 win32: add more clipboard data checks to avoid crash
It may happen that the received clipboard data is empty, but
if it's of type image/bmp, gtk+ will crash:

gdk_property_change: 00030AD4 GDK_SELECTION image/bmp REPLACE 8*0 bits:
... delayed rendering
gdk_selection_send_notify_for_display: 00030AD4 CLIPBOARD image/bmp
GDK_SELECTION (no-op)
_gdk_win32_selection_convert_to_dib: 1252003C image/bmp

Program received signal SIGSEGV, Segmentation fault.
0x749a9f40 in msvcrt!memmove () from C:\Windows\syswow64\msvcrt.dll

Thread 1 (Thread 2248.0x1b34):
target=0xc07b) at gdkselection-win32.c:1292
at gdkevents-win32.c:3498
wparam=8, lparam=0) at gdkevents-win32.c:232
message=773, wparam=8, lparam=0)
    at gdkevents-win32.c:263
C:\Windows\syswow64\user32.dll
C:\Users\rugoosse\AppData\Local\virt-viewer\bin\libpangocairo-1.0-0.dll
wparam=0, lparam=-1687549457)
    at gdkevents-win32.c:248
C:\Users\rugoosse\AppData\Local\virt-viewer\bin\libpangocairo-1.0-0.dll

https://bugzilla.gnome.org/show_bug.cgi?id=728745
2014-04-24 16:12:07 +02:00
Руслан Ижбулатов
42ee237691 W32: correctly guess max window size from the size of the workarea of the screen it's on
Get monitor on which the most of the window is located (nearest monitor if
window is not on screen), get its work area (area not occupied by taskbar or
any other bars) and use that for maxsize.

Previous default of 30000 meant that windows maximized onto full screen,
even covering the area where taskbar is.

https://bugzilla.gnome.org/show_bug.cgi?id=726592
2014-04-16 22:39:56 +00:00
Руслан Ижбулатов
b1012256f2 Revert "W32: RGBA GDK backend (broken)"
This reverts commit f89d38bc2d.

Pushed by accident.
2014-04-10 17:59:48 +00: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
Руслан Ижбулатов
f89d38bc2d W32: RGBA GDK backend (broken)
https://bugzilla.gnome.org/show_bug.cgi?id=727316
2014-04-10 17:49:19 +00:00
Chun-wei Fan
9e686d1fb5 gdkproperty-win32.c: Fix gtk-font-name handling
...on Windows 8+ and when the system setting for non-Unicode programs do
not match the language version of Windows by falling back to using Pango.

This ensures that the correct font is used during these scenarios, so that
we minimize the risk of seeing garbled characters for texts that the system
code page does not support due to system peculiarties.  There might be a
way to support gtk-font-name handling using the native Windows APIs
directly on Windows 8+, but that needs to be investigated.

https://bugzilla.gnome.org/show_bug.cgi?id=726298
2014-03-28 21:06:14 +08:00
Jasper St. Pierre
efdd68b3b0 Implement get_root_origin generically for all backends
It seems that some backends implemented get_root_origin wrong
and returned the client window coordinates, not the frame window
coordinates. Since it's possible to implement generically for all
windows, let's do that instead of having a separate impl vfunc.
2014-03-17 15:51:46 -04:00
Jasper St. Pierre
b922e0e213 Remove the return value of GdkWindowImpl::get_root_coords
It's unused by callers, and the historical return values are
undocumented, so just remove it now.
2014-02-27 21:06:35 -05:00
Giovanni Campagna
ad2f96ff48 Gdk: fix wrong user_data handling in resize_cairo_surface()
Instead of destroying the surface in the backend if this is
unable to resize, let the core code do it, and do it properly.

Based on a patch by Benjamin Otte.

https://bugzilla.gnome.org/show_bug.cgi?id=725172
2014-02-26 00:04:41 +01:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00
William Jon McCann
e34bd4137d docs: use apostrophes in *n't 2014-02-07 13:32:47 -05:00
William Jon McCann
7a208fbbf3 docs: use proper apostrophe
https://wiki.gnome.org/Design/OS/Typography
2014-02-07 13:06:10 -05:00
Ignacio Casal Quinteiro
e1b874b44f win32: remove useless comment since we do not support win98 anymore 2014-01-27 14:39:53 +01:00
Ignacio Casal Quinteiro
254d35af29 win32: handle again gtk-font-name
This code is ugly but it seems to do the work
2014-01-27 09:47:21 +01:00
Chun-wei Fan
901127243a GDK-Win32: Ensure sources use UNIX line endings
This makes things more consistent with the other sources and makes patches
easier to apply cleanly.
2013-12-04 08:57:43 +08:00
Matthias Clasen
2fb64cf0e7 Win32: Set the shows-desktop platform setting
Win32 shows icons on the desktop, so set shows-desktop
to TRUE here.
2013-11-15 07:51:22 -05:00
Chun-wei Fan
42bdbd8c30 gdk/win32/gdkevents-win32.c: Fix typo
...to fix the build on Windows.
2013-11-13 16:18:12 +08:00
Owen W. Taylor
f50a3af1b7 Handle recursion from motion event handlers
If a motion event handler (or other handler running from the flush-events
phase of the frame clock) recursed the main loop then flushing wouldn't
complete until after the recursed main loop returned, and various aspects
of the state would get out of sync.

To fix this, change flushing of the event queue to simply mark events as
ready to flush, and let normal event delivery handle the rest.

https://bugzilla.gnome.org/show_bug.cgi?id=705176
2013-11-11 23:17:14 -05:00
Marc-André Lureau
c486c0983f gdk/win32: remove extra allocation for \r removal
Although I can't find explicit documentation for clipboard pointer, it
seems to be possible to modify clibpoard memory without side-effects.

According to MSDN,
http://msdn.microsoft.com/en-us/library/windows/desktop/aa366596%28v=vs.85%29.aspx

"The global and local functions are supported for porting from 16-bit
code, or for maintaining source code compatibility with 16-bit
Windows. Starting with 32-bit Windows, the global and local functions
are implemented as wrapper functions that call the corresponding heap
functions using a handle to the process's default heap."

"Memory objects allocated by GlobalAlloc and LocalAlloc are in private,
committed pages with read/write access that cannot be accessed by other
processes. Memory allocated by using GlobalAlloc with GMEM_DDESHARE is
not actually shared globally as it is in 16-bit Windows. This value has
no effect and is available only for compatibility. "

https://bugzilla.gnome.org/show_bug.cgi?id=711553
2013-11-09 11:58:03 -05:00
Manuel Bachmann
55dba74a24 Win32 : fixes Bug 679019 (Popup menu misplaced in dual monitor) 2013-11-01 17:59:05 +01:00
Cody Russell
46fbefe795 Win32: Honor the geometry when GDK_HINT_MAX_SIZE is set.
The MINMAXINFO struct was being populated based upon geometry hints when
GDK_HINT_MAX_SIZE flag was enabled, then promptly having its values blown
away with default values.

https://bugzilla.gnome.org/show_bug.cgi?id=711110
2013-10-31 15:54:28 -05:00
Chun-wei Fan
bd59614490 gdk/win32/gdkdevice-virtual.c: Various fixes
...for the gdk_cursor_new_from_surface work (commit b2113b73) where the
types of some parameters were changed, and also to silence a critical
GDK_IS_DEVICE when a menu item is selected (courtesy of LE GARREC Vincent
from bug 696756).

https://bugzilla.gnome.org/show_bug.cgi?id=705980
2013-08-26 10:30:13 +08: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
Matthias Clasen
f8412eca34 Revert "Deprecate and ignore the cursor blink settings"
This reverts commit b2e666bf8f.

We need to keep cursor blinking configurable for accessibility
reasons.

https://bugzilla.gnome.org/show_bug.cgi?id=704134

Conflicts:
	gdk/win32/gdkproperty-win32.c
	gdk/x11/gdksettings.c
	gtk/gtksettings.c
	gtk/gtktextview.c
2013-08-16 22:45:13 -04:00
Chun-wei Fan
ee0b0fa482 Bug 702144: Make gdkwin32.h a pure include-only header
Move all the system includes, defines and function prototypes into a
separate header gdkwin32misc.h, so that we could keep gdkwin32.h as simple
as possible.
2013-08-14 08:13:32 +08:00
Chun-wei Fan
9072be16a4 gdk/win32/gdkdevice-virtual.c: Don't Use Deprecated APIs
...this was split into two commits as this source file has different
line endings (for some reason) from the other GDK-Win32 source files that
were updated in the quest to refrain from using deprecated APIs
2013-08-14 08:04:50 +08:00