Commit Graph

214 Commits

Author SHA1 Message Date
Jasper St. Pierre
c1efc4ad7b gdk: Add new _gdk_set_window_state
Wayland's mechanism tells us all of our new states, rather than
telling us which ones were added and removed. Add a new private
interface so that we can simply specify the new states as a
bitfield directly rather than having to compute which ones were
added and removed.
2014-05-13 02:39:59 -04:00
Jasper St. Pierre
5ac2346862 Remove gdk_synthesize_window_state from gdkinternals.h
It's already in gdkprivate.h
2014-04-12 08:20:33 -07:00
Matthias Clasen
5657b805d7 Some struct repacking
Save a few bytes here and there.
2014-01-12 22:25:19 -05: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
Daniel Sabo
80dd1a851a Add an event_compression setting to GdkWindow
Setting event compression to false will allow inter-frame
mouse motion events to be delivered, which are necessary
for painting applications to produce smooth strokes.

https://bugzilla.gnome.org/show_bug.cgi?id=702392
2013-11-09 00:01:05 -05:00
Alexander Larsson
e8b38fedbd gdk: Convert mouse position to doubles, add new getters
We've long had double precision mouse coordinates on wayland (e.g.
when rotating a window) but with the new scaling we even have it on
X (and, its also in Xinput2), so convert all the internal mouse/device
position getters to use doubles and add new accessors for the
public APIs that take doubles instead of ints.
2013-07-03 14:39:25 +02:00
Alexander Larsson
a60ccd3672 GdkWindow: Fix shape handling for native windows
We don't track the full clip for each window anymore, as this
is not useful when no windows are opaque. However, we still
need the full clip for the shape, so its calculated manually.

However, it was previously only recalculated when the clip changes
which doesn't correctly handle the case of a sibling geometry changing.

So, instead of doing this directly when geometry changes we just
set a bit in the toplevel whenever some window geometry changes, and
we then handle this in process_updates, updating the shape for all
native windows. This should be ok performance-wise because we don't
expect a lot of native children.
2013-05-15 11:08:35 +02:00
Alexander Larsson
8306d26714 GdkWindow: Track all native windows of native windows
We keep a list of all native children of a native window. This means
we don't have to recurse over the entire hierarchy to find any
native children.
2013-05-15 11:08:35 +02:00
Alexander Larsson
3610005191 gdkwindow: Avoid some unnecessary typechecks
This removes the typechecks in GDK_WINDOW_TYPE and GDK_WINDOW_DESTROYED. These
are only used internally in gdkwindow.c and gdkdisplay.c anyway,  and these
functions check for typesafety of arguments on function entry.
2013-05-07 16:40:24 +02:00
Alexander Larsson
e13fb1d3e0 Add gdk_window_set_invalidate_handler
This lets you register callbacks for when child widgets invalidate
areas of the window read it and/or change it.

For instance, this lets you do rendering effects and keeping offscreen
caches uptodate.
2013-05-07 16:34:04 +02:00
Alexander Larsson
6115961175 gdkwindow: Make GdkPaintable normal GdkWindowImpl vfuncs
There is no need for this to be a separate interface, its just looking
weird.
2013-05-07 16:33:01 +02:00
Alexander Larsson
fe0982818d gdkwindow: Remove implicit paints
We now only do one expose event per native window, so there will
only be one begin/end_paint() call. This means all the work with
implicit paints to combine the paints on a single double buffer
surface is unnecessary, so we can just delete it.
2013-05-07 16:33:01 +02:00
Alexander Larsson
da2a1eac1b gdkwindow: Remove outstanding_moves stuff
Since we now never move regions directly on the window we can
remove all the stuff that track outstanding moves and flushes then.
2013-05-07 16:33:00 +02:00
Benjamin Otte
a489f69e00 gdk: Remove unused function 2013-04-15 15:43:27 +02:00
Benjamin Otte
8857766b5a gdk: Add a debug category for settings 2013-02-19 14:33:36 +01:00
Owen W. Taylor
d5edf9c072 GdkFrameTimings: strip down to a minimal public API
Since we're not exporting the ability to create your own frame
clock for now, remove the setters for GdkFrameTimings fields.
Also remove all setters and getters for fields that are more
about implementation than about quantities that are meaningful
to the applcation and just access the fields directly within
GDK.
2013-02-14 17:19:52 -05:00
Owen W. Taylor
515e5f74aa Merge GdkFrameHistory into GdkFrameClock
Now that GdkFrameClock is a  class, not interface, there's no real advantage
to splitting the frame history into an aggregate object, so directly
merge it into GdkFrameClock.
2013-02-14 17:19:52 -05:00
Owen W. Taylor
8855bf052d Add GDK_DEBUG=frames
Add a debug option to print out detailed statistics about each frame drawn.

