Commit Graph

309 Commits

Author SHA1 Message Date
Frediano Ziglio
cf14fea5a8 Save scancode inside GdkEventPrivate
Windows save in hardware_keycode an information which is not so low
level and some application require the hardware scancode.
As Windows provides this information save it in GdkEventPrivate
and provide a function to get this information.
For no Windows system the function return the hardware_keycode instead.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=765259
2016-04-21 22:35:47 -04:00
Руслан Ижбулатов
f853283d7b GDK W32: Add/subtract shadow when drag-resizing
Implements gdk_win32_window_set_shadow_width().
Uses shadow width/height to adjust max tracking size, allowing
windows to be drag-resized to cover the whole desktop.

Also uses SM_C*VIRTUALSCREEN instead of SM_C*MAXTRACK.

https://bugzilla.gnome.org/show_bug.cgi?id=763013
2016-03-30 09:03:56 +00:00
Руслан Ижбулатов
0ce217cf94 GDK W32: Re-implement AeroSnap for CSD windows
It works exactly like AeroSnap.
Except for shift+win+left/right, which is left for AeroSnap
to handle (AeroSnap takes action before we get the message,
so there's no way for us to override it).
The only thing that doesn't work is shift+win+left/right on
a maximized window, for reasons unknown at the moment.

This only implements winkey+stuff behaviour of AeroSnap,
not the drag-to-the-edge-and-something-funny-happens one.

https://bugzilla.gnome.org/show_bug.cgi?id=763013
2016-03-30 08:59:56 +00:00
Руслан Ижбулатов
77eebbda5c GDK W32: Erase hidden layered windows before showing them
If a layered window was hidden and is made visible, erase its
contents before showing it. GDK will schedule a redraw, but until
then we generally don't want to show old contents.

https://bugzilla.gnome.org/show_bug.cgi?id=763783
2016-03-29 14:30:19 +00:00
Руслан Ижбулатов
cea8c29a26 GDK W32: Implement show_window_menu()
This is achieved by sending undocumented message WM_SYSMENU
to the window.
Before doing that, the window is given WS_SYSMENU style
(to enable window menu) and some combination of
WS_MAXIMIZEBOX (for "Mazimize" item)
WS_MINIMIZEBOX (for "Minimize" item)
WS_SIZEBOX (for "Size" item)
depending on which operations are currently permissible.

WM_SYSMENU is processed by DefWindowProc(), which results
in showing the window menu. We remove extra styles
at the first opportunity (WM_INITMENU message), as they
alter the way our window is rendered.

https://bugzilla.gnome.org/show_bug.cgi?id=763851
2016-03-29 13:47:49 +00:00
Руслан Ижбулатов
c4c00299b2 GDK W32: Print more debug info about events
1) Print timestamps for events
2) Print wParam and lParam (in hex form) for messages

https://bugzilla.gnome.org/show_bug.cgi?id=763913
2016-03-25 22:04:57 +00:00
Paolo Borelli
8f25481406 win32: use a struct for the event source
This removes the event_poll_fd global variable and the (ab)use of
get_default_display. It is also more consistent with other backends.

Also store display
2016-03-05 20:31:10 +01:00
Руслан Ижбулатов
84ddc6aab1 GDK W32: Force correct mouse cursor for custom resize/move
* Explicitly grab the device, setting appropriate cursor on it.
* Fix gdk_device_virtual_set_window_cursor() to just set the
  cursor, without trying to check that mouse is over the given
  window. Also prevent it from immediately resetting cursor.
* Alse take into account things that happen in other parts of
  GDK - don't look for replacement cursor, GDK already did that,
  and don't create a default arrow cursor instead of NULL,
  GDK-W32 already did that up the stack as well.
  Warn about inappropriate cursor == NULL argument instead.

https://bugzilla.gnome.org/show_bug.cgi?id=762711
2016-03-03 07:17:46 +00:00
Руслан Ижбулатов
c05f254a6e GDK W32: Use layered windows
Toplevels are now true layered windows that are moved,
resized and repainted via UpdateLayeredWindow() API call.
This achieves transparency without any extra effort,
and prevents window size and window contents desychronization
(bug 761629).

