Commit Graph

401 Commits

Author SHA1 Message Date
Jasper St. Pierre
bb7bf07af6 gdkwindow-broadway: Make queue_antiexpose implementation private 2014-06-21 18:45:38 -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
Antoine Jacoutot
be9d1e0b3b broadway backend: allow building on OpenBSD
On OpenBSD shm_open(3) is part of libc and there is not librt, so add an
according check.
Check if we have posix_fallocate before using it.

https://bugzilla.gnome.org/show_bug.cgi?id=728272
2014-04-18 18:20:34 +02:00
Bastien Nocera
f71f7215ab all: Name more idles and timeouts
Following up from 438cd857c4,
name more timeouts and idles.

The original grep was missing checking for gdk_threads_add_*()
functions (at least for some of the files).

https://bugzilla.gnome.org/show_bug.cgi?id=726870
2014-03-26 20:09:30 -04:00
Pierre-Eric Pelloux-Prayer
ad39298f6d broadway: make sure color/delta run length do not overflow
Fixes bug 723045.
2014-03-21 21:45:04 +01: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
Ryan Lortie
ff0c470e34 broadway: remove unused libcrypt
eb1ab0dac2 removed support for authentication
based on crypt()-hashed passwords but it didn't remove the header.

Finish up with the removal.

This allows the broadway backend to build on FreeBSD (which has no
crypt.h).

https://bugzilla.gnome.org/show_bug.cgi?id=726149
2014-03-12 00:17:09 -04:00
Benjamin Otte
32a420b7d6 broadway: Print a useful error message
.. instead of the generic "failed to open display".
2014-03-05 21:03:36 +01: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
e34bd4137d docs: use apostrophes in *n't 2014-02-07 13:32:47 -05:00
Alexander Larsson
67bcc6f04f broadway: Improve touch events
We now respect core pointer grabs, and we do the pointer emulation
detection on the browser side.
2013-11-14 11:05:16 +01:00
Alexander Larsson
4226f97d54 broadway: Support ipad on-screen keyboard
We add a custom im module for broadway that calls some broadway
specific APIs to show/hide the keyboard on focus in/out. We then forward this
to the browser, and on the ipad we focus an input field to activate
the keyboard.
2013-11-13 12:23:06 +01:00
Alexander Larsson
ca89f5ab93 broadway: Send focus out events 2013-11-13 12:23:06 +01:00
Alexander Larsson
6917746c8e broadway: Fix focus handling with touch events 2013-11-13 12:23:06 +01:00
Alexander Larsson
4e8fa55827 broadway: Support window resize/drag via touch 2013-11-12 16:45:14 +01:00
Alexander Larsson
82acc05cba broadway: Add initial touch event support
This seems to get something going on an ipad, but some events seem
to get swallowed. For instance, window dragging doesn't work.
2013-11-12 16:11:15 +01:00
Alexander Larsson
d21ac217d3 broadway: Disable all kinds of viewport scrolling and zooming 2013-11-12 13:44:56 +01:00
Alexander Larsson
e331d17626 broadway: Raise window on first click. 2013-11-12 12:36:05 +01:00
Alexander Larsson
d8c17d0739 broadway: Add raise/lower ops 2013-11-12 12:23:58 +01:00
Alexander Larsson
ddade66496 broadway: use 'click-to-focus' approach instead of 'focus-follows-mouse'
The broadway backend would move the focus from one window to another based on
where the mouse was (i.e. 'focus-follows-mouse' approach). Handling the focus
this wait didn't play well with widgets which rely on focus-in-event and
focus-out-event, like the GtkEntry when using a completion popup window, see
e.g:
  https://bugzilla.gnome.org/show_bug.cgi?id=708984