https://bugzilla.gnome.org/show_bug.cgi?id=685460
2013-02-14 17:19:51 -05:00
Owen W. Taylor
a69285da08 Compress motion synchronized with the paint cycle
When we have pending motion events, instead of delivering them
directly, request the new FLUSH_EVENTS phase of the frame clock.
This allows us to compress repeated motion events sent to the
same window.

In the FLUSH_EVENTS phase, which occur at priority GDK_PRIORITY_EVENTS + 1,
we deliver any pending motion events then turn off event delivery
until the end of the next frame. Turning off event delivery means
that we'll reliably paint the compressed motion events even if more
have arrived.

Add a motion-compression test case which demonstrates behavior when
an application takes too long handle motion events. It is unusable
without this patch but behaves fine with the patch.

https://bugzilla.gnome.org/show_bug.cgi?id=685460
2013-02-14 17:19:49 -05:00
Owen W. Taylor
77bac0d6ae Add GdkFrameClock
Add an object GdkFrameClock that we associate with a GdkWindow.
This tracks when the window needs to be repainted, and will also
be used for other operations in the future like relayout and
updating animations.

Based on a patch from Havoc Pennington:

 https://mail.gnome.org/archives/gtk-devel-list/2010-October/msg00004.html

https://bugzilla.gnome.org/show_bug.cgi?id=685460
2013-02-14 17:19:47 -05:00
Alexander Larsson
4d3c77f920 gdkwindow: Allow gdk_window_set_opacity on non-native children
We now store the current opacity for all windows. For native windows
we just call into the native implementation whenever the opacity changes.
However, for non-native windows we implement opacity by pushing a
second implicit paint that "stacks" on the existing one, acting as
an opacity group while rendering the window and its children.

This works well in general, although any native child windows will of
course not be opaque. However, there is no way to implement
implicit paint flushing (i.e. draw the currently drawn double buffer
to the window in order to allow direct drawing to the window).
We can't flush in the stacked implicit paint case because there
is no way to get the right drawing behaviour when drawing directly
to the window. We *must* draw to the opacity group to get the right
behaviour.

We currently flush if:
* A widget disables double buffering
* You call move/resize/scroll a window and it has non-native children
  during the expose handler

In case this happens we warn and flush the outermost group, so there may
be drawing errors.

https://bugzilla.gnome.org/show_bug.cgi?id=687842
2013-02-07 11:11:37 +01:00
Alexander Larsson
ada6d81247 gdkwindow: Store the implicit paint in a list
This changes nothing, but lets us later have multiple
implicit paints

https://bugzilla.gnome.org/show_bug.cgi?id=687842
2013-02-07 11:11:37 +01:00
Olivier Fourdan
54dc823d67 gdk: add gdk_window_set_fullscreen_mode()
and gdk_window_get_fullscreen_mode() API to allow
applications to specify if a fullscreen window should
span across all monitors in a multi-monitor setup or
remain on the current monitor where the window is
placed.

Fullscreen mode can be either GDK_FULLSCREEN_ON_ALL_MONITORS
or GDK_FULLSCREEN_ON_CURRENT_MONITOR.

https://bugzilla.gnome.org/show_bug.cgi?id=691856
2013-01-25 13:16:56 +01:00
Alexander Larsson
7430559736 win32: Remove some unused input stuff to make win32 build again
Input events doesn't quite seem to work though, so it needs some fixing.
2012-03-06 12:04:36 +01:00
Carlos Garnacho
a490d2ebda gdk: Add internal API to set "pointer emulated" flag on events
This flag will be used for non-pointer events that are emulated
from eg. touch events, or pointer events being emulated.
2012-03-01 16:25:19 -05:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Alexander Larsson
68843a3e93 gdk: Remove unused _gdk_window_calculate_full_clip_region 2011-12-05 10:59:07 +01:00
Alexander Larsson
46d5b89830 gdk: Track the layered area
We track the areas that have alpha coverage so that we can
avoid using these as sources when copying window contents.
We also don't remove such areas from the clipping regions so
that they are painted both by parent and child.
2011-12-01 22:06:44 +01:00
Alexander Larsson
f51482e283 gdk: Track wether windows have alpha in the background
This will let us handle such windows differently in the
drawing machinery
2011-12-01 22:03:51 +01:00
Alexander Larsson
45df163e9d gdk: Remove now unused region tags completely 2011-12-01 13:38:04 +01:00
Matthias Clasen
220ba87ec0 GdkWindow: Struct packing improvements 2011-04-12 12:13:55 -04:00
Benjamin Otte
2a2ad8523f gdk: Add GDK_RENDERING environment variable
It's useful for debugging rendering issues, both correctness and
performance wise.