This also changes the way CSD windows are detected. We now
use window decorations to detect CSDiness of a window,
and to decide whether a window should be layered (CSD windows should
be) or not.

Decorations are now stored in the window implementation,
not as a quark-based property of the window-as-gobject.

https://bugzilla.gnome.org/show_bug.cgi?id=748872
2016-03-02 21:42:50 +00:00
Руслан Ижбулатов
e03946bd28 GDK W32: custom (non-WM) drag-move and drag-resize code
Normally works only on CSD windows, non-CSD windows continue
to use WM modal loop for drag-resizing and drag-moving. However,
if it is activated on non-CSD windows, it does work.

Has the advantage of being completely immune to AeroSnap.
AeroSnap only worked partially on CSD windows, with the only part
that worked being "don't let users drag window titlebar outside of
the desktop". Now AeroSnap doesn't work on windows moved by
this code at all, which is good, since they currently don't work
well with it due to the way shadows are drawn.

It's possible to also re-implement AeroSnap (or something similar),
but that is a story for another commit.

This code was originally intended to fix the problem of window
size and window contents desynchronization, but failed to achieve
that result in the end. Nevertheless, it serves as a foundation for
other changes to the way window resizing works.

https://bugzilla.gnome.org/show_bug.cgi?id=761629
2016-03-02 21:39:32 +00:00
Paolo Borelli
58e169c04c win32: do not confuse gtk-doc 2016-02-28 11:37:38 +01:00
Руслан Ижбулатов
c61764b0f9 GDK W32: Fix the filling of MINMAXINFO
1) MSDN says that the coordinates of the maximized window
   must be specified as if the window was on the primary display,
   even if nearest display where it ends up is not the primary display.
   So instead of using nearest display work area verbatim,
   use it only to account for taskbar size, while using
   primary display top-left corner (0:0) as the reference point.
2) MSDN says that max tracking size is a system property, we
   should just call GetSystemMetrics() and use that.

https://bugzilla.gnome.org/show_bug.cgi?id=762629
2016-02-26 08:02:03 +00:00
Paolo Borelli
bc3c855e35 wip _gdk_display 2016-02-22 21:45:08 +01:00
Paolo Borelli
7047099fd8 Win32: fold the gdkinput.c file in gdkdisplay-win32.c
This is similar to what is done in the X11 and wayland backends.
It also gets rid of the _gdk_input_devices global variable
2016-02-22 21:45:08 +01:00
Benjamin Otte
033fb5a879 win32: Always pass a window to the default event filters
This has to happen or the event filter cannot identify what type
of display the event is from (ie if it's an XEvent, a broadway
event or a win32 MSG.
2016-02-11 03:44:48 +01:00
Benjamin Otte
76e56c5038 win32: Stop using _gdk_display global in device code
Use gdk_device_get_display() instead.
2016-02-11 03:44:47 +01:00
Benjamin Otte
584931e94d win32: Use g_set_object()
... instead of a hand-rolled version that does the same thing.
2016-02-11 03:44:46 +01:00
Руслан Ижбулатов
f74f81f06b W32: Detect ticks wraparound
https://bugzilla.gnome.org/show_bug.cgi?id=748327
2016-01-18 09:23:44 +00:00
Paolo Borelli
3cd79c11fc win32: remove _gdk_root global variable 2016-01-14 14:30:37 +01:00
Carlos Garnacho
5d6a2ae54f win32: Use GdkSeatDefault to implement GdkSeat 2015-12-15 00:40:22 +01:00
Руслан Ижбулатов
f407871b87 GDK W32: Only restack windows with matching always-on-top status
This prevents normal application windows (and other kinds of windows)
from being moved up in Z-order to be above windows that have the
always-on-top bit set. Doing so would make the previously-normal windows
in question also always-on-top implicitly.
Windows that are already always-on-top will be restacked on top of other
always-on-top windows too.

https://bugzilla.gnome.org/show_bug.cgi?id=746745
2015-11-22 03:20:10 +00:00
Руслан Ижбулатов
6b7951b219 GDK W32: Refactor restacking functions a bit 2015-11-22 03:18:43 +00:00
Paolo Borelli
8606e57910 win32: handle WM_DISPLAYCHANGE globally
Instead of handling WM_DISPLAYCHANGE on every GdkWindow, only handle
it on an ad-hoc hidden window we create when opening the display.
This has two reasons:
1) we want emit the display::size-changed signal even if there are no
   gtk windows currently open