So instead, setup broadway to require a click in a window to move the focus
(i.e. 'click-to-focus' approach):

 * The implicit GDK_FOCUS_CHANGE events that were generated upon reception of
   BROADWAY_EVENT_ENTER or BROADWAY_EVENT_LEAVE are removed.

 * The broadway daemon will now keep track of which is the focused window

 * Whenever the daemon detects an incoming BROADWAY_EVENT_BUTTON_PRESS, it will
   trigger the focused window switch, which sends a new BROADWAY_EVENT_FOCUS to
   the client, specifying which windows holds the focus.

 * Upon reception of a BROADWAY_EVENT_FOCUS, the client will generate a new
   GDK_FOCUS_CHANGE.

 * gdk_broadway_window_focus() was also implemented, which now requests the
   focus to the broadway server using a new BROADWAY_REQUEST_FOCUS_WINDOW.

This is based on an initial patch from Aleksander Morgado <aleksander@lanedo.com>.
2013-11-12 12:03:50 +01: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
Alexander Larsson
180517f5e8 broadway: Add buffer decoding colorizing
If you add ?debug=decoding to the url you will get colorized debug
info for the buffer decoder.
2013-11-08 13:44:00 +01:00
Alexander Larsson
688b6e63b5 broadway: Extract buffer decoding to separate helper 2013-11-08 13:44:00 +01:00
Rico Tzschichholz
b851db113e broadway: Add rawinflate.min.js to EXTRA_DIST
In addition to 149b3af105
2013-11-07 17:44:08 +01:00
Alexander Larsson
149b3af105 broadway: Use zlib compression for broadway buffers
This imports the MIT licensed js unzip from:
https://github.com/imaya/zlib.js

and uses it to decompress in js on the client side.
2013-11-07 14:09:53 +01:00
Alexander Larsson
5ef114ba42 Switch from sending png frames to our own encoding
This is based on the rolling hashes code from
http://cgit.freedesktop.org/~krh/weston/log/?h=remote

It works by incrementally calculating hashes for every 32x32 block
in each frame sent, and then refering back to such blocks when
encoding the next frame. This means we detect when a block matches
an existing block in the previous frame in a different position.
This is great for detecting scrolling, which we need now that
the gdk level scrolling is neutered.
2013-11-07 14:09:53 +01:00
Alexander Larsson
bbfe7e0e69 broadway: Always use client side decorations 2013-11-07 14:09:53 +01:00
Alexander Larsson
c6a3c0e4eb broadway: Implement gdk_window_begin_move_drag() 2013-11-07 14:09:53 +01:00
Alexander Larsson
3be4038d02 broadway: Add gdkbroadwaydisplay.h include 2013-11-07 14:09:53 +01:00
Alexander Larsson
6e308dc7c7 broadway: Simplify frame handling and make it ARGB32
This completely removes the delta compression and makes all buffers ARGB.
This is obviously slower, but this will be re-integrated later.
2013-11-07 14:09:53 +01:00
Alexander Larsson
b436f06a94 broadway: Remove window translation code
This is no longer used as we neutered gdk_window_scroll & co.
2013-11-07 14:09:53 +01:00
Jasper St. Pierre
0a40951f40 Revert "broadway: Fix gcc warning"
This reverts commit f0d3d72574.
2013-11-05 11:14:01 -05:00
Benjamin Otte
f0d3d72574 broadway: Fix gcc warning 2013-11-04 16:36:11 +01:00
Jasper St. Pierre
e109f10017 broadway-server: Fix signedness issue 2013-10-31 12:20:04 -04:00
Manuel Bachmann
572e58123e Broadway : Replaced be32toh() with win32-compatible ntohl() 2013-10-31 00:43:58 +01:00
Jasper St. Pierre
d7417580b7 broadway: Don't bother memdup-ing
If we're going to run off the end due to an invalid message,
we're going to run off the end. We'll protect this by doing
proper bounds checking in the future, but the malloc gives
us nothing for now.
2013-10-07 16:19:01 -04:00
Jasper St. Pierre
0d0ff40d2f broadway: Use a binary protocol to send to the server
This makes the protocol easier to inspect over the wire and makes all
commands fixed-length.
2013-10-07 16:19:01 -04:00
Jasper St. Pierre
eb1ab0dac2 broadway: Remove authentication support 2013-10-07 16:19:01 -04:00
Jasper St. Pierre
f2e30144f8 broadway: Remove support for old browsers
Require binary array buffers and modern WebSocket protocol support.
2013-10-07 16:19:01 -04:00
Alexander Larsson
b2113b7384 gdk: Add gdk_cursor_new_from_surface
We need this to be able to handle scaled cursor images.
We implement the new _from_pixbuf by converting to a surface and
assuming the scale was 1.
2013-08-07 13:34:10 +02:00
Alexander Larsson
71fe43543c gdk: Add gdk_cursor_get_surface()
We want a surface so we can properly represent the scale factor for it.
All backends are converted to use surfaces and we reimplement the
backwards compat code in the generic code.
2013-08-07 13:34:10 +02: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
Chun-wei Fan
2268e9d6c9 Broadway: Allow Compilation on Windows/MSVC
-Don't include unistd.h unconditionally as it's not available in Visual
 Studio, but include io.h where necessary.
