Commit Graph

958 Commits

Author SHA1 Message Date
Ryan Lortie
c91076f64c gdkglcontext-win32: fix variable names in GDK_NOTE
These probably weren't caught because GDK_NOTE was disabled when the
change was tested.

https://bugzilla.gnome.org/show_bug.cgi?id=745400
2015-03-01 21:38:19 -05:00
Ryan Lortie
4f0ab5656b gdkglcontext-win32: remove unused variables
https://bugzilla.gnome.org/show_bug.cgi?id=745400
2015-03-01 21:38:19 -05:00
Matthias Clasen
6ccef21d49 Fix a typo
Follow-up fix for commit 7cee6c5cc6.
2015-02-27 17:00:08 -05:00
Emmanuele Bassi
7cee6c5cc6 gdk: Use a better error message
Having "Assertion failed: success" on the console is not going to help
anyone.
2015-02-27 21:02:16 +00:00
Chun-wei Fan
933ee3af56 gdkglcontext-win32.c: Fix Build on C89 Compilers
Make sure variables are declared at the top of the block.
2015-02-13 18:36:34 +08:00
Emmanuele Bassi
d066e7541e Remove GdkGLProfile
The existence of OpenGL implementations that do not provide the full
core profile compatibility because of reasons beyond the technical, like
llvmpipe not implementing floating point buffers, makes the existence of
GdkGLProfile and documenting the fact that we use core profiles a bit
harder.

Since we do not have any existing profile except the default, we can
remove the GdkGLProfile and its related API from GDK and GTK+, and sweep
the whole thing under the carpet, while we wait for an extension that
lets us ask for the most compatible profile possible.

https://bugzilla.gnome.org/show_bug.cgi?id=744407
2015-02-12 17:51:31 +00:00
Emmanuele Bassi
022724aa69 gl: Drop profile for gdk_window_create_gl_context()
Now that we have a two-stages GL context creation sequence, we can move
the profile to a pre-realize option, like the debug and forward
compatibility bits, or the GL version to use.
2015-02-12 12:34:28 +00:00
Chun-wei Fan
60195ab021 win32/gl: Ensure we use the 3.2 core profile
Emit an error if the profile is different.

This is a follow-up commit to commits cc45e82 (x11/gl: Ensure we use the
3.2 core profile) and 2d9081d (wayland/gl: Ensure we use the 3.2 core
profile), so that we do the same on GDK-Win32.  Update variable names and
comments so that the code is clearer to people, as we still need a
temporary legacy WGL context first before we can use
wglCreateContextAttribsARB() to create a WGL core (3.2+) context.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-10 16:21:29 +08:00
Emmanuele Bassi
f7497daee9 Switch GDK_GL_PROFILE_DEFAULT to mean 3_2_CORE
Instead of LEGACY.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Chun-wei Fan
4c091db6c2 win32/gl: Use the GdkGLContext options
https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Chun-wei Fan
ba56f11702 GDK-Win32: Split GL context creation in two phases
Like what is being done in the X11 and Wayland backends, create the
GdkWin32GLContext in 2 steps, where we only create the actual WGL context
in _gdk_win32_gl_context_realize().

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:28 +00:00
Chun-wei Fan
0b06b1e3f7 gdkglcontext-win32.h: Clean Up a Bit
We don't have a Win32-specific ->upload_texture() anymore, so don't
indicate so.  Left out this part from my previous commit.
2015-02-06 13:00:59 +08:00
Chun-wei Fan
24e6bda264 GDK-Win32: Drop Win32-specific ->upload_texture()
The default ->upload_texture() works also for Windows since commit 27cf0fa,
as some of the problems described in 742953 also applied for GL core
contexts on Windows as well before 27cf0fa.  Clean up the GDK-Win32 code a
little bit as a result.
2015-02-06 12:41:38 +08:00
Carlos Garnacho
ea983404ec win32: Don't check the position of a NULL device
This function is given a barely setup GdkEvent, so the GdkDevice field
is still unset, causing warnings and misbehaviors when the position
is queried for it.

Given that the wintab GTK+ code seems to rely somewhat hard on the wintab
device managing the pointer cursor, query the pointer position from the
pointer itself.

https://bugzilla.gnome.org/show_bug.cgi?id=743330
2015-01-28 16:59:29 +00:00
Carlos Garnacho
1543890569 win32: Ensure we can create a window for wintab
The window used NULL as a parent window, which defaults internally to
using the root window of the default screen. But at the time wintab is
initialized, there is no default display/screen yet.

Fix this by retrieving this information from the given GdkDeviceManager,
so we don't have to wait for the display to be in place before
initialization.

https://bugzilla.gnome.org/show_bug.cgi?id=743330
2015-01-28 16:59:29 +00:00
Chun-wei Fan
36245b7058 GDK-Win32: Drop Some Unused Items
There were a bit of unused items from the GDK-Win32 work on GL support, so
drop them.
2014-12-22 11:25:49 +08:00
Chun-wei Fan
536fa88cd8 Add OpenGL Support for the GDK Windows Backend
This adds support for OpenGL to the GDK Windows backend using the WGL API
calls, which enables programs that uses the GTK+ GLArea widgets to work on
Windows as well.

This also adds a simple utility function to query for the version of OpenGL
that is supported by the Windows system, like the one provided by the X11
backend.

Many thanks to Alex (and Emmanuele, who started the OpenGL integration in
GTK+) who offered advice and help along the way, as well as the X11 and
Wayland backend for this work to refer to and to model upon.

https://bugzilla.gnome.org/show_bug.cgi?id=740795
2014-12-17 16:07:02 +08:00
Jasper St. Pierre
887b7356c3 gdkdisplay: Provide a default event_data_copy / event_data_free
Every single implementation but Quartz is a no-op for this, so just
provide it once rather than in every backend.
2014-10-27 22:13:23 -07:00
Vasiliy Nuzha
ba6522d3f2 Fix monitors enumeration bug
Fix monitors enumeration bug. By default used MONITORINFOEXW (UTF-16 Build) with wrong structure size
2014-10-06 22:48:08 +00:00
Benjamin Otte
5e4672092a gdk: Deprecate static gravities
... and remove all implementations. The API allows to not work "if the
server doesn't support it. So from now on, no server does!
2014-10-06 02:38:40 +02:00
Jehan
c87c5cd0ba win32: provide an implementation for gdk_test_simulate_key().
https://bugzilla.gnome.org/show_bug.cgi?id=734879
2014-09-22 21:22:33 -04:00
Руслан Ижбулатов
a8915b89d7 Initialize impl_window for foreign W32 windows
https://bugzilla.gnome.org/show_bug.cgi?id=736269
2014-09-08 15:50:32 +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
Руслан Ижбулатов
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