2) we want to emit the signal just once and not once for every window

https://bugzilla.gnome.org/show_bug.cgi?id=757324
2015-10-31 15:31:11 +01:00
Matthias Clasen
364d1a574b Don't use g_slist_next in the windows backend
We generally use ->next directly.
2015-10-20 06:14:57 -04:00
Pavel Grunt
44608dadc6 gdk-win32: Send fake release key event for shift key
Windows does not send any release key event for one of the shift keys
when both shift keys were pressed together. This commit solves
the problem by sending the extra release key event for the shift key
which was released as first, when the other shift key is released.

Other modifiers (e.g. Ctrl, Alt) do not have this problem.

https://bugzilla.gnome.org/show_bug.cgi?id=751721
2015-07-23 17:52:01 +02: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
Руслан Ижбулатов
c0e0a1508b W32: Support horizontal mouse wheel scrolling
https://bugzilla.gnome.org/show_bug.cgi?id=748014
2015-04-17 04:38:34 +00:00
Руслан Ижбулатов
3c80451b17 W32: Only override window miximized position for CSDed windows
This fixes an issue with non-CSDed windows being improperly positioned
when maximized, which was introduced by the previous commit.

https://bugzilla.gnome.org/show_bug.cgi?id=746821
2015-03-26 17:02:38 +00:00
Руслан Ижбулатов
af9f6fca5f W32: Correctly set maximized window position
Use screen workarea to *also* set the position of a maximized window,
not just its size. Without this the window position defaults to 0:0
(the topleft corner), which is wrong when taskbar is position along the
top or left edge of the screen.

https://bugzilla.gnome.org/show_bug.cgi?id=746821
2015-03-26 15:43:17 +00:00
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
Руслан Ижбулатов
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
Руслан Ижбулатов
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
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
4d8cd2f7cf gdkevents-win32: Remove dead code 2014-06-21 18:45:40 -04: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
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
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
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
ae79dd7068 GdkWin32: Avoid Using Deprecated API
Update the Win32 GDK backend to not use the deprecated GDK APIs.

https://bugzilla.gnome.org/show_bug.cgi?id=705068
2013-08-14 08:03:19 +08:00
Chun-wei Fan
bb4cff8ecf gdk/win32/gdkevents-win32.c: Fix build
The variable "display" is not defined, causing the build to fail.
Judging from the code, it seems that it should be _gdk_display instead.

https://bugzilla.gnome.org/show_bug.cgi?id=694339
2013-03-06 22:19:57 +08:00
Owen W. Taylor
df3e19b449 Broadway/Quartz/Win32: make event source prepare()/check() note paused status
When events are paused, we should not return TRUE from prepare() or check().
GTK+ handles this for events that are already in the GTK+ queue, but
we also need suppress checks for events that are in the system queue - if we
return TRUE indicating that there are events in the system queue, then we'll
call dispatch(), and do nothing. The event source will spin, and will never
run the other phases of the paint clock.

(Broadway doesn't have a window system queue separate from the GDK event queue,
but we write the function the same way for consistency.)

https://bugzilla.gnome.org/show_bug.cgi?id=694274
2013-02-21 09:59:58 -05:00
Matthias Clasen
144a5687c9 gdk: Don't use GDK_THREADS_ENTER/LEAVE macros internally
These are just wrappers for the functions, and we want to
deprecate them. Stopping to use them internally is a good
first step.
2012-07-30 18:01:47 +02:00
Alexander Larsson
24f9ca92ab win32: Fix up wintab support
We now have a proper MASTER/SLAVE input device split, where
the masters are virtual core input devices and we add fake hw
slave devices for the system pointer and real slave devices for
wintab devices.

We also set the proper source_device on the events so you can
tell which device sent it and properly decode the axis info.
2012-04-03 11:37:42 +02:00
Alexander Larsson
6d99cdf28c win32: Ensure we update GDK_WINDOW_STATE_FOCUSED
When windows get activated/inactivated we need to update STATE_FOCUSED.
Without this the backdrop theme state will not work.
2012-03-16 11:34:58 +01:00