-Avoid C99isms, and use _chsize_s in place of ftruncate when unistd.h is
 not available (as in the case of Visual Studio)
2013-07-01 14:51:03 +02:00
Tarnyko
4b49c44b0a win32: Make broadway build 2013-07-01 14:46:25 +02:00
Jani Välimaa
44b287a4ae Ensure broadway backend links when using as-needed linking
Error message at:
http://pkgsubmit.mageia.org/uploads/failure/cauldron/core/release/20130617185755.wally.valstar.6794/log/gtk+3.0-3.9.4-1.mga4/build.0.20130617185804.log

<ovitters> mclasen_:
http://svnweb.mageia.org/packages/cauldron/gtk%2B3.0/current/SOURCES/gtk%2B-3.9.4-linking.patch?revision=444164&view=markup
<ovitters> mclasen_: gtk doesn't seem to link properly on Mageia
(as-needed thing probably)
<mclasen_> sure, looks fine
<ovitters> can I commit this?
<mclasen_> yes, please commit
2013-06-17 21:55:30 +02:00
Tarnyko
53a9311e2c broadway: Add win32 support 2013-06-13 19:35:43 +02:00
Tarnyko
e2da2259ad broadway: Support TCP displays 2013-06-13 19:12:46 +02:00
Tarnyko
d4dacc596f broadway: Only use gio-unix on G_OS_UNIX 2013-06-13 18:15:10 +02:00
Tarnyko
050702494b broadway: Remove unused includes 2013-06-13 18:09:32 +02:00
Tarnyko
b20d949470 broadway: Add configure checks for sys/mman.h 2013-06-13 18:01:44 +02:00
Alexander Larsson
19560bf0d4 gdkwindow: Remove translate vfunc
This is not used anymore
2013-05-07 16:33:00 +02:00
Matthias Clasen
8af16c5d44 New visibility handling in gdk
Change the visibility handling to be the same way we do it in
GLib now. We pass -fvisibility=hidden to gcc and decorate public
functions with __attribute__((visibility("default"))).

This commit just does this for GDK, GTK+ will follow later.
2013-05-05 15:38:48 -04:00
Matthias Clasen
ca81028901 Add GDK_AVAILABLE_IN_ALL annotations in gdk
This is in preparation to modernizing our handing
of exported symbols.
2013-05-05 15:38:46 -04:00
Benjamin Otte
d67880bf72 broadway: Remove displaymanager implementation
This is an API break, but the broadway backend is unsupported, so we can
get away with it.
2013-05-02 16:15:22 +02:00
Benjamin Otte
a6a4428f23 gdk: Unvfuncify gdk_display_manager_open_display()
This looks like a pretty stupid patch, but it's only a step towards the
ultimate end goal: Get rid of all the displaymanagers.
2013-04-19 16:23:43 -04:00
Benjamin Otte
c1607c14d5 broadway: Get rid of generic macros
Use existing API instead.
2013-04-19 16:18:25 -04:00
Benjamin Otte
f345051d36 displaymanager: Emit display-opened directly
Instead of letting every backend do it manually.
2013-04-19 16:18:25 -04:00
Benjamin Otte
065a8da87a gdk: Refactor default key vfuncs
Instead of copying them all over the place, keep a default
implementation around.
2013-04-16 15:30:14 +02:00
Benjamin Otte
1651d9ac3e broadway: Delete 2 files doing nothing
A function was doing nothing but calling a function that was in its own
source file doing nothing but calling a function in its own source file
that did nothing.
2013-04-16 15:30:14 +02:00
Benjamin Otte
aa9e974c86 gdk: Make atoms handled generically
This is another step towards making GdkDisplayManager backend-agnostic.