See the added documentation for what it does and how it works.
2011-03-11 02:10:47 +01:00
Alexander Larsson
a3b2840cae Remove support for GDK_NATIVE_WINDOWS
GDK_NATIVE_WINDOWS was a way to keep some old apps running that did weird
things in gtk2. We should not have to carry this forwards in gtk 3.x.

We do however keep a g_warning() call reminding people of this fact to
ease debugging when they try to port their applications.

https://bugzilla.gnome.org/show_bug.cgi?id=644119
2011-03-08 23:13:39 +01:00
Benjamin Otte
ec750bed0c gdk: Remove colormap debug category
We don't have colormaps anymore.
2011-01-21 02:54:09 +01:00
Matthias Clasen
32e3dcfb47 drop dead function 2010-12-21 12:07:01 -05:00
Matthias Clasen
985eb14469 Multiple changes to reduce the amount of unprefixed symbols
The X11 backend exports a number of symbols which are _-prefixed
(so don't become part of the gdk api), but are not named in a
way to prevent accidental clashes between backends.

The one API change here is that the gdk_xid_table functions
have been removed - they did not server an purpose, since the
xid table only stores windows anyway, and we already have a
lookup-by-xid function for windows.
2010-12-21 12:07:00 -05:00
Matthias Clasen
a251d3786b Remove sm-client-id related functions from headers 2010-12-21 12:06:59 -05:00
Matthias Clasen
2186203422 Remove unused get_offsets functions from headers 2010-12-21 12:06:59 -05:00
Matthias Clasen
224726f554 Remove gdk_windowing_{get_device_state,window_at_device_position}
The !trusted workaround code is pushed down into the GdkDevice
subclasses, and we use the device vfuncs directly in gdkdisplay.c
2010-12-21 12:06:59 -05:00
Matthias Clasen
ea96e5e16f Explode gdkinternals.h into per-class private headers
At the same time, move some more class and instance structs
out of public headers.
2010-12-21 12:06:58 -05:00
Matthias Clasen
218fa6757a Weed out no longer needed declarations 2010-12-21 12:06:57 -05:00
Matthias Clasen
5fa8791c86 Add a vfunc for _gdk_events_queue 2010-12-21 12:06:57 -05:00
Matthias Clasen
ec9c97752d Work toward turning GdkDisplayManager into a backend singleton
This commit hides the GdkDisplayManager instance and class structs,
adds vfuncs for listing displays, opening displays, and getting and
setting the default display. The X11 backend has a derived
GdkDisplayManagerX11.

The gdk_display_manager_get() function is responsible for deciding on
which of the compiled in backends to use. Currently, it consults the
GDK_BACKEND environment variable and falls back to x11.
2010-12-21 12:06:57 -05:00
Matthias Clasen
a169f6e32d Make GdkDevice parallel-implementable
Use the grab and ungrab vfuncs from the frontend instead of the
_gdk_windowing wrappers, and move some things around accordingly.
Again, only the X11 backend has been updated, other backends
need to be updated to match.
2010-12-21 12:06:56 -05:00
Matthias Clasen
c7559f57ed Hide GdkScreen too 2010-12-21 12:06:56 -05:00
Matthias Clasen
d5c0b92d5d Hide GdkDeviceManager and GdkDeviceManagerClass
And nuke GdkDeviceManagerPrivate at the same time. Again a commit
that only deals with the X11 backend, other backends will need to
catch up.
2010-12-21 12:06:56 -05:00
Matthias Clasen
c6a5074295 Move GdkVisual parallel-implementable
It turned out no vfuncs were necessary. I've decided to move
the screen member up to GdkVisual, since it is the same in all
backends. The X11 backend subclasses now, to add the X members
that it needs to keep track of. GdkVisual and GdkVisualClass
are hidden now.
2010-12-21 12:06:56 -05:00
Matthias Clasen
c53ec081ce Add vtables for DND
This commit hides GdkDragContext and GdkDragContextClass, adds
vfuncs for most drag context functionality, and turns the X11 DND
implementation into GdkDragContextX11. We also add vfuncs to
GdkDisplay for gdk_drag_get_protocol and to GdkWindow for
gdk_drag_begin, and implemenet them for X11.
Other backends need similar treatment and are broken now.
2010-12-21 12:06:56 -05:00
Matthias Clasen
06f75b3727 Make GdkAppLaunchContext display-dependent
Add a GdkDisplay::get_app_launch_context vfunc, and a
gdk_display_get_app_launch_context that for X11 returns a subclass.
For win32 and quartz, the implementations were trivial, so we
just return a new GdkAppLaunchContext without subclassing. Since
the type of the context now depends on the display,
gdk_app_launch_context_set_display is deprecated.
2010-12-21 12:06:55 -05:00
Alexander Larsson
ae146a2817 Convert a bunch of visual related calls to use the screen vtable 2010-12-21 12:06:55 -05:00