Most of the backends profit from this as their atom implementations
where generic anyway - x11 needed that to allow multiple X displays and
broadway, quartz and wayland don't have the concept of displays.

The X11 backend still did things, so I only #if 0'd some code but did
not actually update anything.
2013-04-15 15:43:27 +02:00
Benjamin Otte
7ef508ff4a displaymanager: Handle list of displays in base class
This moves the add/remove_display() functions from the subclasses to
GdkDisplay and GdkDisplayManager. It also gets rid of the list_displays
vfunc.
2013-04-15 15:43:26 +02:00
Benjamin Otte
839f402191 displaymanager: Handle the default display
... instead of having every backend do it on their own.
2013-04-15 15:43:26 +02:00
Alexander Larsson
9a79c3d643 broadway: Unsure we clear the grab on window hide 2013-04-05 17:07:04 +02:00
Alexander Larsson
a6a768437d broadway: Fix warning
Don't pass NULL source_device in grab/ungrab events
2013-04-05 17:07:03 +02:00
Alexander Larsson
8084e6e468 broadway: Ensure we allocate shm surface space early
This is nicer then getting random sigbus later
2013-04-03 15:58:42 +02:00
Alexander Larsson
c340dfeaf8 Broadway: Fix shm names
We were sometimes getting zero chars in the name, making them
shorter, due to an off-by-zero in the size.
2013-04-03 15:58:41 +02:00
Alexander Larsson
b7a1561fef broadway: destroy old surface before creating new one
We were not using the old one anyway, and this may in some cases
use less memory (although in most cases the server has a ref to the
surface anyway).
2013-04-03 15:58:40 +02:00
Benjamin Otte
a55f1f4e95 broadway: Mark deprecated function call
... to avoid gcc warning us. Ideally, we'd not call a deprecated
function here, but I'm lazy.
2013-04-02 11:45:44 +02:00
Benjamin Otte
dc132a9895 broadway: Don't use deprecated API 2013-04-02 11:45:44 +02:00
Benjamin Otte
a6b29d73d7 gdkdisplay: Remove get_screen() and get_n_screens() vfuncs 2013-04-02 11:45:44 +02:00
Alexander Larsson
40c3062d33 broadway: Use wss: on https: uris 2013-04-01 17:44:33 +02:00
Alexander Larsson
e9b8b5c1f0 broadway: Reuse surfaces passed to server
This way we don't have to reopen all the time for pure updates,
and we can immediately unlink the shm file to avoid "leaking" them
on improper shutdown.
2013-03-29 14:09:47 +01:00
Alexander Larsson
c6baa9bc25 broadway: Move surface open to server
This way we can cache the last opened surface
2013-03-29 14:09:47 +01:00
Alexander Larsson
6ef8589a51 broadway: Make chrome work again 2013-03-29 14:09:47 +01:00
Alexander Larsson
8289f4cdc9 broadway: Add support for password authentication 2013-03-29 14:09:47 +01:00
Alexander Larsson
1148a375e5 broadway: Limit window resize based on window geometry 2013-03-29 14:09:47 +01:00
Alexander Larsson
71b4557210 broadway: Sync surface updates with paint clock
We now only update surface data after we have painted. Before we painted
in an idle, which meant we might send black data some times if we e.g.
resized the window and had not painted yet. Also, it means we're updating
less often to the daemon, saving resources.

We still have to queue a flush in the idle for non-draw operations,
otherwise e.g. resize of a toplevel will never be flushed if the clock
is frozen (e.g. during toplevel resize).
2013-03-29 14:09:47 +01:00
Alexander Larsson
a20cb3dd25 broadway: Ensure window sizes are synched right
We don't want to update the window size on configure event, only
the position, as the size is client side controlled. We were
updating to an old size during resizes which causes us to send
surfaces of the wrong size to the daemon.
2013-03-29 14:09:46 +01:00
Alexander Larsson
19e683e62a broadway: Clean up moveresize code 2013-03-29 14:09:46 +01:00
Alexander Larsson
0129876ed3 broadway: Remove leftover cruft that caused resize to fail
getTransientToplevel() doesn't exist anymore so this broke.
2013-03-29 14:09:46 +01:00
Alexander Larsson
e9906138e5 broadway: Fix mouse position typo 2013-03-29 14:09:46 +01:00
Matthias Clasen
38eab78904 broadway: Don't use deprecated gdk_cursor_ref 2013-03-24 14:22:38 -04:00
Matthias Clasen
832c698776 Implement GInitable in GdkBroadwayDisplayManager
Add GInitable implementation and fail the initialisation if it is not
possible to set up a broadway server.
2013-03-23 00:48:25 -04:00
Alexander Larsson
8fb60cda19 broadway: Fix assert failure
Requests are not limited in size by BroadwayRequest, as
BroadwayRequestTranslation can be of variable size. No need
to copy the request anymore though, because requests are aligned
now.
2013-03-18 16:41:05 +01:00
Alexander Larsson
99cc5758b1 broadway: Ensure broadway request members are 32bit aligned 2013-03-18 16:41:02 +01:00
Benjamin Otte
c7cf937789 broadway: pointer targets differ in signedness 2013-03-01 16:25:14 +01:00
Benjamin Otte
9d55b3c6fd broadway: variable 'broadway_display' set but not used 2013-03-01 16:25:14 +01: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
Owen W. Taylor
645b5f398d Reimplement _NET_WM_SYNC_REQUEST inside X11 backend
Deprecate gdk_window_enable_synchronized_configure() and
gdk_window_configure_done() and make them no-ops. Implement the
handling of _NET_WM_SYNC_REQUEST in terms of the frame cycle -
we know that all processing will be finished in the next frame
cycle after the ConfigureNotify is received.
2013-02-14 17:19:51 -05:00
Alexander Larsson
ada20f475d broadway: Make /dev/shm names nicer 2013-01-10 23:59:23 +01:00
Alexander Larsson
da8ff82df5 broadway: Make Sec-WebSocket-Origin optional
Sometimes we get no Origin in the request
2013-01-10 22:50:03 +01:00
Alexander Larsson
2e76e5a543 broadway: Allow binding http server to an ip 2013-01-10 21:38:39 +01:00
Alexander Larsson
befde1f7de broadway: Remove leftover typedef 2013-01-10 16:00:43 +01:00
Alexander Larsson
5708e2bc2c broadway: Update TODO 2013-01-08 18:05:06 +01:00
Alexander Larsson
d5812de2e6 broadway: Send window size to new clients
Tell all new clients about the current (last sent) window size.
2013-01-08 18:05:06 +01:00
Alexander Larsson
35c295da89 broadway: Don't allow dragging windows above top of window
This is highly confusing and makes it impossible to get the windows
back.
2013-01-08 18:05:06 +01:00
Alexander Larsson
8e686357c4 broadway: Move window position ownership to browser
With this we always roundtrip position change to the webbrowser.
This avoids conflicts when things change from both directions (app and user).

Also, we fake configure evens when there is no web client to ensure
apps get the events.
2013-01-08 18:05:06 +01:00
Alexander Larsson
4d7b822059 broadway: Make the InputMessage type a uint32
That way we don't get any holes in the structs.
2013-01-08 18:05:06 +01:00
Alexander Larsson
f72d1a8d2b broadway: Fix gdk_broadway_server_wait_for_reply
We didn't properly queue an idle to handle the read messages so they
were never serviced in some situations.
2013-01-08 18:05:06 +01:00