Compare commits

...

286 Commits

Author SHA1 Message Date
Matthias Clasen
940971bd2b 3.7.6 2013-01-15 00:04:07 -05:00
Matthias Clasen
2adf1a4966 Ignore more private headers when generating docs 2013-01-15 00:03:58 -05:00
Matthias Clasen
8d81b1a4cd Don't run gtkdoc-check in make check
It fails for dubious reasons that should not cause make check
to fail, such as a few undocumented symbols.
2013-01-15 00:03:58 -05:00
Matthias Clasen
065f9529ce Remove a no-longer existing symbol 2013-01-15 00:03:58 -05:00
Matthias Clasen
cdaa6e036e Update expected output of a11y tests
The output for GtkAboutDialog changed as a result of the
Homepage -> Website string change.
2013-01-14 23:12:36 -05:00
Matthias Clasen
af805e9cb6 Remove some non-warranted checks from builder tests
These tests were making assumptions about the properties of
cell renderers outside of rendering, which we don't give any
guarantees for.
2013-01-14 23:09:40 -05:00
Benjamin Otte
cba4156ef6 scrolledwindow: Use child-visible instead of visible for scrollbars
We want to reserve space for the size of the scrollbars even when they
are not visible. And because toggling visibile to off now returns 0 for
size requests, this won't work anymore.
2013-01-14 18:13:10 +01:00
Benjamin Otte
97ba4b1b8e window: Don't use set_allocation() to store cached values
The window size can be queried on widget->window directly, no need to
store it in widget->allocation.
This change is necessary because gtk_widget_set_allcation() is now
checking invariants that assume it's called from insize
gtk_widget_size_allocate() and that wasn;t the case here.
2013-01-14 18:13:10 +01:00
Cosimo Cecchi
aa77cd6501 range: don't trim the trough rectange by the trough margin
Commit e32da246a8 made GtkRange's trough
respect the CSS margin property, but it also trimmed the box in which
the trough reacts to click events by the margin.
We still want to catch events in that area instead, and just make sure
the margin is applied when drawing (which was already implemented by
that commit).

This commit reverts the parts of
e32da246a8 that didn't involve drawing,
fixing the bug.

https://bugzilla.gnome.org/show_bug.cgi?id=691677
2013-01-14 10:20:43 -05:00
Gabor Kelemen
376e8d568e Updated Hungarian translation 2013-01-14 11:42:57 +01:00
Kjartan Maraas
e946cc52b6 Updated Norwegian bokmål translation 2013-01-14 11:18:30 +01:00
Theppitak Karoonboonyanan
8a1c1d16f6 Updated Thai translation 2013-01-14 14:25:34 +07:00
Benjamin Otte
f260affbb8 a11y: Implement get_name() instead of setting variables
This avoids a later free of this const value.
2013-01-14 00:01:44 +01:00
Benjamin Otte
1205e3b043 x11: unconst-cast result of g_get_prgname()
X doesn't like const...
2013-01-13 23:47:39 +01:00
Fran Diéguez
ced451b09a Updated Galician translations 2013-01-13 17:30:54 +01:00
Matthias Clasen
fff4c8e841 Documentation fixes
The documentation for GtkMenuButton was still referring to a
"menu" properties in several places, though it has been renamed
to "popup".
2013-01-13 08:27:20 -05:00
Matthias Clasen
974f8dfc71 Typo fix 2013-01-13 08:27:20 -05:00
Matej Urbančič
a4db4d1f88 Updated Slovenian translation 2013-01-13 11:54:16 +01:00
Duarte Loreto
a2dc30ca8b Updated Portuguese translation and converted to New Spelling (Novo AO) 2013-01-13 00:26:44 +00:00
Duarte Loreto
bc675d46f1 Updated Portuguese translation and converted to New Spelling (Novo AO) 2013-01-13 00:03:44 +00:00
Geoff Reedy
2fcbe3a9b4 x11: add missing checks that a hint is supported
Before acting on any hint that is set by the window manager we must
first check that the hint is supported by the current window manager.
Checking that a property has a value is insufficient as it may have
been set by a previous window manager which did support the hint.

https://bugzilla.gnome.org/show_bug.cgi?id=691515
2013-01-12 18:38:37 -05:00
Gheyret Kenji
246438812a Updated Uyghur translation
Signed-off-by: Gheyret Kenji <gheyret@gmail.com>
2013-01-12 15:32:50 +09:00
Alexander Shopov
88b247f0ba Updated Bulgarian translation 2013-01-12 07:11:25 +02:00
Alexander Shopov
213b82e87e Updated Bulgarian translation 2013-01-12 07:08:02 +02:00
Nilamdyuti Goswami
1aabfbaae8 Assamese translation updated 2013-01-11 21:29:02 +05:30
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
Ross Burton
53083ea7b4 build: support cross-compilation by natively building gtk-update-icon-cache
When cross-compiling, instead of depending on a natively built GTK+ (which means
building Glib, ATK, Pango, gdk-pixbuf, libX11...) for gtk-update-icon-cache,
find the host compiler and gdk-pixbuf, and build another gtk-update-icon-cache
with that.

This uses AX_PROG_CC_FOR_BUILD from autostars to find the host compiler, and
assumes that you'd set PKG_CONFIG_FOR_BUILD to a host pkg-config binary.

https://bugzilla.gnome.org/show_bug.cgi?id=691301
2013-01-10 15:00:32 +00:00
Alexander Larsson
befde1f7de broadway: Remove leftover typedef 2013-01-10 16:00:43 +01:00
Alexander Larsson
b39cfb304a broadway: We need gio-unix for the unix domain sockets 2013-01-10 16:00:13 +01:00
Kjartan Maraas
e8f5bf0b30 Updated Norwegian bokmål translation 2013-01-10 13:42:44 +01:00
William Jon McCann
e8224d138d Use Website instead of Homepage
https://bugzilla.gnome.org/show_bug.cgi?id=691375
2013-01-08 19:45:20 -05: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
Alexander Larsson
6f910e5e02 broadway: Clean up broadwayd event sending code
Use the right size and put the client serial in the right place.
2013-01-08 18:05:06 +01:00
Alexander Larsson
c83d35d1df broadway: Rewrite serials for clients
This seems right, but atm it breaks grabs.
2013-01-08 18:05:06 +01:00
Alexander Larsson
71e7912940 broadway: Remove last_serial from BroadwayReplyBase
This is not used anyway.
2013-01-08 18:05:05 +01:00
Benjamin Otte
ad723bd9a9 widget: Remove leftover debug statement
Seems we didn't hit this very often. :)
2013-01-08 16:10:30 +01:00
Benjamin Otte
b495ce5446 widget: Give some meaning to "visible"
GtkWidget::visible is required for the widget to:
- have a preferred size other than 0/0
- have a size allocated
- return other values than { -1, -1, 1, 1 } from get_allocation()

This is an experimental patch aiming to make concepts and behaviors
inside GTK more concreate. GtkWidget::visible is now essentially what
CSS does for "display: none".

Note that if you want the effect of CSS's "visibility: hidden", you'll
have to use a GtkNotebook with an empty page as the concept of reserving
space but not drawing anything isn't supported natively in GTK.
2013-01-08 14:56:02 +01:00
Benjamin Otte
9be7e3e2d8 treeviewcolumn: Show button if we're visible
Previously, we were happily working with a hidden button.
2013-01-08 14:55:41 +01:00
Benjamin Otte
da100207b3 sizerequest: Make invisible widgets return a 0x0 size. 2013-01-08 12:26:04 +01:00
Benjamin Otte
33e690a9ad tests: Don't use unicode escapes
Otherwise gcc complains that GTK isn't C99.
2013-01-08 12:24:32 +01:00
Benjamin Otte
b867970bf4 tests: return 0; from main()
So that gcc stops complaining.
2013-01-08 12:23:52 +01:00
Nicola Fontana
cd67593c9f configure.ac: fix autoreconf with automake-1.13 2013-01-07 15:28:25 +00:00
Javier Jardón
5509bf2872 docs: Use gtk-doc-check in make check 2013-01-07 15:26:03 +00:00
Kjartan Maraas
212a21026f Updated Norwegian bokmål translation 2013-01-07 11:09:13 +01:00
Benjamin Otte
8a644e4f16 stylecontext: Make font hack not crash
It's a lot uglier now, but it shouldn't crash anymore.

We must update the font description for animations, but we can't free it
on query, because some paths call gtk_style_context_get_font() twice in
a row without stopping the use of the first call. So us just creating a
new font description all the time and unreffing the old one is not a
good idea. So we just mere the new one into the old one.

https://bugzilla.gnome.org/show_bug.cgi?id=691186
2013-01-07 01:11:42 +01:00
Baurzhan Muftakhidinov
15129ae170 Updated Kazakh translation 2013-01-05 20:59:45 +06:00
Murray Cumming
7114e63cee iconhelper: treat the empty string as a NULL stock-id
https://bugzilla.gnome.org/show_bug.cgi?id=687025
2013-01-04 17:21:11 +01:00
Andrew Potter
00795e8d05 GtkApplication: properly unexport x11 menus
https://bugzilla.gnome.org/show_bug.cgi?id=688362
2013-01-04 15:50:10 +01:00
Fabian Henze
7ace438166 Fix the annotations of gtk_color_chooser_get_rgba()
https://bugzilla.gnome.org/show_bug.cgi?id=687633
2013-01-04 15:42:39 +01:00
Volker Sobek
d2c6a6bdfe docs: fix typo in gtkbuildable
https://bugzilla.gnome.org/show_bug.cgi?id=690305
2013-01-04 15:36:32 +01:00
Tristan Brindle
f48e9b1d20 Add missing annotation for gtk_combo_box_text_get_active_text()
https://bugzilla.gnome.org/show_bug.cgi?id=688140
2013-01-04 15:30:46 +01:00
Rūdolfs Mazurs
5474259dea Updated Latvian translation 2012-12-30 15:49:29 +02:00
Baurzhan Muftakhidinov
fa1dc252df Updated Kazakh translation 2012-12-29 23:41:57 +06:00
Balázs Úr
c50bcf5891 Updated Hungarian translation 2012-12-29 16:24:29 +01:00
Benjamin Otte
6b9b925add widget: Fix initial state flags for RTL 2012-12-29 02:33:14 +01:00
Benjamin Otte
3e979d911b widget: Fix state propagation code
Previously, with STATE_FLAGS_REPLACE we would unset _all_ the state
flags on children, not just the ones that do propagate. This caused the
RTL/LTR flags to get lost.
2012-12-29 02:24:27 +01:00
Benjamin Otte
b068b18c78 menu: Huh?
What was that code supposed to achieve? Why are we unsetting flags that
might be useful?
2012-12-29 02:07:09 +01:00
Benjamin Otte
cc986fdc1c widget: Remove underscore prefix from static function 2012-12-29 02:06:51 +01:00
Benjamin Otte
b39bb4400e progressbar: Store activity position as percentage
... instead of in absolute pixels.
2012-12-29 01:00:15 +01:00
Benjamin Otte
02b440b466 progressbar: Remove activity_step from private struct
It's only used locally, so use a local variable
2012-12-29 01:00:15 +01:00
Khaled Hosny
6a229fe50a Typo 2012-12-28 20:32:40 +02:00
Matthias Clasen
5adecf183b Move single-include guards inside include guards
gcc has optimizations for include guards that only work
if they are outermost in the the header.
https://bugzilla.gnome.org/show_bug.cgi?id=689810
2012-12-28 09:57:56 -05:00
Arash Mousavi
4d4b6a8658 l10n: Updated Persian translation 2012-12-28 12:05:42 +03:30
Alexander Larsson
ec45d2f8c7 broadway: Handle NULL surface in update
This happen if nothing has been drawn yet.
2012-12-27 22:56:04 +01:00
Alexander Larsson
e00bc73de8 broadway: Rename gdkbroadway-server-client.c to gdkbroadway-server.c 2012-12-27 22:56:04 +01:00
Alexander Larsson
6410a43b76 broadway: Make resize grip work again 2012-12-27 22:56:04 +01:00
Alexander Larsson
aac4a027eb broadway: Stop default mouse button handling
This makes it not possible to select the canvas objects, etc.
2012-12-27 22:56:04 +01:00
Alexander Larsson
9555478b9e broadway: Add TODO.broadway 2012-12-27 22:56:04 +01:00
Alexander Larsson
f84df03513 broadway: Move broadwayd to bin 2012-12-27 22:56:04 +01:00
Alexander Larsson
63b6c07fe0 broadway: During pointer grabs, send pointer events only to one client 2012-12-27 22:56:04 +01:00
Alexander Larsson
75ee72f2ac broadway: Make daemon side server "gdk independent". 2012-12-27 22:56:04 +01:00
Alexander Larsson
3558e655b4 broadway: Proper handling of http port and display nr 2012-12-27 22:56:04 +01:00
Alexander Larsson
59830a9001 broadway: Collect and document some TODOs 2012-12-27 22:56:04 +01:00
Alexander Larsson
329372a343 broadway: Track windows for client and kill on client exit 2012-12-27 22:56:04 +01:00
Alexander Larsson
5ee8b69418 broadway: Rename gdkbroadway-server.c to broadway-server.c
This way the broadway-*.c namespace is for the daemon and gdk* for the
gdk lib.
2012-12-27 22:56:03 +01:00
Alexander Larsson
8b9ccf4ee9 broadway: rename broadway-server to broadwayd
The "server" part is too confusing, there are to many servers around.
2012-12-27 22:56:03 +01:00
Alexander Larsson
e801d06229 broadway: Drop libbroadway.la
This is not needed anymore, its just used by the server.
2012-12-27 22:56:03 +01:00
Alexander Larsson
20b79b06ee broadway: rename broadway.[ch] to broadway-output.[ch] 2012-12-27 22:56:03 +01:00
Alexander Larsson
3005f1b844 broadway: disconnect in idle when needed
This makes the ownership cleaner
2012-12-27 22:56:03 +01:00
Alexander Larsson
fc96ef51d7 broadway: Initial version of separate broadway server
This kinda works but is very rudimentary
2012-12-27 22:56:03 +01:00
Alexander Larsson
4addb2108e broadway: Add OPs top protocol 2012-12-27 22:56:03 +01:00
Alexander Larsson
9aa36d8d0d broadway: Add enum for even types 2012-12-27 22:56:03 +01:00
Alexander Larsson
95a0c055da broadway: Break out broadway protocol in its own header 2012-12-27 22:56:03 +01:00
Matthias Clasen
58e96f6cbd docs: Restart a Deprecated section
We've accumulated enough wholly-deprecated objects again
that it makes sense to move them to their own section.
2012-12-27 12:38:43 -05:00
Matthias Clasen
6bc2a2da48 Another trivial sorting fix 2012-12-27 12:15:05 -05:00
Matthias Clasen
38963870eb Rename gtkcolorswatchaccessible.h
Call it gtkcolorswatchaccessibleprivate.h. This matches what we're
doing for non-public widget headers in gtk/.
2012-12-27 12:11:12 -05:00
Matthias Clasen
12f9b81b1e Drop separate scrollbar accessible implementation
It didn't really add anything to the range accessible implementation.
2012-12-27 12:06:23 -05:00
Matthias Clasen
9e9824a0a1 Add a test for deriving accessible implementations
This is a trivial example. Just check that we can derive
from GtkButtonAccessible, and have a GtkButton subclass
use the derived accessible implementation.
2012-12-27 12:06:22 -05:00
Matthias Clasen
d198ea6296 Install gtk-a11y.h
We add a separate gtk-a11y.h single-include header for
them. This header will work much the same as gtkx.h. It
will be installed in /usr/include/gtk-3.0/gtk, but you
have to include it separately.
2012-12-27 12:05:03 -05:00
Matthias Clasen
5fa4232404 Install a11y headers
We install the headers for the a11y implementations in
/usr/include/gtk-3.0/gtk/a11y/.
2012-12-27 12:05:02 -05:00
Matthias Clasen
c3577c66e5 Add single-include guards to a11y headers
More preparation for installing these headers.
2012-12-27 12:05:02 -05:00
Matthias Clasen
07a00d5939 Fix inter-header includes
Since we are going to install these headers soon, we need
to make their mutual includes work in the installed location
as well. Also, avoid including individual gtk headers, to
avoid trouble with single-include guards.
2012-12-27 12:04:01 -05:00
Matthias Clasen
d2944ce633 More gail removal
Rename GailMisc to GtkMiscImpl.
2012-12-27 11:27:46 -05:00
Matthias Clasen
4cd806ff0c Rename and clean up gailutil 2012-12-27 11:27:45 -05:00
Matthias Clasen
651241b685 Some renaming
Move gail.h to gtkaccessibility.h, and libgail to libgtka11y.
2012-12-27 11:27:45 -05:00
Matthias Clasen
221ac71278 Cosmetics
Replace GAIL in top comments by 'GTK+ - accessibility implementations'.
2012-12-27 11:27:44 -05:00
Matthias Clasen
e4b5e94eb9 Make accessible implementations public
This commit exposes the get_type() functions and standard
headers for accessible implementations. This makes it possible
to derive from the GTK accessible implementations without
GType magic tricks. This is necessary, because we require the
a11y type hierarchy to be parallel to the widget type hierarchy.
So, if you derive a widget and need to adjust its a11y implementation,
you have to be able to derive its accessible implementation.

This commit probably exposes more than is absolutely necessary,
it also exposes accessibles of widgets that are unlikely candidates
for deriving from.
2012-12-27 11:23:22 -05:00
Matthias Clasen
853b5e5fa2 Trivial sorting fix 2012-12-27 01:50:54 -05:00
Fran Diéguez
20c12b0570 Updated Galician translations 2012-12-24 21:55:07 +01:00
Paolo Borelli
70a5718b15 Paint GtkFrame background correctly when there is a label 2012-12-23 16:35:55 +01:00
Kjartan Maraas
4f2da634f1 Updated Norwegian bokmål translation 2012-12-22 20:52:49 +01:00
Benjamin Otte
308971cc2e roundedbox: Fix copy-paste error
y coordinates don't care about the right value, they want bottom.
2012-12-21 19:47:40 +01:00
Benjamin Otte
a70e85702f testgtk: Remove GtkAlignment usage from progressbar test
We can use gtk_widget_set_[hv]align here.
2012-12-21 19:47:40 +01:00
Cosimo Cecchi
81fa183b79 aboutdialog: ensure the credits page uses the "view" style class
Since not every theme renders a background for a GtkViewport (and
Adwaita master doesn't), ensure the grid+viewport we use to emulate a
text view here uses the "view" style class.
2012-12-21 17:55:26 +01:00
Kjartan Maraas
cd5fdc1e74 Updated Norwegian bokmål translation 2012-12-21 16:12:10 +01:00
Paolo Borelli
751a330ad8 Paint GtkFrame background
It already paints the css border, so let's make it also honor css
background. This is needed to have a box of a different color around
some widgets (e.g. latest gnome-clocks design)
2012-12-21 13:53:02 +01:00
Aurimas Černius
3dfce49032 Updated Lithuanian translation 2012-12-20 23:07:08 +02:00
Alexander Larsson
dfbabfbd6d broadway: Use SOURCE operator when scrolling 2012-12-20 00:00:16 +01:00
Alexander Larsson
9e65be6c48 broadway: Allow reconnecting to a broadway page 2012-12-20 00:00:16 +01:00
Alexander Larsson
54714cb228 broadway: Fix possible access-after-free
We need to calculate the buf pointer after the realloc.
2012-12-20 00:00:16 +01:00
Alexander Larsson
9c3cd49abd broadway: Remove separate browser windows hack
This never really worked well, we need to be able to fully handle
sizes from the client.
2012-12-20 00:00:16 +01:00
Alexander Larsson
0a808bea54 broadway: Separate out the server parts
This (shouldn't) change any behaviour, but it moves the
webserver parts to a separate file, making the broadway display file
smaller and preparing for later separating out the server to its own
process.
2012-12-20 00:00:16 +01:00
Shantha kumar
3824376afc Tamil translation updated 2012-12-19 13:22:27 +05:30
Shantha kumar
05240be589 Tamil translation updated 2012-12-19 13:22:27 +05:30
Benjamin Otte
cf712c462d combobox: Don't special-case RTL child positions anymore
If you want to get rounded corners on an hbox, instead of
  :first-child {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
  }
  :last-child {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
  }
you now need to write:
  :first-child, :last-child:dir(rtl) {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
  }
  :last-child, :first-child:dir(rtl)
  {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
  }
2012-12-18 18:25:42 +01:00
Benjamin Otte
821a675013 toolbar: Don't special-case RTL toolbar child positions anymore
If you want to get rounded corners on an hbox, instead of
  :first-child {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
  }
  :last-child {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
  }
you now need to write:
  :first-child, :last-child:dir(rtl) {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
  }
  :last-child, :first-child:dir(rtl)
  {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
  }
2012-12-18 18:25:42 +01:00
Benjamin Otte
6f86e57c4f box: Don't special-case RTL hbox child positions anymore
If you want to get rounded corners on an hbox, instead of
  :first-child {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
  }
  :last-child {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
  }
you now need to write:
  :first-child, :last-child:dir(rtl) {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
  }
  :last-child, :first-child:dir(rtl) {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
  }
2012-12-18 18:25:42 +01:00
Benjamin Otte
52768ee6ec stylecontext: Deprecate direction property
...  and the functions implementing it. Also deprecate the direction
getter on GtkThemingEngine.
2012-12-18 18:25:42 +01:00
Benjamin Otte
a73cc55e02 stylecontext: Use state flags for direction
... instead of using a custom direction member.

And with that, GtkWidget doesn't need to call
gtk_style_context_set_direction() anymore.
2012-12-18 18:25:42 +01:00
Benjamin Otte
1bf3de223a widget: Set state flags for direction 2012-12-18 18:25:42 +01:00
Benjamin Otte
f239edaf9c css: Parse and print the new state flags 2012-12-18 18:25:41 +01:00
Benjamin Otte
26186c74c6 API: Add state flags for RTL and LTR
See http://www.whatwg.org/specs/web-apps/current-work/#pseudo-classes
for the rationale.
2012-12-18 18:25:41 +01:00
Mattias Põldaru
94b65032a2 [l10n] Updated Estonian translation 2012-12-18 15:56:10 +02:00
Matej Urbančič
a612956ed5 Updated Slovenian translation 2012-12-18 08:50:17 +01:00
Matthias Clasen
8e4228bf12 bump version 2012-12-18 00:43:14 -05:00
Matthias Clasen
eecb9607a5 3.7.4 2012-12-18 00:37:25 -05:00
Matthias Clasen
33e5866b6f Update results for Unicode ellises 2012-12-18 00:14:53 -05:00
Matthias Clasen
b85ae11e0e Update for some changes to selectable/selected state handling
Since this is no longer implemented automatically in atk, some
accessibles, such as menus, loose their selectable state.
2012-12-18 00:02:09 -05:00
Matthias Clasen
f229945dab NotebookPageAccessible: Implement selectable/selected states
The automatic handling for this was removed from atk, so
we need to do it ourselves here.
2012-12-17 23:59:23 -05:00
Matthias Clasen
5bee1a994f GtkMenuItemAccessible: implement selectable/selected states
The automatic handling for this was removed in atk, so
we need to do it ourselves now.
2012-12-17 23:58:24 -05:00
Matthias Clasen
df1d331713 update_type_references: Deal with type_refs_ht being NULL
This can apparently happen, and it was breaking make check
on my system, by causing it to throw  a critical out of
g_hash_table_iter_init from here.
2012-12-17 22:45:08 -05:00
Matthias Clasen
e9aeb2fbca docs: Add an index for 3.8 api additions 2012-12-17 22:19:59 -05:00
Matthias Clasen
099a2b04a2 Fix up gtk_builder_expose_object addition
It needs an AVAILABLE_IN annotation in the header, and it
needs to be added to the symbols list.
2012-12-17 22:19:46 -05:00
Michael Natterer
597dc649e1 quartz: make setting_same_owner member of GtkClipboardOwner @public
to fix the build, thanks to parafin for the patch.
(cherry picked from commit e3e055f855)
2012-12-17 22:22:21 +01:00
Benjamin Otte
5e12aafacd stylecontext: Fix gtk_style_context_set_background()
This function is just a sophisitcated optimization.

If we know the GDK window's background will be opaque, we mark it as
opaque. This is so GDK can do all the optimizations it does for opaque
windows and be fast.

This is mainly used when scrolling.

The previous code didn't get this right, in particular it didn't enforce
a transparent background when it knew the background was not opaque.
2012-12-17 17:47:20 +01:00
Benjamin Otte
4cfd1f51c0 gdk: API: constify argument
gdk_window_set_background_rgba() should take a const RGBA.
2012-12-17 17:21:07 +01:00
Benjamin Otte
f770e9ac1e menushell: Remove unused variable
Introduced in 531d0dc32a. Welcome to the
club of people not using -Werror Stéphane.
2012-12-17 17:21:07 +01:00
Stéphane Démurget
531d0dc32a gtkmenushell: Fix an endless loop on focus cycle
This is a simple fallout from sealing gtkmenushell, which only appears
when F10 or Shift-F10 is used in a submenu.

https://bugzilla.gnome.org/show_bug.cgi?id=690266
2012-12-17 16:02:54 +01:00
Nilamdyuti Goswami
ebf9b9a0e7 Assamese translation updated 2012-12-17 15:00:40 +05:30
Christian Kirbach
4e60107c30 Updated German translation (bug 690302) 2012-12-17 01:45:16 +01:00
Piotr Drąg
6e85a64cf6 Updated Polish translation 2012-12-16 03:37:09 +01:00
Michael Natterer
343f1706bd gtk: fix scrolling in modal dialogs when event_widget is insensitive
When checking for modal grabs in gtk_main_do_event(), forward
GDK_SCROLL events to event_widget, even if it is insensitive.
2012-12-14 15:53:29 +01:00
Cosimo Cecchi
17a3325b2d cssstyleproperty: remove unused variable 2012-12-13 21:54:50 -05:00
Cosimo Cecchi
3782cf77c3 a11y: fix uninitialized variables compiler warning
The code path where we update the tooltip text property doesn't set
the state and value variables, and so doesn't need to call
notify_state_change().
Return early, and move the if block at the beginning of the function for
clarity.
2012-12-13 21:52:51 -05:00
Jasper St. Pierre
9dc4c5ce73 xi2: Abort early if we don't have a proper GDK window
This can happen in mutter or other applications that use GDK filters
but don't actually create GDK windows for everything they get events
for.

https://bugzilla.gnome.org/show_bug.cgi?id=689401
2012-12-13 10:51:38 -05:00
Alexander Larsson
444a92d6d8 IconHelper: Avoid warnings for non-existing stock ids
There are some registred stock ids like gtk-discards that have no icons,
and you could also pass a non-registred stock id. Both of these means
gtk_style_context_lookup_icon_set returns NULL, which causes
a critical in gtk_icon_set_render_icon_pixbuf.

We avoid this by just making these render as EMPTY.
2012-12-13 10:11:00 +01:00
Chun-wei Fan
656ec39c29 Bug 668239 - texts disappear when notebook switch page at zh_CN locate
In gtkimcontextime.c, use gdk_win32_window_get_impl_hwnd() to get to
the impl's existing native window instead of GDK_WINDOW_HWND() which
implicitly ensures a native window for the widget itself. This seems
to work around whatever GDK problem with native subwindows and fixes
the bug.

This is based on Michael Natterer's fix for gtk-2-24.
2012-12-13 11:03:56 +08:00
Alexander Larsson
0cb714fe62 Use GTK_RESIZE_PARENT resize_mode for GtkViewport
We used to use GTK_RESIZE_QUEUE, but that is problematic for e.g
a GtkScrolledWindow with NEVER scroll policies, as size changes
in ancestors will never get propagated to the scrolled window, causing
it to not have the correct size.

This is a slight performance hit, but in practice its not bound to be
problematic. In typical UIs there is only a single "large" GtkScrolledWindow
visible at a time, so a size requeust propagating out of such a window
will only hit the smaller amount of widgetry outside the scrolled window,
and additionally all such widgets will have their size request caches
still valid.

https://bugzilla.gnome.org/show_bug.cgi?id=690099
2012-12-12 15:03:24 +01:00
Yaron Shahrabani
4594e0fd34 Updated Hebrew translation. 2012-12-12 11:24:50 +02:00
Matthias Clasen
ea479e6bb9 Trivial whitespace fix 2012-12-11 21:30:40 -05:00
Alexander Larsson
1c05915f51 overlay: Fix child window position/size on realize
We don't get an automatic queue resize on realize anymore, which
was papering over this bug where we did not set the child window
size/position at realize time.
2012-12-11 15:41:50 +01:00
John Ralls
796ae50064 Fix compilation on MacOSX Tiger
NSInteger isn't defined until MacOSX Leopard, so in the 3 files that
use it, include ../gdk/quartz/gdkquartz.h which provides a typedef when
needed.
2012-12-10 16:51:31 -08:00
Juan Pablo Ugarte
a3e4fa3809 Added new function gtk_builder_expose_object() based on the original work by
Marco Diego Aurélio Mesquita on bug #447972
2012-12-10 14:53:53 -03:00
Alexander Larsson
d8fae21b1c css: Avoid looking up the GtkCssStyleProperty class a lot
Instead of constantly looking up the class we just stash it away in
class_init.
2012-12-10 14:49:51 +01:00
Alexander Larsson
a1ee2b7b82 css: Speed up name matching
We use the new g_type_get_type_registration_serial() so that we can
cache and properly invalidate the result of g_type_from_name().

This bumps the glib requirement to 2.35.3 to get the new function.

https://bugzilla.gnome.org/show_bug.cgi?id=689847
2012-12-10 12:57:10 +01:00
Alexander Larsson
089eafb468 css: Clean up tree_match implementations
A bunch of repeated code is broken out into the helper
gtk_css_selector_tree_match_previous().
2012-12-10 12:28:44 +01:00
Alexander Larsson
eb4667b6e1 css: Do get_change directly on the tree without matching first
Rather than first collecting matches and then getting the change
for them we do the change collection directly on the tree. This
is about twice as fast.
2012-12-10 12:11:02 +01:00
Alexander Larsson
03c626bb15 css: Factor out some of the position matching code 2012-12-10 12:11:02 +01:00
Mario Sanchez Prada
57e1e0de94 Add missing NULL-check in GtkEntryAccessible
Only call to atk_object_set_name if gtk_entry_get_icon_name() is not NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=689923
2012-12-09 11:52:11 +01:00
Daniel Mustieles
fb312af979 Updated Spanish translation 2012-12-08 19:50:40 +01:00
Colin Walters
549a0af12b Fix build by un-translating org.gtk.Settings.FileChooser
At the moment, gtk+ doesn't depend on intltool, which is the program
that knows how to translate schemas.  Attempting to translate them
causes a build failure, so for now, let's leave them in en_US.

https://bugzilla.gnome.org/show_bug.cgi?id=689584
2012-12-07 14:05:58 -05:00
Timothy Arceri
f1532993eb Add summary and description to "show-hidden" key
https://bugzilla.gnome.org/show_bug.cgi?id=689584
2012-12-07 11:57:45 -06:00
Cosimo Cecchi
26ea8e710a scale: render scale mark lines with separator style class
So that the theme can distinguish them from the mark text.
2012-12-07 11:41:03 -05:00
Cosimo Cecchi
b855e91f7a build: fix some GCC warnings 2012-12-07 11:35:06 -05:00
Michael Natterer
9d31a04d12 quartz: fix crash in the recent clipboard "fix", and really fix it
We must not release the GtkClipboardOwner in pasteboardChangedOwner
becaue we don't own a reference to ourselves (NSPasteboard does).
Instead, release the owner right after setting it, transferring
ownership to NSPasteboard

Also, fix repeated setting of the same owner by keeping the
owner around in GtkCLipboard, and re-use it if "user_data"
doesn't change. To avoid clipboard_unset()ting our own contents
in the process, add an ugly "setting_same_owner" boolean to
GtkClipboardOwner, set it during re-setting the same owner,
and avoid calling clipboard_unset() from pasteboardChangedOwner
if it's TRUE.
(cherry picked from commit 4a8df7a33c)
2012-12-07 12:30:15 +01:00
Jasper St. Pierre
34318b9163 gtkcssselector: Fix build
destroy vs. free strikes again
2012-12-06 17:48:15 -05:00
Jasper St. Pierre
736ccb6ce1 gtkcssselector: Don't leak the hash table
We should probably free the memory we allocate. Sounds like a winning
strategy.
2012-12-06 17:39:09 -05:00
Alexander Larsson
4ca293e006 treeview: Don't invalidate whole tree unless needed
We currently invalidate the whole tree every time the style state
changes in the tree view. The primary reason for this is to catch
default font changes as that may affect text cell renderers. But
cell renderers could *potentially* also read other style properties
(although that seems weird and unlikely).

We handle this by invalidating only when some state that affects sizes
is changed. This includes all the font properties.
2012-12-06 22:28:11 +01:00
Alexander Larsson
fd964ca178 textview: Only clear the layout in style_update if the font actually changes 2012-12-06 21:16:19 +01:00
Alexander Larsson
6dfee46cdb css: Add _gtk_css_style_property_affects_font
This checks if a style_update affects the font.
2012-12-06 21:14:02 +01:00
Alexander Larsson
e6de45964d entry: No need to reset layouts on style_updated
With pango handling changes to the PangoLayout there now is no
style changes that can affect the layout for the entry, so we don't
have to reset the layout whenever the style is updated.
2012-12-06 19:54:05 +01:00
Alexander Larsson
bf35c2f044 GtkLabel: Rely on the new pango support for context change tracking
Now that Pango tracks changes to the context automatically there is
no need to do it manually in e.g. style-updated or direction-changed,
in fact the only case we have to care about is when we re-create
the PangoContext due to a screen change, so we only have to clear
the layouts in GtkLabel in screen-changed.

This means we're not clearing all the layouts whenever the state changes,
which happens to every widget when the window is unfocused, which helps
performance a lot.

https://bugzilla.gnome.org/show_bug.cgi?id=340066
2012-12-06 19:54:05 +01:00
Alexander Larsson
53e08b58aa Require new pango with automatic tracking of PangoContext changes
Pango 1.32.4 has a feature where any PangoLayout automatically handles
the case where a PangoContext is changed. We want to rely on this to
avoid having to clear layouts too often, so we make this a hard dep.
2012-12-06 19:54:05 +01:00
Benjamin Otte
9ae9649188 stylecontext: Deprecate gtk_style_context_get_font()
This is for a very simple reason: The getter is returning a const value
and the font isn't const anymore. So we need to store the font
description somewhere but we can't reuse it as it's changing all the
time (yay animations, yay inherited values). Sucks.

So keep the hack in here but deprecate the function.
2012-12-06 02:57:19 +01:00
Benjamin Otte
82a6106920 switch: Remove hack to change text size
The same effect can now be achieved via
  .switch { font-size: smaller; }
so there is no need to hardcode things.
2012-12-06 02:57:18 +01:00
Benjamin Otte
1b1f4da5c7 gtk: Query font size directly
... instead of calling gtk_style_context_get_font() and then
pango_font_description_get_size().
2012-12-06 02:57:18 +01:00
Benjamin Otte
055b5d83d5 gtk: Use gtk_style_context_get()
... instead of soon-to-be-deprecated gtk_style_context_get_font().
2012-12-06 02:57:18 +01:00
Benjamin Otte
7747910b9d gtk: Use context's font
Instead of using gtk_style_context_get_font() in
pango_context_get_metrics(), use pango_context_get_font_description().
The context contains the font description we are about to use after all.
2012-12-06 02:57:18 +01:00
Benjamin Otte
a405c9917c tests: Don't call to-be-deprecated function 2012-12-06 02:57:18 +01:00
Benjamin Otte
fbbb66ae7d aboutdialog: Add text tag to get small text
This is to get rid of gtk_widget_override_font() and
gtk_style_context_get_font().

FIXME: This should probably be done by the theme somehow?
2012-12-06 02:57:18 +01:00
Benjamin Otte
732e89e4f3 stylecontext: Always recompute font
This is necessary  because values in a GtkCssComputedValues can change
now. So if the font-size is inherited or animated, the cached value will
be outdated.

Fixes the fontchooser preview not updating.
2012-12-06 02:57:18 +01:00
Daniel Mustieles
f79cd24937 Updated Spanish translation 2012-12-05 20:10:39 +01:00
Daniel Mustieles
6e2dec0344 Updated Spanish translation 2012-12-05 20:10:27 +01:00
Jasper St. Pierre
7ee5e7af70 treemodelfilter: Make the constructor binding friendly
This means reffing the root in the set property implementation,
rather than in the constructor. We don't need to unref the root
on set, as it's a CONSTRUCT_ONLY property.

https://bugzilla.gnome.org/show_bug.cgi?id=680065
2012-12-05 13:43:19 -05:00
Aleksander Morgado
a61b359498 GdkBroadwayDisplay: include proper port number in error trace 2012-12-05 11:23:35 +01:00
Aleksander Morgado
4dabc8ba84 GdkBroadwayDisplay: initialize GError before using it 2012-12-05 11:23:28 +01:00
Alexander Larsson
cd016ef8e3 Revert "Don't queue resize for hidden widgets without a size group"
This seems to break redraw of the middle pane in glade.

This reverts commit faaae520c9.
2012-12-04 21:30:04 +01:00
Alexander Larsson
d3377e9d7a Don't unnecessarily queue resize in GtkWindow.style_updated
GtkWindow always queues a resize on style updates if there is
a grip, because it may have been the grip size style properties
that changed. However, even if it *were*, and it likely wasn't
that would not affect the windows size request, so no need
to queue a resize.
2012-12-04 21:24:24 +01:00
Alexander Larsson
faaae520c9 Don't queue resize for hidden widgets without a size group
queue_resize basically tells the parent widget that it may need
to pick a different size/layout. However, for a hidden child widget
that should never be needed. It may be that the widget is in a
sizegroup that has ignore_hidden == FALSE though, so it may
affect the size group calculations.

However, if a widget is not visible and not in a size group then
its safe to avoid the resize, as the widget will be resized on
becoming visible anyway.

This avoids a lot of size allocation for hidden things like menus
and tooltips.
2012-12-04 20:16:44 +01:00
Alexander Larsson
47714f55ee css: Avoid queue_resize in _gtk_widget_style_context_invalidated
We've already emitted style_updated, and the handler for that queues
a resize if necessary.
2012-12-04 20:16:44 +01:00
Alexander Larsson
c3e9112f7f css: Avoid allocations in gtk_css_value_array_compute
Almost all array computations lead to no changes (99% in nautilus)
so we avoid the upfront allocation and delay it until we know its
needed. This drops the allocate/free from the profile.
2012-12-04 20:16:44 +01:00
Alexander Larsson
7ec33e63c0 css: Start array allocation with a better size
All computed values will compute all normal properties at least, so
we might as well allocate these upfront, which leads to a lot less
reallocations.
2012-12-04 20:16:44 +01:00
Alexander Larsson
afc1a143a4 css: Use internal return_if_fail in some commonly called code
These are internal apis, and any external issues should have been
caught by checks at public API points. We use the internal checks
here because these checks show up in a non-neglible way on profiles.
2012-12-04 20:16:44 +01:00
Alexander Larsson
5833b8495e Add internal versions of g_return_[val_]_if_fail
These are only enabled on debug=yes, so not by default
in released tarballs.
2012-12-04 20:16:44 +01:00
Rico Tzschichholz
b4767ea9da po: Fix xgettext failing on unicode strings
It is needed to use -from-code=utf-8 to override the ASCII default

Caused by ceb866dfe6
2012-12-04 20:06:19 +01:00
Benjamin Otte
85d8f3c51e reftests: Fix wrong name in test
Typo in d8306aaeb3
2012-12-04 20:02:36 +01:00
Alexander Larsson
c1e9d46c64 css: Return 0 as change for the GtkSettingsStyleProvider 2012-12-04 19:56:18 +01:00
Marek Kasik
6f69a0fef6 printing: Call mark_printer_active() with correct parameters
Revert the second part of the commit
6ad6f719c6. mark_printer_active()
was called without its second parameter in g_list_free_full().
2012-12-04 15:48:08 +01:00
Michael Natterer
f08fc12741 Bug 626499 - GtkClipboard unnotified on change of OS X pasteboard owner
pasteboardChangedOwner is not called as reliably as we'd want to get it,
so keep track of [pasteboard changeCount] and drop clipboard ownership
when a change happened. Also better unset the clipboard content redundantly
in a few places rather than missing one, and reorder the code in
gtk_clipboard_set_contents() so that the new aggressive unsetting
won't unset the clipboard under our feet when we call
[pasteboard declareTypes].
(cherry picked from commit f2b74db5dc)
2012-12-04 14:42:08 +01:00
Pierre-Yves Luyten
c74d79bb55 Ensure GtkColorButton has a dialog when adding a palette
https://bugzilla.gnome.org/show_bug.cgi?id=132333
2012-12-03 23:46:18 +01:00
Kalev Lember
907447c72d gtkroundedbox: Fix a compiler warning
Use the correct enum type.
2012-12-02 19:47:54 +01:00
Piotr Drąg
9bf091e2ac Updated POTFILES.skip 2012-12-01 21:22:00 +01:00
Benjamin Otte
1460487635 css: Fix order of enum
We switched around the order in gtkcssenumvalue.h, we need to switch
this order, too. Otherwise the parsing code will go bonkers.
2012-12-01 18:01:39 +01:00
Benjamin Otte
d8306aaeb3 reftests: Add a test for the new font size names 2012-12-01 16:27:45 +01:00
Benjamin Otte
1688403ae6 cssvalue: Fix the scaling factors for 'smaller' and 'larger'
They were reversed. Looks like a bad case of copy/paste failure.
2012-12-01 16:27:45 +01:00
Benjamin Otte
5942099f00 cssvalue: Parse font sizes properly
As the last CSS property, font-size now is a proper number (when it's
not a keyword).
2012-12-01 16:27:45 +01:00
Benjamin Otte
891a4ab347 cssvalue: Change order of values
This is necessary so that the (rather stupid) parsing code doesn't parse
"small" and then is happy when it should instead parse "smaller".
2012-12-01 16:27:45 +01:00
Benjamin Otte
a23bc88557 css: Fix dependencies for font lookup
'larger' and 'smaller' depend on the parent value. D'oh.
2012-12-01 16:27:28 +01:00
Kalev Lember
1a61e1ea23 gtkliststore: Add explicit braces to avoid dangling else
Otherwise the following else becomes attached to the wrong if.
2012-12-01 14:02:50 +01:00
Benjamin Otte
0d9d576172 css: Add more features to font-size code
We now support the keywords (like xx-small, medium, larger, smaller...)
and I've changed the default value to be "medium".

This required some shuffling of the "get default font size" code. But
all is well now.
2012-12-01 14:00:24 +01:00
Benjamin Otte
1dd3ee6b59 css: Move default font handling
The default font is no longer handled like a custom style sheet that
overrides everything, but as the initial value. This is the same
behavior as in web browsers.

And it allows the theme to actually use the 'font-family' and
'font-size' properties. Of course, a well behaved theme will respect the
setting as much as possible and for example use relative font sizes
(which aren't yet supported, but will be soon).
2012-12-01 01:49:06 +01:00
Benjamin Otte
3ff7f1fd43 style: Add _gtk_style_provider_private_get_settings()
This gives a GtkSettings object for resolving system-dependant things -
like the default font family and font size.
No code does this yet, but we have an API.

Only GtkSettings implements this.
2012-12-01 01:24:12 +01:00
Benjamin Otte
41f8ba3c35 settings: Implement StyleProvider interface without StyleProperties
I want to deprecate GtkStyleProperties.
2012-12-01 00:56:12 +01:00
Benjamin Otte
fe61e6b3fe settings: Never override some font properties
According to the CSS specification, everything but font-size and
font-family are defined by CSS. So we don't override them anymore.
2012-12-01 00:18:01 +01:00
Benjamin Otte
be53513954 API: Deprecate functions to register custom CSS properties
We should slowly transition code to using the GTK-provided CSS. So here
we go.
2012-11-30 22:45:20 +01:00
Benjamin Otte
fc67f0d4f8 stylecontext: Remove unused private functions 2012-11-30 22:41:22 +01:00
Benjamin Otte
0c12a6ffcb cssstyleproperty: Don't mark border width properties as NO_RESIZE
I was to overeager when marking properties in
66d22f101d apparently.
2012-11-30 20:41:58 +01:00
Benjamin Otte
35362337ec widget: Optimize away unndeeded redraws
If only styles were updated that don't require resizes, don't queue one.
2012-11-30 20:40:18 +01:00
Benjamin Otte
8560ff88cd styleproperty: Add _gtk_css_style_property_changes_affect_size()
This gives fast access to the question of wether a style update requires
a resize.
2012-11-30 20:37:46 +01:00
Benjamin Otte
e0586e3680 stylecontext: Expose a function to get at the current changes 2012-11-30 20:36:57 +01:00
Benjamin Otte
66d22f101d styleproperty: Mark properties as not needing resizes 2012-11-30 20:10:23 +01:00
Benjamin Otte
a5770cef36 styleproperty: Add an affects-size property
This property will be used to avoid gtk_widget_queue_resize() calls in
favor of gtk_widget_queue_draw().
2012-11-30 20:10:23 +01:00
Benjamin Otte
4ccb8e5d33 stylecontext: Pass a bitmask to the changed values 2012-11-30 20:10:23 +01:00
Benjamin Otte
cc0b493216 reftests: Fix a reftest
Recent Adwaita changes caused diffs. We don't want that, so we run this
test against the default settings.
2012-11-30 20:10:23 +01:00
Alexander Larsson
3c279b1492 icon cache: Fix double free
The symbolic icon cache code free crashed with a double free
due to a missing ->next in the loop.
2012-11-30 16:19:13 +01:00
Michael Natterer
9eea724e3b gtk: convert keyvals to unicode before committing to the imcontext
(cherry picked from commit 1eb0d98d73)
2012-11-30 15:10:51 +01:00
Michael Natterer
f619f91a8f gtk: add more OSX special casing for the deadacute and deaddoubleacute keys
So " plus foo prduces foo-with-diaereses and ' plus c produces
c-with-cedilla.
(cherry picked from commit c0102b3089)
2012-11-30 15:09:46 +01:00
Alexander Larsson
e36f80f0ef css: Make test pass
The new css tree may change the order of selectors (keeping the
same semantics). This affects how the selectors are printed later,
which causes some css parsing tests to not match the references.

Fortunately the order is consistent between runs given the same
css, so we just have to switch around the order in some of the
.ref.css files.
2012-11-30 14:53:30 +01:00
Alexander Larsson
3c421db473 css: Allocate the css tree in a single chunk
This gives us several advantages:

* Smaller struct on 64bit (32bit indexes vs 64bit pointers)
* Less overhead for allocation
* Less fragmentation
2012-11-30 14:53:30 +01:00
Alexander Larsson
2dbeabdc58 css: Fix leak of lists while building tree 2012-11-30 14:53:30 +01:00
Alexander Larsson
528e6032ae css: Add accessor functions for traversing css tree
This will let us later change how the tree is stored
2012-11-30 14:53:30 +01:00
Alexander Larsson
42716cb60f css: Add const to _gtk_css_selector_tree_match_all arg 2012-11-30 14:53:30 +01:00
Alexander Larsson
d69c6fff7a css: Don't keep around linear selectors
Now we use the selector tree everywhere, so there is no need to
keep around the linear selectors unless we're using them to
verify the tree correctness, so free them.
2012-11-30 14:53:30 +01:00
Alexander Larsson
c10a0962cf css: Remove gtk_css_ruleset_matches
This is only not needed anymore, and only the VERIFY_TREE code
should access ->selector.
2012-11-30 14:53:30 +01:00
Alexander Larsson
fd4712590a css: Use tree for gtk_css_provider_get_style_property 2012-11-30 14:53:30 +01:00
Alexander Larsson
9b989a1427 css: Implement ruleset_get_change() with the tree
We traverse the tree on the matches instead of using
the linear selectors.
2012-11-30 14:53:30 +01:00
Alexander Larsson
146b6f3a93 css: Ensure the tree built is always the same
We add some "artificial" ordering to the otherwise unordered
tree nodes. This means the tree will be the same every time for the
same input. This is good because e.g. tree order affects the
reordering of the simple selectors, which may affect how
css providers are printed, which need to be consistent for
the css tests to work.
2012-11-30 14:53:30 +01:00
Alexander Larsson
3d5e8f98ec css: Use the tree to print css selectors 2012-11-30 14:53:30 +01:00
Alexander Larsson
6bec577771 css: Track the tree selector matches 2012-11-30 14:53:30 +01:00
Alexander Larsson
f678827918 css: Fix type of GtkCssSelectorRuleSetInfo match
The old type was a leftover from a previous version.
2012-11-30 14:53:30 +01:00
Alexander Larsson
6b85db7555 css: Track parent in the css tree nodes
This way we can reconstruct matched css rules
2012-11-30 14:53:30 +01:00
Alexander Larsson
69feabd139 css: Better tree match verification 2012-11-30 14:53:30 +01:00
Alexander Larsson
0ede06d229 css: Fix up position with region tree matching
This was using the wrong result in case of a match (results from
the position, not the region. Also, the descendant checks were
wrong.
2012-11-30 14:53:30 +01:00
Alexander Larsson
d6932dd823 css: Don't reorder some selectors when building selector tree
When building the tree we generally reorder the selectors inside
the same simple selector in order to pick a good first selector
to balance the tree better. However, some kinds of selectors
can't really be reordered, even thought they are simple.

This is since the matching code for some types handle
the existance of a directly preceeding selector differently:

 REGION and ANY selectors look for a DESCENDANT previous
 POSITION selector look for a REGION previous
2012-11-30 14:53:30 +01:00
Alexander Larsson
63cb467e06 css: Fixed typo in PRINT_TREE debug code 2012-11-30 14:53:30 +01:00
Alexander Larsson
1bfa6593c8 css: Create and use a tree for css selector matching 2012-11-30 14:53:30 +01:00
Alexander Larsson
daefb12a23 css: Add GtkCssSelectorTree creation and matching
From a set of GtkCssSelectors and the rulesets they match to
we create a large decision tree that lets us efficitently match
against all the rules and return the set of matched rulesets.

The tree is created such that at each level we pick the initial rule[1]
in all the considered selectors for that level and use put the
one that is in most selectors in the node. All selectors matching that
are put in the previous part of the tree.
2012-11-30 14:53:29 +01:00
Alexander Larsson
16f2b20f96 css: Add _gtk_css_matcher_matches_any()
This returns true if the matcher matches *anything*. We need
to check this later, because such matchers are dangerous in loops
that iterate over all parents/siblings since such loops would not
terminate.
2012-11-30 14:53:29 +01:00
Alexander Larsson
3b4040d619 css: Track which selectors are "simple" 2012-11-30 14:53:29 +01:00
Alexander Larsson
cfdc68db5c Reuse rendered symbolic icons
With the previous commit all loads of the same icon will share a single
GtkIconInfo, which typicallty means the pixbuf is shared via Info->pixbuf.

However, atm we don't share symbolic icons, which causes these to be re-read
and re-parsed every time. This is especially bad if the icon is used many times
in some form of list. So, we cache the pixbufs and reuse them.

https://bugzilla.gnome.org/show_bug.cgi?id=689081
2012-11-30 11:33:26 +01:00
Alexander Larsson
92e904a257 Cache GtkIconInfo
In order to avoid loading and keeping around the same icon multiple times
we keep a cache of all outstanding GtkIconInfo objects for a given theme.

Additionally we return to the app not the normal pixbuf from the info,
but rather a proxy copy of it sharing the same data, but no extra
reference. This allows us to track when the app is no longer using
the pixbuf, and we can thus ensure that the GtkIconInfo in the cache
stays around for at least as long as the pixbuf is alive.

When the app unrefs the pixbuf we put the Info on a short LRU list
to keep it alive a bit longer, in case the app needs it in a short
while.

https://bugzilla.gnome.org/show_bug.cgi?id=689081
2012-11-30 11:33:26 +01:00
Matthias Clasen
e75860e466 Add a missing va_end call
va_copy must be matched with va_end.
2012-11-29 23:18:49 -05:00
Matthias Clasen
5b9c687595 Avoid unreachable code
Reestablish an else that went missing in commit 5ff328d2. Without
it, the return is reached unconditionally, and the code behind
it is dead.
2012-11-29 23:10:40 -05:00
Matthias Clasen
b3b83545c4 Don't return prematurely
This code was clearly meant to return _after_ the loop.
Don't put the return inside the loop body, then.
2012-11-29 23:10:35 -05:00
Matthias Clasen
c5c7323942 GtkAboutDialog: Initialize a variable
Coverity complains about it being uninitialized, otherwise.
2012-11-29 23:10:34 -05:00
Matthias Clasen
52af9aede6 GtkNotebook: Clarify a switch statement
We were intentionally falling through here, this commit
just adds comments to make that explicit.
2012-11-29 23:10:34 -05:00
Matthias Clasen
4557e4d7a5 GtkCellAccessible: Add missing break statements
This switch was entirely breakless. Amazing accessibility code,
found by Coverity.
2012-11-29 23:10:34 -05:00
Matthias Clasen
9ba32fec6e GtkExpander: Clarify a nested switch
This code confused Coverity into thinking we were falling through,
when we were not. Add a few explicit breaks to clear that up.
2012-11-29 23:10:34 -05:00
Matthias Clasen
6400eeba35 Add a forgotten break in render_border
The GTK_BORDER_STYLE_DOUBLE case was clearly not meant to
fall through to the subsequent cases, yet it did.
Found by Coverity.
2012-11-29 23:10:34 -05:00
Matthias Clasen
a7ed598d37 GtkIconViewAccessible: Fix a copy-paste error
Don't access vadjustment after checking hadjustment for
not being NULL. Found by Coverity.
2012-11-29 23:10:34 -05:00
Matthias Clasen
3519226c5a GtkActionHelper: Fix a copy-paste error
The code clearly meant to reset action->active here.

This was found by Coverity.
2012-11-29 23:10:34 -05:00
Matthias Clasen
bf26d46cb2 gtk_css_value_bg_size_equal: actually compare contain values
Due to a copy-paste error, the code failed to compare the
contain members of value1 and value2.

This was found by Coverity.
2012-11-29 23:10:34 -05:00
Matthias Clasen
ce6f43a522 Don't check the same crossing mode twice
This was broken since commit b2aaa94 in 2008. Its commit message
clearly states that the intention was to check for GTK_GRAB,
GTK_UNGRAB and STATE_CHANGED. Lets do that, then.

This was found by Coverity.
2012-11-29 23:10:34 -05:00
Matthias Clasen
5230cfe805 GtkLabel: Fix a pointless expression
Clearly, what was meant here was that we create a new attribute
list if either of the input attribute lists are non-NULL.
This was found by Coverity.
2012-11-29 23:10:34 -05:00
Matthias Clasen
256f168525 Obtain the recent files max age setting from xsettings
This will help with implementing desktop-wide policy for
retaining of history.

https://bugzilla.gnome.org/show_bug.cgi?id=689047
2012-11-29 23:10:33 -05:00
Timothy Arceri
50acce4074 In the file chooser, use a proper apostrophe rather than a prime mark (tick mark)
https://bugzilla.gnome.org/show_bug.cgi?id=689012
2012-11-29 11:34:29 -06:00
Alan McGovern
149de71624 Fix broken function pointer declarations on windows
Both flashing a window and setting the window opacity were using
incorrect declarations for function pointers. They were missing the
WINAPI annotation as defined in windows.h. As a result, the stack
could be corrupted when these functions were invoked.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=689235
(cherry picked from commit 5637ef1f97)
2012-11-29 15:07:42 +01:00
Michael Natterer
709f12b9ac quartz: add mountain lion as version 8 to enum GdkOSXVersion
Also use GDK_OSX_UNSUPPORTED instead of 0 in gdk_quartz_osx_version().
(cherry picked from commit 9644e910a8)
2012-11-29 15:00:57 +01:00
Michael Natterer
e2144fbb7e quartz: call Gestalt() only once per session in gdk_quartz_osx_version()
Thanks to Paul Davis for pointing this out.
(cherry picked from commit d6533ffc44)
2012-11-29 15:00:38 +01:00
Benjamin Berg
fd301e7847 Use the ppd groups "name" instead of "text" (bug #687065)
This commit fixes a regression caused by a patch to remove Cups 1.2
ifdefs. This resulted in the "installable options" to appear in the
print dialog.
2012-11-29 10:02:08 +01:00
Benjamin Otte
4d0ca91c72 menuitem: Remove unused variables 2012-11-28 21:15:05 +01:00
Benjamin Otte
29c8420746 tests: Add CSS test for comment detection
Tests recent fix.
2012-11-28 21:11:48 +01:00
Marcus Kraßmann
7f3595a6be cssparser: Don't detect /*/ as a comment 2012-11-28 21:11:48 +01:00
Cosimo Cecchi
ea415cd350 menubar: deprecate internal-padding style property
https://bugzilla.gnome.org/show_bug.cgi?id=689168
2012-11-28 10:09:16 -05:00
Cosimo Cecchi
1a79ee4d3e menubar: add support for CSS padding
In preparation for the removal of the internal-padding style property.

https://bugzilla.gnome.org/show_bug.cgi?id=689168
2012-11-28 10:09:16 -05:00
Cosimo Cecchi
01dc23cdec menu: deprecate horizontal-padding and vertical-padding
https://bugzilla.gnome.org/show_bug.cgi?id=689168
2012-11-28 10:09:16 -05:00
Cosimo Cecchi
a69619edbc menuitem: deprecate horizontal-padding style property
https://bugzilla.gnome.org/show_bug.cgi?id=689168
2012-11-28 10:09:16 -05:00
Nilamdyuti Goswami
d3051ca79c Assamese translation updated 2012-11-28 13:49:44 +05:30
Nilamdyuti Goswami
9ac005abee Assamese translation updated 2012-11-28 13:47:38 +05:30
609 changed files with 48288 additions and 41411 deletions

121
NEWS
View File

@@ -1,3 +1,124 @@
Overview of Changes in GTK+ 3.7.6
=================================
* We now use state flags for text direction: GTK_STATE_FLAG_LTR/RTL.
gtk_style_context_set_direction() has been deprecated.
* We install headers for accessible implementations of GTK+ widgets.
This makes it possible to implement accessibility for third-party
widgets by subclassing the proper GTK+ implementation. To do this,
include gtk/gtk-a11y.h.
* Invisible widgets now return a size of 0x0. This is an experimental
change that makes GtkWidget::visible essentially behave the same way
that "display: none" does in CSS. If you want the effect of CSS's
"visibility: hidden", you can use a GtkNotebook with an empty page.
* GtkFrame now draws a background.
* The Broadway backend now installs a separate server: broadwayd.
* Bug fixes:
687025 iconhelper: Treat empty string as NULL stock-id
687633 gtk_color_chooser_get_rgba: wrong annotations, broke bind...
688140 Add missing annotation for gtk_combo_box_text_get_active_...
688362 GtkApplication: Fix memory leak
689810 Include guard optimization
690305 Typo in SECTION:gtkbuildable : (thier -> their)
691186 Gtk+ 3.6.3 crashes when opening printing dialog: segfault...
691301 Better support for cross-compiling
691515 Insufficient checks for EWMH support
691677 Gtk Scale (slider) does not react in clicks outside the c...
* Translation updates:
Assamese
Bulgarian
Estonian
Galician
Hungarian
Kazakh
Latvian
Lithuanian
Norwegian bokmål
Persian
Portuguese
Slovenian
Tamil
Thai
Uyghur
Overview of Changes in GTK+ 3.7.4
=================================
* GtkBuilder now lets you refer to external objects from a ui
file if the objects have been exported with the new function
gtk_builder_expose_object()
* Font handling has been improved:
- The default font is no longer handled like a custom style sheet
that overrides everything, but as the initial value. This is the
same behavior as in web browsers.
- It is now possible to set font-family and font-size like other
CSS properties, and relative font sizes are supported. Font
sizes in CSS can be specified as numbers or with keywords
like xx-small, medium, smaller, larger,...
* GTK+ now uses proper Unicode ellipses in strings.
* The releases includes several noticable performance improvements:
- Size allocation has been optimized, by avoiding excessive
resizing in various situations.
- The performance of size groups has been improved.
- Text rendering in GtkLabel and other widgets has been optimized
to avoid excessive recreation of Pango layouts.
- Icon loading overhead was reduced by caching of GtkIconInfo.
- The CSS is now keeping a tree of selectors to speed up matchinh.
* Deprecations and removals:
- Custom CSS properties have been deprecated
- Support for color schemes has been removed
- gtk_style_provider_get_style, gtk_style_provider_get_icon_factory
- GtkGradient and GtkSymbolicColor
- All the padding style properties in menus
* Bugs closed:
132333 Can't add a palette to the dialog of a color button
371034 Doc for gtk_file_chooser_get_filename: Is the resulting path...
447972 Add a way to specify user_data sent to signals
548793 funny pattern for iterating GtkTreeModel
595615 Use proper ellipses
626499 GtkClipboard unnotified on change of OS X pasteboard owner
668239 texts disappear when notebook switch page at zh_CN locate!
677339 GTK+ 3 documentation wrong about GtkWidget scroll-event signal
680065 treemodelfilter: Make the constructor binding friendly
687065 InstallableOptions is not filtered in cups backend
687816 GtkTreeView does not draw correctly since commit aaedc7b6
688710 [PATCH] Splash screens shouldn't stay on top of all applicat...
688744 Don't use gtk_style_context_set_background() to render icon/...
688884 Typo in gtk_tree_view_set_tooltip_column documentation
689012 "Copy file's location" menu item in file chooser dialog uses...
689047 Obtain the recent files max age setting from xsettings
689081 No caching of icons
689168 Deprecate some menu style properties
689401 xi2: Abort early if we don't have a proper GDK window
689584 Add summary and description to "show-hidden" key
689847 Add fast repeated typename -> GType resolver
689923 Missing null-check in GtkEntryAccessible
690099 GtkScrolledWindow with NEVER policy don't resize with children
690266 Freeze with F10/Shift-F10 on submenus
* Translation updates:
Assamese
British English
Dutch
German
Hebrew
Polish
Slovenian
Spanish
Overview of Changes in GTK+ 3.7.2
=================================

View File

@@ -10,7 +10,7 @@
m4_define([gtk_major_version], [3])
m4_define([gtk_minor_version], [7])
m4_define([gtk_micro_version], [3])
m4_define([gtk_micro_version], [6])
m4_define([gtk_interface_age], [0])
m4_define([gtk_binary_age],
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
@@ -24,11 +24,14 @@ AC_INIT([gtk+], [gtk_version],
[http://bugzilla.gnome.org/enter_bug.cgi?product=gtk%2B],
[gtk+])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([gdk/gdktypes.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
# Define a string for the earliest version that this release has
# backwards binary compatibility with for all interfaces a module
# might. Unless we add module-only API with lower stability
@@ -39,8 +42,8 @@ AC_CONFIG_AUX_DIR([build-aux])
m4_define([gtk_binary_version], [3.0.0])
# required versions of other packages
m4_define([glib_required_version], [2.35.0])
m4_define([pango_required_version], [1.30.0])
m4_define([glib_required_version], [2.35.3])
m4_define([pango_required_version], [1.32.4])
m4_define([atk_required_version], [2.5.3])
m4_define([cairo_required_version], [1.10.0])
m4_define([gdk_pixbuf_required_version], [2.26.0])
@@ -123,8 +126,8 @@ AC_SUBST([GAIL_LT_CURRENT_MINUS_AGE],[gail_lt_current_minus_age])
# Checks for programs.
AC_PROG_CC
AX_PROG_CC_FOR_BUILD
AC_PROG_CC_C_O
AC_PROG_CC_STDC
AC_PROG_MKDIR_P
AC_PROG_INSTALL
AC_PROG_MAKE_SET
@@ -135,8 +138,6 @@ AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
[The prefix for our gettext translation domains.])
AC_CANONICAL_HOST
MATH_LIB=-lm
AC_MSG_CHECKING([for native Win32])
LIB_EXE_MACHINE_FLAG=X86
@@ -386,6 +387,7 @@ AC_SUBST(DISABLE_ON_QUARTZ)
if test "x$enable_broadway_backend" = xyes; then
GDK_BACKENDS="$GDK_BACKENDS broadway"
cairo_backends="$cairo_backends cairo"
have_gio_unix=yes
GDK_WINDOWING="$GDK_WINDOWING
#define GDK_WINDOWING_BROADWAY"
GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lz"
@@ -905,14 +907,32 @@ dnl Look for a host system's gdk-pixbuf-csource if we are cross-compiling
AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
if test "x$cross_compiling" = xyes || test "x$enable_gtk2_dependency" = xyes; then
AC_PATH_PROG(GTK_UPDATE_ICON_CACHE, gtk-update-icon-cache, no)
AS_IF([test "x$enable_gtk2_dependency" = xyes],
[AC_PATH_PROG(GTK_UPDATE_ICON_CACHE, gtk-update-icon-cache, no)
if test x$GTK_UPDATE_ICON_CACHE = xno; then
REBUILD_PNGS=#
fi
fi
fi],
AM_CONDITIONAL(USE_EXTERNAL_ICON_CACHE, [test "x$cross_compiling" = xyes || test "x$enable_gtk2_dependency" = xyes])
[test "x$cross_compiling" = xyes],
[# If no GTK+2 dependency and cross compiling, we need to find a host gdk-pixbuf.
# pkg.m4 blocks all variable starting with PKG, so allow this one
m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
AS_IF([test x$PKG_CONFIG_FOR_BUILD = x],
[AC_MSG_ERROR([You must define PKG_CONFIG_FOR_BUILD when cross compiling])])
AC_MSG_CHECKING([for native gdk-pixbuf])
AS_IF([AC_RUN_LOG([$PKG_CONFIG_FOR_BUILD --exists --print-errors gdk-pixbuf-2.0])],
[AC_MSG_RESULT([yes])],
[AC_MSG_ERROR([native gdk-pixbuf not found])])
NATIVE_GDKPIXBUF_CFLAGS=`$PKG_CONFIG_FOR_BUILD --cflags gdk-pixbuf-2.0`
NATIVE_GDKPIXBUF_LIBS=`$PKG_CONFIG_FOR_BUILD --libs gdk-pixbuf-2.0`
AC_SUBST(NATIVE_GDKPIXBUF_CFLAGS)
AC_SUBST(NATIVE_GDKPIXBUF_LIBS)]
)
AM_CONDITIONAL(USE_EXTERNAL_ICON_CACHE, [test "x$enable_gtk2_dependency" = xyes])
AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no)
@@ -1787,6 +1807,7 @@ gtk/makefile.msc
gtk/gtkversion.h
gtk/gtk-win32.rc
gtk/a11y/Makefile
gtk/native/Makefile
gtk/tests/Makefile
libgail-util/Makefile
modules/Makefile

View File

@@ -56,6 +56,9 @@ get_democodedir (void)
#endif
#undef DEMOCODEDIR
#define DEMOCODEDIR getenv ("GTK_DEMO_DATA_DIR")
/**
* demo_find_file:
* @base: base filename

View File

@@ -147,4 +147,11 @@ include $(top_srcdir)/gtk-doc.make
# Other files to distribute
EXTRA_DIST += version.xml.in
if ENABLE_GTK_DOC
TESTS_ENVIRONMENT = cd $(srcdir) && \
DOC_MODULE=$(DOC_MODULE) DOC_MAIN_SGML_FILE=$(DOC_MAIN_SGML_FILE) \
SRCDIR=$(abs_srcdir) BUILDDIR=$(abs_builddir)
#TESTS = $(GTKDOC_CHECK)
endif
-include $(top_srcdir)/git.mk

View File

@@ -21,10 +21,20 @@ CFILE_GLOB=$(top_srcdir)/gtk/*.c
# Header files to ignore when scanning
IGNORE_HFILES= \
fnmatch.h \
gactionmuxer.h \
gactionobserver.h \
gactionobservable.h \
gtk9slice.h \
gtkanimationdescription.h \
gtkdebug.h \
gtkactionhelper.h \
gtkapplicationprivate.h \
gtkbuilderprivate.h \
gtkcolorchooserprivate.h \
gtkcoloreditorprivate.h \
gtkcolorplaneprivate.h \
gtkcolorscaleprivate.h \
gtkcolorswatchprivate.h \
gtkdndcursors.h \
gtkentryprivate.h \
gtkfilechooserdefault.h \
@@ -45,6 +55,8 @@ IGNORE_HFILES= \
gtkmarshal.h \
gtkmenuprivate.h \
gtkmnemonichash.h \
gtkmodelmenu.h \
gtkmodelmenuitem.h \
gtkpathbar.h \
gtkplugprivate.h \
gtkprintbackend.h \
@@ -449,6 +461,13 @@ MAINTAINERCLEANFILES = $(man_MANS) $(BUILT_SOURCES)
EXTRA_DIST += $(man_MANS)
if ENABLE_GTK_DOC
TESTS_ENVIRONMENT = cd $(srcdir) && \
DOC_MODULE=$(DOC_MODULE) DOC_MAIN_SGML_FILE=$(DOC_MAIN_SGML_FILE) \
SRCDIR=$(abs_srcdir) BUILDDIR=$(abs_builddir)
#TESTS = $(GTKDOC_CHECK)
endif
dist-hook-local: dist-local-check-mans-enabled all-local
gtk-docs-clean: clean

View File

@@ -61,13 +61,9 @@
<xi:include href="xml/gtkstyleproperties.xml" />
<xi:include href="xml/gtkthemingengine.xml" />
<xi:include href="xml/gtkwidgetpath.xml" />
<xi:include href="xml/gtksymboliccolor.xml" />
<xi:include href="xml/gtkgradient.xml" />
<xi:include href="xml/gtkicontheme.xml" />
<xi:include href="xml/gtkiconfactory.xml" />
<xi:include href="xml/gtknumerableicon.xml" />
<xi:include href="xml/gtkrc.xml" />
<xi:include href="xml/gtkstyle.xml" />
</part>
<part id="gtkobjects">
@@ -128,8 +124,6 @@
<xi:include href="xml/gtkentrybuffer.xml" />
<xi:include href="xml/gtkentrycompletion.xml" />
<xi:include href="xml/gtkscale.xml" />
<xi:include href="xml/gtkhscale.xml" />
<xi:include href="xml/gtkvscale.xml" />
<xi:include href="xml/gtkspinbutton.xml" />
<xi:include href="xml/gtksearchentry.xml" />
<xi:include href="xml/gtkeditable.xml" />
@@ -188,7 +182,6 @@
<xi:include href="xml/gtkradiomenuitem.xml" />
<xi:include href="xml/gtkcheckmenuitem.xml" />
<xi:include href="xml/gtkseparatormenuitem.xml" />
<xi:include href="xml/gtktearoffmenuitem.xml" />
<xi:include href="xml/gtktoolshell.xml" />
<xi:include href="xml/gtktoolbar.xml" />
<xi:include href="xml/gtktoolitem.xml" />
@@ -218,9 +211,6 @@
<xi:include href="xml/gtkcolorbutton.xml" />
<xi:include href="xml/gtkcolorchooserwidget.xml" />
<xi:include href="xml/gtkcolorchooserdialog.xml" />
<xi:include href="xml/gtkcolorsel.xml" />
<xi:include href="xml/gtkcolorseldlg.xml" />
<xi:include href="xml/gtkhsv.xml" />
<xi:include href="xml/gtkfilechooser.xml" />
<xi:include href="xml/gtkfilechooserbutton.xml" />
<xi:include href="xml/gtkfilechooserdialog.xml" />
@@ -230,8 +220,6 @@
<xi:include href="xml/gtkfontbutton.xml" />
<xi:include href="xml/gtkfontchooserwidget.xml" />
<xi:include href="xml/gtkfontchooserdialog.xml" />
<xi:include href="xml/gtkfontsel.xml" />
<xi:include href="xml/gtkfontseldlg.xml" />
</chapter>
<chapter id="LayoutContainers">
@@ -240,18 +228,11 @@
<xi:include href="xml/gtkalignment.xml" />
<xi:include href="xml/gtkaspectframe.xml" />
<xi:include href="xml/gtkbox.xml" />
<xi:include href="xml/gtkhbox.xml" />
<xi:include href="xml/gtkvbox.xml" />
<xi:include href="xml/gtkbbox.xml" />
<xi:include href="xml/gtkhbbox.xml" />
<xi:include href="xml/gtkvbbox.xml" />
<xi:include href="xml/gtkfixed.xml" />
<xi:include href="xml/gtkpaned.xml" />
<xi:include href="xml/gtkhpaned.xml" />
<xi:include href="xml/gtkvpaned.xml" />
<xi:include href="xml/gtklayout.xml" />
<xi:include href="xml/gtknotebook.xml" />
<xi:include href="xml/gtktable.xml" />
<xi:include href="xml/gtkexpander.xml" />
<xi:include href="xml/gtkoverlay.xml" />
<xi:include href="xml/gtkorientable.xml" />
@@ -261,15 +242,11 @@
<title>Ornaments</title>
<xi:include href="xml/gtkframe.xml" />
<xi:include href="xml/gtkseparator.xml" />
<xi:include href="xml/gtkhseparator.xml" />
<xi:include href="xml/gtkvseparator.xml" />
</chapter>
<chapter id="ScrollingWidgets">
<title>Scrolling</title>
<xi:include href="xml/gtkscrollbar.xml" />
<xi:include href="xml/gtkhscrollbar.xml" />
<xi:include href="xml/gtkvscrollbar.xml" />
<xi:include href="xml/gtkscrolledwindow.xml" />
<xi:include href="xml/gtkscrollable.xml" />
</chapter>
@@ -350,6 +327,34 @@
<xi:include href="xml/gtkapplicationwindow.xml" />
<xi:include href="xml/gtkactionable.xml" />
</chapter>
<chapter id="DeprecatedObjects">
<title>Deprecated</title>
<xi:include href="xml/gtksymboliccolor.xml" />
<xi:include href="xml/gtkgradient.xml" />
<xi:include href="xml/gtkrc.xml" />
<xi:include href="xml/gtkstyle.xml" />
<xi:include href="xml/gtkhscale.xml" />
<xi:include href="xml/gtkvscale.xml" />
<xi:include href="xml/gtktearoffmenuitem.xml" />
<xi:include href="xml/gtkcolorsel.xml" />
<xi:include href="xml/gtkcolorseldlg.xml" />
<xi:include href="xml/gtkhsv.xml" />
<xi:include href="xml/gtkfontsel.xml" />
<xi:include href="xml/gtkfontseldlg.xml" />
<xi:include href="xml/gtkhbox.xml" />
<xi:include href="xml/gtkvbox.xml" />
<xi:include href="xml/gtkhbbox.xml" />
<xi:include href="xml/gtkvbbox.xml" />
<xi:include href="xml/gtkhpaned.xml" />
<xi:include href="xml/gtkvpaned.xml" />
<xi:include href="xml/gtktable.xml" />
<xi:include href="xml/gtkhseparator.xml" />
<xi:include href="xml/gtkvseparator.xml" />
<xi:include href="xml/gtkhscrollbar.xml" />
<xi:include href="xml/gtkvscrollbar.xml" />
</chapter>
</part>
<part id="migrating">
@@ -406,6 +411,10 @@
<title>Index of new symbols in 3.6</title>
<xi:include href="xml/api-index-3.6.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-8" role="3.8">
<title>Index of new symbols in 3.8</title>
<xi:include href="xml/api-index-3.8.xml"><xi:fallback /></xi:include>
</index>
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>

View File

@@ -536,6 +536,7 @@ gtk_builder_add_objects_from_string
gtk_builder_add_objects_from_resource
gtk_builder_get_object
gtk_builder_get_objects
gtk_builder_expose_object
gtk_builder_connect_signals
gtk_builder_connect_signals_full
gtk_builder_set_translation_domain

View File

@@ -15,7 +15,9 @@ AM_CPPFLAGS = \
LDADDS = $(GDK_DEP_LIBS)
noinst_LTLIBRARIES = libbroadway.la libgdk-broadway.la
noinst_LTLIBRARIES = libgdk-broadway.la
bin_PROGRAMS = broadwayd
libgdkinclude_HEADERS = \
gdkbroadway.h
@@ -26,10 +28,6 @@ libgdkbroadwayinclude_HEADERS = \
gdkbroadwaycursor.h \
gdkbroadwayvisual.h
libbroadway_la_SOURCES = \
broadway.h \
broadway.c
clienthtml.h: client.html
$(PERL) $(srcdir)/toarray.pl $(srcdir)/client.html client_html > $@
@@ -73,9 +71,19 @@ libgdk_broadway_la_SOURCES = \
gdkvisual-broadway.c \
gdkwindow-broadway.c \
gdkwindow-broadway.h \
gdkprivate-broadway.h
gdkprivate-broadway.h \
gdkbroadway-server.h \
gdkbroadway-server.c
libgdk_broadway_la_LIBADD = libbroadway.la
broadwayd_SOURCES = \
broadway-protocol.h \
broadwayd.c \
broadway-server.h \
broadway-server.c \
broadway-output.h \
broadway-output.c
broadwayd_LDADD = $(GDK_DEP_LIBS) -lrt
MAINTAINERCLEANFILES = $(broadway_built_sources)
EXTRA_DIST += $(broadway_built_sources)

View File

@@ -0,0 +1,11 @@
Cache surfaces that are opened via shm_open inbetween updates.
Handle implicit grabs when in broadway-server.c
keyboard focus handling
Add resize handling to js WM
Support window titles
_gdk_broadway_server_has_client is always FALSE, so resize don't work
Send reset events on client disconnect (button up, normal state. Maybe grab state reset?)
rgba suport
shift-select in gedit doesn't work
backdrop mode
clean up /dev/shm on abrupt client exit

View File

@@ -5,7 +5,7 @@
#include <errno.h>
#include <cairo.h>
#include "broadway.h"
#include "broadway-output.h"
/************************************************************************
* Base64 functions *
@@ -351,12 +351,12 @@ static void
append_uint16 (BroadwayOutput *output, guint32 v)
{
gsize old_len = output->buf->len;
guint8 *buf;
if (output->binary)
{
guint8 *buf = (guint8 *)output->buf->str + old_len;
g_string_set_size (output->buf, old_len + 2);
buf = (guint8 *)output->buf->str + old_len;
buf[0] = (v >> 0) & 0xff;
buf[1] = (v >> 8) & 0xff;
}
@@ -371,12 +371,12 @@ static void
append_uint32 (BroadwayOutput *output, guint32 v)
{
gsize old_len = output->buf->len;
guint8 *buf;
if (output->binary)
{
guint8 *buf = (guint8 *)output->buf->str + old_len;
g_string_set_size (output->buf, old_len + 4);
buf = (guint8 *)output->buf->str + old_len;
buf[0] = (v >> 0) & 0xff;
buf[1] = (v >> 8) & 0xff;
buf[2] = (v >> 16) & 0xff;
@@ -422,7 +422,7 @@ broadway_output_copy_rectangles (BroadwayOutput *output, int id,
{
int i;
write_header (output, 'b');
write_header (output, BROADWAY_OP_COPY_RECTANGLES);
append_uint16 (output, id);
append_uint16 (output, n_rects);
for (i = 0; i < n_rects; i++)
@@ -441,7 +441,7 @@ broadway_output_grab_pointer (BroadwayOutput *output,
int id,
gboolean owner_event)
{
write_header (output, 'g');
write_header (output, BROADWAY_OP_GRAB_POINTER);
append_uint16 (output, id);
append_bool (output, owner_event);
}
@@ -452,7 +452,7 @@ broadway_output_ungrab_pointer (BroadwayOutput *output)
guint32 serial;
serial = output->serial;
write_header (output, 'u');
write_header (output, BROADWAY_OP_UNGRAB_POINTER);
return serial;
}
@@ -462,7 +462,7 @@ broadway_output_new_surface(BroadwayOutput *output,
int id, int x, int y, int w, int h,
gboolean is_temp)
{
write_header (output, 's');
write_header (output, BROADWAY_OP_NEW_SURFACE);
append_uint16 (output, id);
append_uint16 (output, x);
append_uint16 (output, y);
@@ -474,21 +474,21 @@ broadway_output_new_surface(BroadwayOutput *output,
void
broadway_output_show_surface(BroadwayOutput *output, int id)
{
write_header (output, 'S');
write_header (output, BROADWAY_OP_SHOW_SURFACE);
append_uint16 (output, id);
}
void
broadway_output_hide_surface(BroadwayOutput *output, int id)
{
write_header (output, 'H');
write_header (output, BROADWAY_OP_HIDE_SURFACE);
append_uint16 (output, id);
}
void
broadway_output_destroy_surface(BroadwayOutput *output, int id)
{
write_header (output, 'd');
write_header (output, BROADWAY_OP_DESTROY_SURFACE);
append_uint16 (output, id);
}
@@ -508,7 +508,7 @@ broadway_output_move_resize_surface (BroadwayOutput *output,
if (!has_pos && !has_size)
return;
write_header (output, 'm');
write_header (output, BROADWAY_OP_MOVE_RESIZE);
val = (!!has_pos) | ((!!has_size) << 1);
append_uint16 (output, id);
append_flags (output, val);
@@ -529,7 +529,7 @@ broadway_output_set_transient_for (BroadwayOutput *output,
int id,
int parent_id)
{
write_header (output, 'p');
write_header (output, BROADWAY_OP_SET_TRANSIENT_FOR);
append_uint16 (output, id);
append_uint16 (output, parent_id);
}
@@ -541,7 +541,7 @@ broadway_output_put_rgb (BroadwayOutput *output, int id, int x, int y,
{
gsize size_start, image_start, len;
write_header (output, 'i');
write_header (output, BROADWAY_OP_PUT_RGB);
append_uint16 (output, id);
append_uint16 (output, x);
@@ -798,7 +798,7 @@ broadway_output_put_rgba (BroadwayOutput *output, int id, int x, int y,
{
guint8 *subdata;
write_header (output, 'i');
write_header (output, BROADWAY_OP_PUT_RGB);
append_uint16 (output, id);
append_uint16 (output, x + rects[i].x1);
append_uint16 (output, y + rects[i].y1);
@@ -830,6 +830,6 @@ void
broadway_output_surface_flush (BroadwayOutput *output,
int id)
{
write_header (output, 'f');
write_header (output, BROADWAY_OP_FLUSH);
append_uint16 (output, id);
}

View File

@@ -1,13 +1,12 @@
#ifndef __BROADWAY_H__
#define __BROADWAY_H__
#include <glib.h>
#include <gio/gio.h>
#include "broadway-protocol.h"
typedef struct BroadwayOutput BroadwayOutput;
typedef struct {
int x, y;
int width, height;
} BroadwayRect;
typedef enum {
BROADWAY_WS_CONTINUATION = 0,
BROADWAY_WS_TEXT = 1,
@@ -78,3 +77,5 @@ void broadway_output_grab_pointer (BroadwayOutput *output,
gboolean owner_event);
guint32 broadway_output_ungrab_pointer (BroadwayOutput *output);
void broadway_output_pong (BroadwayOutput *output);
#endif /* __BROADWAY_H__ */

View File

@@ -0,0 +1,264 @@
#ifndef __BROADWAY_PROTOCOL_H__
#define __BROADWAY_PROTOCOL_H__
#include <glib.h>
typedef struct {
gint32 x, y;
gint32 width, height;
} BroadwayRect;
typedef enum {
BROADWAY_EVENT_ENTER = 'e',
BROADWAY_EVENT_LEAVE = 'l',
BROADWAY_EVENT_POINTER_MOVE = 'm',
BROADWAY_EVENT_BUTTON_PRESS = 'b',
BROADWAY_EVENT_BUTTON_RELEASE = 'B',
BROADWAY_EVENT_SCROLL = 's',
BROADWAY_EVENT_KEY_PRESS = 'k',
BROADWAY_EVENT_KEY_RELEASE = 'K',
BROADWAY_EVENT_GRAB_NOTIFY = 'g',
BROADWAY_EVENT_UNGRAB_NOTIFY = 'u',
BROADWAY_EVENT_CONFIGURE_NOTIFY = 'w',
BROADWAY_EVENT_DELETE_NOTIFY = 'W',
BROADWAY_EVENT_SCREEN_SIZE_CHANGED = 'd'
} BroadwayEventType;
typedef enum {
BROADWAY_OP_COPY_RECTANGLES = 'b',
BROADWAY_OP_GRAB_POINTER = 'g',
BROADWAY_OP_UNGRAB_POINTER = 'u',
BROADWAY_OP_NEW_SURFACE = 's',
BROADWAY_OP_SHOW_SURFACE = 'S',
BROADWAY_OP_HIDE_SURFACE = 'H',
BROADWAY_OP_DESTROY_SURFACE = 'd',
BROADWAY_OP_MOVE_RESIZE = 'm',
BROADWAY_OP_SET_TRANSIENT_FOR = 'p',
BROADWAY_OP_PUT_RGB = 'i',
BROADWAY_OP_FLUSH = 'f',
} BroadwayOpType;
typedef struct {
guint32 type;
guint32 serial;
guint64 time;
} BroadwayInputBaseMsg;
typedef struct {
BroadwayInputBaseMsg base;
guint32 mouse_window_id; /* The real window, not taking grabs into account */
guint32 event_window_id;
gint32 root_x;
gint32 root_y;
gint32 win_x;
gint32 win_y;
guint32 state;
} BroadwayInputPointerMsg;
typedef struct {
BroadwayInputPointerMsg pointer;
guint32 mode;
} BroadwayInputCrossingMsg;
typedef struct {
BroadwayInputPointerMsg pointer;
guint32 button;
} BroadwayInputButtonMsg;
typedef struct {
BroadwayInputPointerMsg pointer;
gint32 dir;
} BroadwayInputScrollMsg;
typedef struct {
BroadwayInputBaseMsg base;
guint32 mouse_window_id; /* The real window, not taking grabs into account */
guint32 state;
gint32 key;
} BroadwayInputKeyMsg;
typedef struct {
BroadwayInputBaseMsg base;
gint32 res;
} BroadwayInputGrabReply;
typedef struct {
BroadwayInputBaseMsg base;
gint32 id;
gint32 x;
gint32 y;
gint32 width;
gint32 height;
} BroadwayInputConfigureNotify;
typedef struct {
BroadwayInputBaseMsg base;
guint32 width;
guint32 height;
} BroadwayInputScreenResizeNotify;
typedef struct {
BroadwayInputBaseMsg base;
gint32 id;
} BroadwayInputDeleteNotify;
typedef union {
BroadwayInputBaseMsg base;
BroadwayInputPointerMsg pointer;
BroadwayInputCrossingMsg crossing;
BroadwayInputButtonMsg button;
BroadwayInputScrollMsg scroll;
BroadwayInputKeyMsg key;
BroadwayInputGrabReply grab_reply;
BroadwayInputConfigureNotify configure_notify;
BroadwayInputDeleteNotify delete_notify;
BroadwayInputScreenResizeNotify screen_resize_notify;
} BroadwayInputMsg;
typedef enum {
BROADWAY_REQUEST_NEW_WINDOW,
BROADWAY_REQUEST_FLUSH,
BROADWAY_REQUEST_SYNC,
BROADWAY_REQUEST_QUERY_MOUSE,
BROADWAY_REQUEST_DESTROY_WINDOW,
BROADWAY_REQUEST_SHOW_WINDOW,
BROADWAY_REQUEST_HIDE_WINDOW,
BROADWAY_REQUEST_SET_TRANSIENT_FOR,
BROADWAY_REQUEST_TRANSLATE,
BROADWAY_REQUEST_UPDATE,
BROADWAY_REQUEST_MOVE_RESIZE,
BROADWAY_REQUEST_GRAB_POINTER,
BROADWAY_REQUEST_UNGRAB_POINTER
} BroadwayRequestType;
typedef struct {
guint32 size;
guint32 serial;
guint32 type;
} BroadwayRequestBase, BroadwayRequestFlush, BroadwayRequestSync, BroadwayRequestQueryMouse;
typedef struct {
BroadwayRequestBase base;
guint32 id;
} BroadwayRequestDestroyWindow, BroadwayRequestShowWindow, BroadwayRequestHideWindow;
typedef struct {
BroadwayRequestBase base;
guint32 id;
guint32 parent;
} BroadwayRequestSetTransientFor;
typedef struct {
BroadwayRequestBase base;
guint32 id;
gint32 dx;
gint32 dy;
guint32 n_rects;
BroadwayRect rects[1];
} BroadwayRequestTranslate;
typedef struct {
BroadwayRequestBase base;
guint32 id;
char name[34];
guint32 width;
guint32 height;
} BroadwayRequestUpdate;
typedef struct {
BroadwayRequestBase base;
guint32 id;
guint32 owner_events;
guint32 event_mask;
guint32 time_;
} BroadwayRequestGrabPointer;
typedef struct {
BroadwayRequestBase base;
guint32 time_;
} BroadwayRequestUngrabPointer;
typedef struct {
BroadwayRequestBase base;
gint32 x;
gint32 y;
guint32 width;
guint32 height;
guint32 is_temp;
} BroadwayRequestNewWindow;
typedef struct {
BroadwayRequestBase base;
guint32 id;
guint32 with_move;
gint32 x;
gint32 y;
guint32 width;
guint32 height;
} BroadwayRequestMoveResize;
typedef union {
BroadwayRequestBase base;
BroadwayRequestNewWindow new_window;
BroadwayRequestFlush flush;
BroadwayRequestSync sync;
BroadwayRequestQueryMouse query_mouse;
BroadwayRequestDestroyWindow destroy_window;
BroadwayRequestShowWindow show_window;
BroadwayRequestHideWindow hide_window;
BroadwayRequestSetTransientFor set_transient_for;
BroadwayRequestUpdate update;
BroadwayRequestMoveResize move_resize;
BroadwayRequestGrabPointer grab_pointer;
BroadwayRequestUngrabPointer ungrab_pointer;
BroadwayRequestTranslate translate;
} BroadwayRequest;
typedef enum {
BROADWAY_REPLY_EVENT,
BROADWAY_REPLY_SYNC,
BROADWAY_REPLY_QUERY_MOUSE,
BROADWAY_REPLY_NEW_WINDOW,
BROADWAY_REPLY_GRAB_POINTER,
BROADWAY_REPLY_UNGRAB_POINTER
} BroadwayReplyType;
typedef struct {
guint32 size;
guint32 in_reply_to;
guint32 type;
} BroadwayReplyBase, BroadwayReplySync;
typedef struct {
BroadwayReplyBase base;
guint32 id;
} BroadwayReplyNewWindow;
typedef struct {
BroadwayReplyBase base;
guint32 status;
} BroadwayReplyGrabPointer, BroadwayReplyUngrabPointer;
typedef struct {
BroadwayReplyBase base;
guint32 toplevel;
gint32 root_x;
gint32 root_y;
guint32 mask;
} BroadwayReplyQueryMouse;
typedef struct {
BroadwayReplyBase base;
BroadwayInputMsg msg;
} BroadwayReplyEvent;
typedef union {
BroadwayReplyBase base;
BroadwayReplyEvent event;
BroadwayReplyQueryMouse query_mouse;
BroadwayReplyNewWindow new_window;
BroadwayReplyGrabPointer grab_pointer;
BroadwayReplyUngrabPointer ungrab_pointer;
} BroadwayReply;
#endif /* __BROADWAY_PROTOCOL_H__ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,82 @@
#ifndef __BROADWAY_SERVER__
#define __BROADWAY_SERVER__
#include "broadway-protocol.h"
#include <glib-object.h>
#include <cairo.h>
void broadway_events_got_input (BroadwayInputMsg *message,
gint32 client_id);
typedef struct _BroadwayServer BroadwayServer;
typedef struct _BroadwayServerClass BroadwayServerClass;
#define BROADWAY_TYPE_SERVER (broadway_server_get_type())
#define BROADWAY_SERVER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), BROADWAY_TYPE_SERVER, BroadwayServer))
#define BROADWAY_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BROADWAY_TYPE_SERVER, BroadwayServerClass))
#define BROADWAY_IS_SERVER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BROADWAY_TYPE_SERVER))
#define BROADWAY_IS_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BROADWAY_TYPE_SERVER))
#define BROADWAY_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BROADWAY_TYPE_SERVER, BroadwayServerClass))
BroadwayServer *broadway_server_new (char *address,
int port,
GError **error);
gboolean broadway_server_has_client (BroadwayServer *server);
void broadway_server_flush (BroadwayServer *server);
void broadway_server_sync (BroadwayServer *server);
void broadway_server_get_screen_size (BroadwayServer *server,
guint32 *width,
guint32 *height);
guint32 broadway_server_get_next_serial (BroadwayServer *server);
guint32 broadway_server_get_last_seen_time (BroadwayServer *server);
gboolean broadway_server_lookahead_event (BroadwayServer *server,
const char *types);
void broadway_server_query_mouse (BroadwayServer *server,
guint32 *toplevel,
gint32 *root_x,
gint32 *root_y,
guint32 *mask);
guint32 broadway_server_grab_pointer (BroadwayServer *server,
gint client_id,
gint id,
gboolean owner_events,
guint32 event_mask,
guint32 time_);
guint32 broadway_server_ungrab_pointer (BroadwayServer *server,
guint32 time_);
gint32 broadway_server_get_mouse_toplevel (BroadwayServer *server);
guint32 broadway_server_new_window (BroadwayServer *server,
int x,
int y,
int width,
int height,
gboolean is_temp);
void broadway_server_destroy_window (BroadwayServer *server,
gint id);
gboolean broadway_server_window_show (BroadwayServer *server,
gint id);
gboolean broadway_server_window_hide (BroadwayServer *server,
gint id);
void broadway_server_window_set_transient_for (BroadwayServer *server,
gint id,
gint parent);
gboolean broadway_server_window_translate (BroadwayServer *server,
gint id,
cairo_region_t *area,
gint dx,
gint dy);
cairo_surface_t * broadway_server_create_surface (int width,
int height);
void broadway_server_window_update (BroadwayServer *server,
gint id,
cairo_surface_t *surface);
gboolean broadway_server_window_move_resize (BroadwayServer *server,
gint id,
gboolean with_move,
int x,
int y,
int width,
int height);
#endif /* __BROADWAY_SERVER__ */

View File

@@ -132,18 +132,6 @@ function createXHR()
return null;
}
/* This resizes the window so the *inner* size is the specified size */
function resizeBrowserWindow(window, w, h) {
var innerW = window.innerWidth;
var innerH = window.innerHeight;
var outerW = window.outerWidth;
var outerH = window.outerHeight;
window.resizeTo(w + outerW - innerW,
h + outerH - innerH);
}
function resizeCanvas(canvas, w, h)
{
/* Canvas resize clears the data, so we need to save it first */
@@ -163,8 +151,6 @@ function resizeCanvas(canvas, w, h)
context.drawImage(tmpCanvas, 0, 0, tmpCanvas.width, tmpCanvas.height);
}
var useToplevelWindows = false;
var toplevelWindows = [];
var grab = new Object();
grab.window = null;
grab.ownerEvents = false;
@@ -276,121 +262,11 @@ function flushSurface(surface)
}
}
function ensureSurfaceInDocument(surface, doc)
{
if (surface.document != doc) {
var oldCanvas = surface.canvas;
var canvas = doc.importNode(oldCanvas, false);
doc.body.appendChild(canvas);
canvas.surface = surface;
oldCanvas.parentNode.removeChild(oldCanvas);
surface.canvas = canvas;
if (surface.toplevelElement == oldCanvas)
surface.toplevelElement = canvas;
surface.document = doc;
}
}
function sendConfigureNotify(surface)
{
sendInput("w", [surface.id, surface.x, surface.y, surface.width, surface.height]);
}
var windowGeometryTimeout = null;
function updateBrowserWindowGeometry(win, alwaysSendConfigure) {
if (win.closed)
return;
var surface = win.surface;
var innerW = win.innerWidth;
var innerH = win.innerHeight;
var x = surface.x;
var y = surface.y;
if (win.mozInnerScreenX != undefined) {
x = win.mozInnerScreenX;
y = win.mozInnerScreenY;
} else if (win.screenTop != undefined) {
x = win.screenTop;
y = win.screenLeft;
} else {
alert("No implementation to get window position");
}
if (alwaysSendConfigure || x != surface.x || y != surface.y ||
innerW != surface.width || innerH != surface.height) {
var oldX = surface.x;
var oldY = surface.y;
surface.x = x;
surface.y = y;
if (surface.width != innerW || surface.height != innerH)
resizeCanvas(surface.canvas, innerW, innerH);
surface.width = innerW;
surface.height = innerH;
sendConfigureNotify(surface);
for (id in surfaces) {
var childSurface = surfaces[id];
var transientToplevel = getTransientToplevel(childSurface);
if (transientToplevel != null && transientToplevel == surface) {
childSurface.x += surface.x - oldX;
childSurface.y += surface.y - oldY;
sendConfigureNotify(childSurface);
}
}
}
}
function browserWindowClosed(win) {
var surface = win.surface;
sendInput ("W", [surface.id]);
for (id in surfaces) {
var childSurface = surfaces[id];
var transientToplevel = getTransientToplevel(childSurface);
if (transientToplevel != null && transientToplevel == surface) {
sendInput ("W", [childSurface.id]);
}
}
}
function registerWindow(win)
{
toplevelWindows.push(win);
win.onresize = function(ev) { updateBrowserWindowGeometry(ev.target, false); };
if (!windowGeometryTimeout)
windowGeometryTimeout = setInterval(function () {
for (var i = 0; i < toplevelWindows.length; i++)
updateBrowserWindowGeometry(toplevelWindows[i], false);
}, 2000);
win.onunload = function(ev) { browserWindowClosed(ev.target.defaultView); };
}
function unregisterWindow(win)
{
var i = toplevelWindows.indexOf(win);
if (i >= 0)
toplevelWindows.splice(i, 1);
if (windowGeometryTimeout && toplevelWindows.length == 0) {
clearInterval(windowGeometryTimeout);
windowGeometryTimeout = null;
}
}
function getTransientToplevel(surface)
{
while (surface && surface.transientParent != 0) {
surface = surfaces[surface.transientParent];
if (surface && surface.window)
return surface;
}
return null;
}
function getStyle(el, styleProp)
{
if (el.currentStyle) {
@@ -440,8 +316,6 @@ function cmdCreateSurface(id, x, y, width, height, isTemp)
surface.drawQueue = [];
surface.transientParent = 0;
surface.visible = false;
surface.window = null;
surface.document = document;
surface.frame = null;
var canvas = document.createElement("canvas");
@@ -451,7 +325,7 @@ function cmdCreateSurface(id, x, y, width, height, isTemp)
surface.canvas = canvas;
var toplevelElement;
if (useToplevelWindows || isTemp) {
if (isTemp) {
toplevelElement = canvas;
document.body.appendChild(canvas);
} else {
@@ -476,10 +350,6 @@ function cmdCreateSurface(id, x, y, width, height, isTemp)
toplevelElement = frame;
document.body.appendChild(frame);
surface.x = 100 + positionIndex * 10;
surface.y = 100 + positionIndex * 10;
positionIndex = (positionIndex + 1) % 20;
}
surface.toplevelElement = toplevelElement;
@@ -511,52 +381,17 @@ function cmdShowSurface(id)
var xOffset = surface.x;
var yOffset = surface.y;
if (useToplevelWindows) {
var doc = document;
if (!surface.isTemp) {
var options =
'width='+surface.width+',height='+surface.height+
',location=no,menubar=no,scrollbars=no,toolbar=no';
if (surface.positioned)
options = options +
',left='+surface.x+',top='+surface.y+',screenX='+surface.x+',screenY='+surface.y;
var win = window.open('','_blank', options);
win.surface = surface;
registerWindow(win);
doc = win.document;
doc.open();
doc.write("<body></body>");
setupDocument(doc);
surface.window = win;
xOffset = 0;
yOffset = 0;
} else {
var transientToplevel = getTransientToplevel(surface);
if (transientToplevel) {
doc = transientToplevel.window.document;
xOffset = surface.x - transientToplevel.x;
yOffset = surface.y - transientToplevel.y;
}
}
ensureSurfaceInDocument(surface, doc);
} else {
if (surface.frame) {
var offset = getFrameOffset(surface);
xOffset -= offset.x;
yOffset -= offset.y;
}
}
surface.toplevelElement.style["left"] = xOffset + "px";
surface.toplevelElement.style["top"] = yOffset + "px";
surface.toplevelElement.style["visibility"] = "visible";
restackWindows();
if (surface.window)
updateBrowserWindowGeometry(surface.window, false);
}
function cmdHideSurface(id)
@@ -573,15 +408,6 @@ function cmdHideSurface(id)
var element = surface.toplevelElement;
element.style["visibility"] = "hidden";
// Import the canvas into the main document
ensureSurfaceInDocument(surface, document);
if (surface.window) {
unregisterWindow(surface.window);
surface.window.close();
surface.window = null;
}
}
function cmdSetTransientFor(id, parentId)
@@ -666,16 +492,6 @@ function cmdMoveResizeSurface(id, has_pos, x, y, has_size, w, h)
resizeCanvas(surface.canvas, w, h);
if (surface.visible) {
if (surface.window) {
/* TODO: This moves the outer frame position, we really want the inner position.
* However this isn't *strictly* invalid, as any WM could have done whatever it
* wanted with the positioning of the window.
*/
if (has_pos)
surface.window.moveTo(surface.x, surface.y);
if (has_size)
resizeBrowserWindow(surface.window, w, h);
} else {
if (has_pos) {
var xOffset = surface.x;
var yOffset = surface.y;
@@ -698,13 +514,8 @@ function cmdMoveResizeSurface(id, has_pos, x, y, has_size, w, h)
element.style["top"] = yOffset + "px";
}
}
}
if (surface.window) {
updateBrowserWindowGeometry(surface.window, true);
} else {
sendConfigureNotify(surface);
}
}
function cmdFlushSurface(id)
@@ -985,13 +796,8 @@ function getPositionsFromAbsCoord(absX, absY, relativeId) {
function getPositionsFromEvent(ev, relativeId) {
var absX, absY;
if (useToplevelWindows) {
absX = ev.screenX;
absY = ev.screenY;
} else {
absX = ev.pageX;
absY = ev.pageY;
}
var res = getPositionsFromAbsCoord(absX, absY, relativeId);
lastX = res.rootX;
@@ -1020,10 +826,6 @@ function updateForEvent(ev) {
lastState |= GDK_MOD1_MASK;
lastTimeStamp = ev.timeStamp;
if (ev.target.surface && ev.target.surface.window) {
var win = ev.target.surface.window;
updateBrowserWindowGeometry(win, false);
}
}
function onMouseMove (ev) {
@@ -1036,6 +838,8 @@ function onMouseMove (ev) {
surface.x += dx;
surface.y += dy;
var offset = getFrameOffset(surface);
if (surface.y < offset.y)
surface.y = offset.y;
localGrab.frame.style["left"] = (surface.x - offset.x) + "px";
localGrab.frame.style["top"] = (surface.y - offset.y) + "px";
sendConfigureNotify(surface);
@@ -1141,7 +945,7 @@ function onMouseDown (ev) {
localGrab.lastX = ev.pageX;
localGrab.lastY = ev.pageY;
moveToTop(localGrab.frame.frameFor);
return;
return false;
}
if (id == 0 && ev.target.closeFor) { /* mouse click on frame */
@@ -1153,13 +957,14 @@ function onMouseDown (ev) {
localGrab.button = ev.target;
localGrab.lastX = ev.pageX;
localGrab.lastY = ev.pageY;
return;
return false;
}
var pos = getPositionsFromEvent(ev, id);
if (grab.window == null)
doGrab (id, false, true);
sendInput ("b", [realWindowWithMouse, id, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState, button]);
return false;
}
function onMouseUp (ev) {
@@ -1189,13 +994,15 @@ function onMouseUp (ev) {
sendInput ("W", [localGrab.surface.id]);
}
localGrab = null;
return;
return false;
}
sendInput ("B", [realWindowWithMouse, id, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState, button]);
if (grab.window != null && grab.implicit)
doUngrab();
return false;
}
/* Some of the keyboard handling code is from noVNC and
@@ -2671,7 +2478,7 @@ function handleKeyDown(e) {
// browser behaviors or it has no corresponding keyPress
// event, then send it immediately
if (!ignoreKeyEvent(ev))
sendInput("k", [keysym, lastState]);
sendInput("k", [realWindowWithMouse, keysym, lastState]);
suppress = true;
}
@@ -2716,7 +2523,7 @@ function handleKeyPress(e) {
// Send the translated keysym
if (keysym > 0)
sendInput ("k", [keysym, lastState]);
sendInput ("k", [realWindowWithMouse, keysym, lastState]);
// Stop keypress events just in case
return cancelEvent(ev);
@@ -2735,7 +2542,7 @@ function handleKeyUp(e) {
}
if (keysym > 0)
sendInput ("K", [keysym, lastState]);
sendInput ("K", [realWindowWithMouse, keysym, lastState]);
return cancelEvent(ev);
}
@@ -2830,8 +2637,6 @@ function connect()
var query_string = url.split("?");
if (query_string.length > 1) {
var params = query_string[1].split("&");
if (params[0].indexOf("toplevel") != -1)
useToplevelWindows = true;
}
var loc = window.location.toString().replace("http:", "ws:");
@@ -2848,10 +2653,6 @@ function connect()
ws.onopen = function() {
inputSocket = ws;
var w, h;
if (useToplevelWindows) {
w = window.screen.width;
h = window.screen.height;
} else {
w = window.innerWidth;
h = window.innerHeight;
window.onresize = function(ev) {
@@ -2860,7 +2661,6 @@ function connect()
h = window.innerHeight;
sendInput ("d", [w, h]);
};
}
sendInput ("d", [w, h]);
};
ws.onclose = function() {
@@ -2871,8 +2671,4 @@ function connect()
};
setupDocument(document);
window.onunload = function (ev) {
for (var i = 0; i < toplevelWindows.length; i++)
toplevelWindows[i].close();
};
}

636
gdk/broadway/broadwayd.c Normal file
View File

@@ -0,0 +1,636 @@
#include "config.h"
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <glib.h>
#include <gio/gio.h>
#include <gio/gunixsocketaddress.h>
#include "broadway-server.h"
BroadwayServer *server;
GList *clients;
static guint32 client_id_count = 1;
/* Serials:
*
* Broadway tracks serials for all clients primarily to get the right behaviour wrt
* grabs. Each request the client sends gets an increasing per-client serial number, starting
* at 1. Thus, the client can now when a mouse event is seen whether the mouse event was
* sent before or after the server saw the grab request from the client (as this affects how
* the event is handled).
*
* There is only a single stream of increasing serials sent from the daemon to the web browser
* though, called "daemon serials", so we need to map back from the daemon serials to the client
* serials when we send an event to a client. So, each client keeps track of the mappings
* between its serials and daemon serials for any outstanding requests.
*
* There is some additional complexity in that there may be multiple consecutive web browser
* sessions, so we need to keep track of the last daemon serial used inbetween each web client
* connection so that the daemon serials can be strictly increasing.
*/
typedef struct {
guint32 client_serial;
guint32 daemon_serial;
} BroadwaySerialMapping;
typedef struct {
guint32 id;
GSocketConnection *connection;
GBufferedInputStream *in;
GSList *serial_mappings;
GList *windows;
guint disconnect_idle;
} BroadwayClient;
static void
client_free (BroadwayClient *client)
{
g_assert (client->windows == NULL);
g_assert (client->disconnect_idle == 0);
clients = g_list_remove (clients, client);
g_object_unref (client->connection);
g_object_unref (client->in);
g_slist_free_full (client->serial_mappings, g_free);
g_free (client);
}
static void
client_disconnected (BroadwayClient *client)
{
GList *l;
if (client->disconnect_idle != 0)
{
g_source_remove (client->disconnect_idle);
client->disconnect_idle = 0;
}
for (l = client->windows; l != NULL; l = l->next)
broadway_server_destroy_window (server,
GPOINTER_TO_UINT (l->data));
g_list_free (client->windows);
client->windows = NULL;
broadway_server_flush (server);
client_free (client);
}
static gboolean
disconnect_idle_cb (BroadwayClient *client)
{
client->disconnect_idle = 0;
client_disconnected (client);
return G_SOURCE_REMOVE;
}
static void
client_disconnect_in_idle (BroadwayClient *client)
{
if (client->disconnect_idle == 0)
client->disconnect_idle =
g_idle_add_full (G_PRIORITY_DEFAULT, (GSourceFunc)disconnect_idle_cb, client, NULL);
}
static void
send_reply (BroadwayClient *client,
BroadwayRequest *request,
BroadwayReply *reply,
gsize size,
guint32 type)
{
GOutputStream *output;
reply->base.size = size;
reply->base.in_reply_to = request ? request->base.serial : 0;
reply->base.type = type;
output = g_io_stream_get_output_stream (G_IO_STREAM (client->connection));
if (!g_output_stream_write_all (output, reply, size, NULL, NULL, NULL))
{
g_printerr ("can't write to client");
client_disconnect_in_idle (client);
}
}
static cairo_region_t *
region_from_rects (BroadwayRect *rects, int n_rects)
{
cairo_region_t *region;
cairo_rectangle_int_t *cairo_rects;
int i;
cairo_rects = g_new (cairo_rectangle_int_t, n_rects);
for (i = 0; i < n_rects; i++)
{
cairo_rects[i].x = rects[i].x;
cairo_rects[i].y = rects[i].y;
cairo_rects[i].width = rects[i].width;
cairo_rects[i].height = rects[i].height;
}
region = cairo_region_create_rectangles (cairo_rects, n_rects);
g_free (cairo_rects);
return region;
}
static const cairo_user_data_key_t shm_cairo_key;
typedef struct {
void *data;
gsize data_size;
} ShmSurfaceData;
static void
shm_data_unmap (void *_data)
{
ShmSurfaceData *data = _data;
munmap (data->data, data->data_size);
g_free (data);
}
cairo_surface_t *
open_surface (char *name, int width, int height)
{
ShmSurfaceData *data;
cairo_surface_t *surface;
gsize size;
void *ptr;
int fd;
size = width * height * sizeof (guint32);
fd = shm_open(name, O_RDONLY, 0600);
if (fd == -1)
{
perror ("Failed to shm_open");
return NULL;
}
ptr = mmap(0, size, PROT_READ, MAP_SHARED, fd, 0);
(void) close(fd);
if (ptr == NULL)
return NULL;
data = g_new0 (ShmSurfaceData, 1);
data->data = ptr;
data->data_size = size;
surface = cairo_image_surface_create_for_data ((guchar *)data->data,
CAIRO_FORMAT_RGB24,
width, height,
width * sizeof (guint32));
g_assert (surface != NULL);
cairo_surface_set_user_data (surface, &shm_cairo_key,
data, shm_data_unmap);
return surface;
}
void
add_client_serial_mapping (BroadwayClient *client,
guint32 client_serial,
guint32 daemon_serial)
{
BroadwaySerialMapping *map;
GSList *last;
last = g_slist_last (client->serial_mappings);
if (last != NULL)
{
map = last->data;
/* If we have no web client, don't grow forever */
if (map->daemon_serial == daemon_serial)
{
map->client_serial = client_serial;
return;
}
}
map = g_new0 (BroadwaySerialMapping, 1);
map->client_serial = client_serial;
map->daemon_serial = daemon_serial;
client->serial_mappings = g_slist_append (client->serial_mappings, map);
}
/* Returns the latest seen client serial at the time we sent
a daemon request to the browser with a specific daemon serial */
guint32
get_client_serial (BroadwayClient *client, guint32 daemon_serial)
{
BroadwaySerialMapping *map;
GSList *l, *found;
guint32 client_serial = 0;
found = NULL;
for (l = client->serial_mappings; l != NULL; l = l->next)
{
map = l->data;
if (map->daemon_serial <= daemon_serial)
{
found = l;
client_serial = map->client_serial;
}
else
break;
}
/* Remove mappings before the found one, they will never more be used */
while (found != NULL &&
client->serial_mappings != found)
{
g_free (client->serial_mappings->data);
client->serial_mappings =
g_slist_delete_link (client->serial_mappings, client->serial_mappings);
}
return client_serial;
}
static void
client_handle_request (BroadwayClient *client,
BroadwayRequest *request)
{
BroadwayReplyNewWindow reply_new_window;
BroadwayReplySync reply_sync;
BroadwayReplyQueryMouse reply_query_mouse;
BroadwayReplyGrabPointer reply_grab_pointer;
BroadwayReplyUngrabPointer reply_ungrab_pointer;
cairo_region_t *area;
cairo_surface_t *surface;
guint32 before_serial, now_serial;
before_serial = broadway_server_get_next_serial (server);
switch (request->base.type)
{
case BROADWAY_REQUEST_NEW_WINDOW:
reply_new_window.id =
broadway_server_new_window (server,
request->new_window.x,
request->new_window.y,
request->new_window.width,
request->new_window.height,
request->new_window.is_temp);
client->windows =
g_list_prepend (client->windows,
GUINT_TO_POINTER (reply_new_window.id));
send_reply (client, request, (BroadwayReply *)&reply_new_window, sizeof (reply_new_window),
BROADWAY_REPLY_NEW_WINDOW);
break;
case BROADWAY_REQUEST_FLUSH:
broadway_server_flush (server);
break;
case BROADWAY_REQUEST_SYNC:
broadway_server_flush (server);
send_reply (client, request, (BroadwayReply *)&reply_sync, sizeof (reply_sync),
BROADWAY_REPLY_SYNC);
break;
case BROADWAY_REQUEST_QUERY_MOUSE:
broadway_server_query_mouse (server,
&reply_query_mouse.toplevel,
&reply_query_mouse.root_x,
&reply_query_mouse.root_y,
&reply_query_mouse.mask);
send_reply (client, request, (BroadwayReply *)&reply_query_mouse, sizeof (reply_query_mouse),
BROADWAY_REPLY_QUERY_MOUSE);
break;
case BROADWAY_REQUEST_DESTROY_WINDOW:
client->windows =
g_list_remove (client->windows,
GUINT_TO_POINTER (request->destroy_window.id));
broadway_server_destroy_window (server, request->destroy_window.id);
break;
case BROADWAY_REQUEST_SHOW_WINDOW:
broadway_server_window_show (server, request->show_window.id);
break;
case BROADWAY_REQUEST_HIDE_WINDOW:
broadway_server_window_hide (server, request->hide_window.id);
break;
case BROADWAY_REQUEST_SET_TRANSIENT_FOR:
broadway_server_window_set_transient_for (server,
request->set_transient_for.id,
request->set_transient_for.parent);
break;
case BROADWAY_REQUEST_TRANSLATE:
area = region_from_rects (request->translate.rects,
request->translate.n_rects);
broadway_server_window_translate (server,
request->translate.id,
area,
request->translate.dx,
request->translate.dy);
cairo_region_destroy (area);
break;
case BROADWAY_REQUEST_UPDATE:
surface = open_surface (request->update.name,
request->update.width,
request->update.height);
if (surface != NULL)
{
broadway_server_window_update (server,
request->update.id,
surface);
cairo_surface_destroy (surface);
}
break;
case BROADWAY_REQUEST_MOVE_RESIZE:
broadway_server_window_move_resize (server,
request->move_resize.id,
request->move_resize.with_move,
request->move_resize.x,
request->move_resize.y,
request->move_resize.width,
request->move_resize.height);
break;
case BROADWAY_REQUEST_GRAB_POINTER:
reply_grab_pointer.status =
broadway_server_grab_pointer (server,
client->id,
request->grab_pointer.id,
request->grab_pointer.owner_events,
request->grab_pointer.event_mask,
request->grab_pointer.time_);
send_reply (client, request, (BroadwayReply *)&reply_grab_pointer, sizeof (reply_grab_pointer),
BROADWAY_REPLY_GRAB_POINTER);
break;
case BROADWAY_REQUEST_UNGRAB_POINTER:
reply_ungrab_pointer.status =
broadway_server_ungrab_pointer (server,
request->ungrab_pointer.time_);
send_reply (client, request, (BroadwayReply *)&reply_ungrab_pointer, sizeof (reply_ungrab_pointer),
BROADWAY_REPLY_UNGRAB_POINTER);
break;
default:
g_warning ("Unknown request of type %d\n", request->base.type);
}
now_serial = broadway_server_get_next_serial (server);
/* If we sent a new output request, map that this client serial to that, otherwise
update old mapping for previously sent daemon serial */
if (now_serial != before_serial)
add_client_serial_mapping (client,
request->base.serial,
before_serial);
else
add_client_serial_mapping (client,
request->base.serial,
before_serial - 1);
}
static void
client_fill_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
BroadwayClient *client = user_data;
gssize res;
res = g_buffered_input_stream_fill_finish (client->in, result, NULL);
if (res > 0)
{
guint32 size;
gsize count, remaining;
guint8 *buffer;
BroadwayRequest request;
buffer = (guint8 *)g_buffered_input_stream_peek_buffer (client->in, &count);
remaining = count;
while (remaining >= sizeof (guint32))
{
memcpy (&size, buffer, sizeof (guint32));
if (size <= remaining)
{
g_assert (size >= sizeof (BroadwayRequestBase));
g_assert (size <= sizeof (BroadwayRequest));
memcpy (&request, buffer, size);
client_handle_request (client, &request);
remaining -= size;
buffer += size;
}
}
/* This is guaranteed not to block */
g_input_stream_skip (G_INPUT_STREAM (client->in), count - remaining, NULL, NULL);
g_buffered_input_stream_fill_async (client->in,
4*1024,
0,
NULL,
client_fill_cb, client);
}
else
{
client_disconnected (client);
}
}
static gboolean
incoming_client (GSocketService *service,
GSocketConnection *connection,
GObject *source_object)
{
BroadwayClient *client;
GInputStream *input;
BroadwayInputMsg ev = { {0} };
client = g_new0 (BroadwayClient, 1);
client->id = client_id_count++;
client->connection = g_object_ref (connection);
input = g_io_stream_get_input_stream (G_IO_STREAM (client->connection));
client->in = (GBufferedInputStream *)g_buffered_input_stream_new (input);
clients = g_list_prepend (clients, client);
g_buffered_input_stream_fill_async (client->in,
4*1024,
0,
NULL,
client_fill_cb, client);
/* Send initial resize notify */
ev.base.type = BROADWAY_EVENT_SCREEN_SIZE_CHANGED;
ev.base.serial = broadway_server_get_next_serial (server) - 1;
ev.base.time = broadway_server_get_last_seen_time (server);
broadway_server_get_screen_size (server,
&ev.screen_resize_notify.width,
&ev.screen_resize_notify.height);
broadway_events_got_input (&ev,
client->id);
return TRUE;
}
int
main (int argc, char *argv[])
{
GError *error = NULL;
GOptionContext *context;
GMainLoop *loop;
GSocketAddress *address;
GSocketService *listener;
char *path, *base;
char *http_address = NULL;
int http_port = 0;
int display = 1;
const GOptionEntry entries[] = {
{ "port", 'p', 0, G_OPTION_ARG_INT, &http_port, "Httpd port", "PORT" },
{ "address", 'a', 0, G_OPTION_ARG_STRING, &http_address, "Ip address to bind to ", "ADDRESS" },
{ NULL }
};
context = g_option_context_new ("[:DISPLAY] - broadway display daemon");
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
if (!g_option_context_parse (context, &argc, &argv, &error))
{
g_printerr ("option parsing failed: %s\n", error->message);
exit (1);
}
if (argc > 1)
{
if (*argv[1] != ':')
{
g_printerr ("Usage broadwayd [:DISPLAY]\n");
exit (1);
}
display = strtol(argv[1]+1, NULL, 10);
if (display == 0)
{
g_printerr ("Failed to parse display num %s\n", argv[1]);
exit (1);
}
}
if (http_port == 0)
http_port = 8080 + (display - 1);
server = broadway_server_new (http_address, http_port, &error);
if (server == NULL)
{
g_printerr ("%s\n", error->message);
return 1;
}
base = g_strdup_printf ("broadway%d.socket", display);
path = g_build_filename (g_get_user_runtime_dir (), base, NULL);
g_free (base);
g_print ("Listening on %s\n", path);
address = g_unix_socket_address_new_with_type (path, -1,
G_UNIX_SOCKET_ADDRESS_ABSTRACT);
g_free (path);
listener = g_socket_service_new ();
if (!g_socket_listener_add_address (G_SOCKET_LISTENER (listener),
address,
G_SOCKET_TYPE_STREAM,
G_SOCKET_PROTOCOL_DEFAULT,
G_OBJECT (server),
NULL,
&error))
{
g_printerr ("Can't listen: %s\n", error->message);
return 1;
}
g_object_unref (address);
g_signal_connect (listener, "incoming", G_CALLBACK (incoming_client), NULL);
g_socket_service_start (G_SOCKET_SERVICE (listener));
loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (loop);
return 0;
}
static gsize
get_event_size (int type)
{
switch (type)
{
case BROADWAY_EVENT_ENTER:
case BROADWAY_EVENT_LEAVE:
return sizeof (BroadwayInputCrossingMsg);
case BROADWAY_EVENT_POINTER_MOVE:
return sizeof (BroadwayInputPointerMsg);
case BROADWAY_EVENT_BUTTON_PRESS:
case BROADWAY_EVENT_BUTTON_RELEASE:
return sizeof (BroadwayInputButtonMsg);
case BROADWAY_EVENT_SCROLL:
return sizeof (BroadwayInputScrollMsg);
case BROADWAY_EVENT_KEY_PRESS:
case BROADWAY_EVENT_KEY_RELEASE:
return sizeof (BroadwayInputKeyMsg);
case BROADWAY_EVENT_GRAB_NOTIFY:
case BROADWAY_EVENT_UNGRAB_NOTIFY:
return sizeof (BroadwayInputGrabReply);
case BROADWAY_EVENT_CONFIGURE_NOTIFY:
return sizeof (BroadwayInputConfigureNotify);
case BROADWAY_EVENT_DELETE_NOTIFY:
return sizeof (BroadwayInputDeleteNotify);
case BROADWAY_EVENT_SCREEN_SIZE_CHANGED:
return sizeof (BroadwayInputScreenResizeNotify);
default:
g_assert_not_reached ();
}
return 0;
}
void
broadway_events_got_input (BroadwayInputMsg *message,
gint32 client_id)
{
GList *l;
BroadwayReplyEvent reply_event;
gsize size;
guint32 daemon_serial;
size = get_event_size (message->base.type);
g_assert (sizeof (BroadwayReplyBase) + size <= sizeof (BroadwayReplyEvent));
memset (&reply_event, 0, sizeof (BroadwayReplyEvent));
daemon_serial = message->base.serial;
memcpy (&reply_event.msg, message, size);
for (l = clients; l != NULL; l = l->next)
{
BroadwayClient *client = l->data;
if (client_id == -1 ||
client->id == client_id)
{
reply_event.msg.base.serial = get_client_serial (client, daemon_serial);
send_reply (client, NULL, (BroadwayReply *)&reply_event,
G_STRUCT_OFFSET (BroadwayReplyEvent, msg) + size,
BROADWAY_REPLY_EVENT);
}
}
}

View File

@@ -0,0 +1,695 @@
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "gdkbroadway-server.h"
#include "gdkprivate-broadway.h"
#include <glib.h>
#include <glib/gprintf.h>
#include <gio/gunixsocketaddress.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
typedef struct BroadwayInput BroadwayInput;
struct _GdkBroadwayServer {
GObject parent_instance;
guint32 next_serial;
GSocketConnection *connection;
guint32 recv_buffer_size;
guint8 recv_buffer[1024];
guint process_input_idle;
GList *incomming;
};
struct _GdkBroadwayServerClass
{
GObjectClass parent_class;
};
static gboolean input_available_cb (gpointer stream, gpointer user_data);
G_DEFINE_TYPE (GdkBroadwayServer, gdk_broadway_server, G_TYPE_OBJECT)
static void
gdk_broadway_server_init (GdkBroadwayServer *server)
{
server->next_serial = 1;
}
static void
gdk_broadway_server_finalize (GObject *object)
{
G_OBJECT_CLASS (gdk_broadway_server_parent_class)->finalize (object);
}
static void
gdk_broadway_server_class_init (GdkBroadwayServerClass * class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->finalize = gdk_broadway_server_finalize;
}
gboolean
_gdk_broadway_server_lookahead_event (GdkBroadwayServer *server,
const char *types)
{
return FALSE;
}
gulong
_gdk_broadway_server_get_next_serial (GdkBroadwayServer *server)
{
return (gulong)server->next_serial;
}
GdkBroadwayServer *
_gdk_broadway_server_new (int port, GError **error)
{
GdkBroadwayServer *server;
char *basename;
GSocketClient *client;
GSocketConnection *connection;
GSocketAddress *address;
GPollableInputStream *pollable;
GInputStream *in;
GSource *source;
char *path;
basename = g_strdup_printf ("broadway%d.socket", port);
path = g_build_filename (g_get_user_runtime_dir (), basename, NULL);
g_free (basename);
address = g_unix_socket_address_new_with_type (path, -1,
G_UNIX_SOCKET_ADDRESS_ABSTRACT);
g_free (path);
client = g_socket_client_new ();
error = NULL;
connection = g_socket_client_connect (client, G_SOCKET_CONNECTABLE (address), NULL, error);
g_object_unref (address);
g_object_unref (client);
if (connection == NULL)
return NULL;
server = g_object_new (GDK_TYPE_BROADWAY_SERVER, NULL);
server->connection = connection;
in = g_io_stream_get_input_stream (G_IO_STREAM (server->connection));
pollable = G_POLLABLE_INPUT_STREAM (in);
source = g_pollable_input_stream_create_source (pollable, NULL);
g_source_attach (source, NULL);
g_source_set_callback (source, (GSourceFunc)input_available_cb, server, NULL);
return server;
}
guint32
_gdk_broadway_server_get_last_seen_time (GdkBroadwayServer *server)
{
return 0;
}
static guint32
gdk_broadway_server_send_message_with_size (GdkBroadwayServer *server, BroadwayRequestBase *base,
gsize size, guint32 type)
{
GOutputStream *out;
gsize written;
base->size = size;
base->type = type;
base->serial = server->next_serial++;
out = g_io_stream_get_output_stream (G_IO_STREAM (server->connection));
if (!g_output_stream_write_all (out, base, size, &written, NULL, NULL))
{
g_printerr ("Unable to write to server\n");
exit (1);
}
g_assert (written == size);
return base->serial;
}
#define gdk_broadway_server_send_message(_server, _msg, _type) \
gdk_broadway_server_send_message_with_size(_server, (BroadwayRequestBase *)&_msg, sizeof (_msg), _type)
static void
parse_all_input (GdkBroadwayServer *server)
{
guint8 *p, *end;
guint32 size;
BroadwayReply *reply;
p = server->recv_buffer;
end = p + server->recv_buffer_size;
while (p + sizeof (guint32) <= end)
{
memcpy (&size, p, sizeof (guint32));
if (p + size > end)
break;
reply = g_memdup (p, size);
p += size;
server->incomming = g_list_append (server->incomming, reply);
}
if (p < end)
memmove (server->recv_buffer, p, end - p);
server->recv_buffer_size = end - p;
}
static void
read_some_input_blocking (GdkBroadwayServer *server)
{
GInputStream *in;
gssize res;
in = g_io_stream_get_input_stream (G_IO_STREAM (server->connection));
g_assert (server->recv_buffer_size < sizeof (server->recv_buffer));
res = g_input_stream_read (in, &server->recv_buffer[server->recv_buffer_size],
sizeof (server->recv_buffer) - server->recv_buffer_size,
NULL, NULL);
if (res <= 0)
{
g_printerr ("Unable to read from broadway server\n");
exit (1);
}
server->recv_buffer_size += res;
}
static void
read_some_input_nonblocking (GdkBroadwayServer *server)
{
GInputStream *in;
GPollableInputStream *pollable;
gssize res;
GError *error;
in = g_io_stream_get_input_stream (G_IO_STREAM (server->connection));
pollable = G_POLLABLE_INPUT_STREAM (in);
g_assert (server->recv_buffer_size < sizeof (server->recv_buffer));
error = NULL;
res = g_pollable_input_stream_read_nonblocking (pollable, &server->recv_buffer[server->recv_buffer_size],
sizeof (server->recv_buffer) - server->recv_buffer_size,
NULL, &error);
if (res < 0 && g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
{
g_error_free (error);
res = 0;
}
else if (res <= 0)
{
g_printerr ("Unable to read from broadway server: %s\n", error ? error->message : "eof");
exit (1);
}
server->recv_buffer_size += res;
}
static BroadwayReply *
find_response_by_serial (GdkBroadwayServer *server, guint32 serial)
{
GList *l;
for (l = server->incomming; l != NULL; l = l->next)
{
BroadwayReply *reply = l->data;
if (reply->base.in_reply_to == serial)
return reply;
}
return NULL;
}
static void
process_input_messages (GdkBroadwayServer *server)
{
BroadwayReply *reply;
if (server->process_input_idle != 0)
{
g_source_remove (server->process_input_idle);
server->process_input_idle = 0;
}
while (server->incomming)
{
reply = server->incomming->data;
server->incomming =
g_list_delete_link (server->incomming,
server->incomming);
if (reply->base.type == BROADWAY_REPLY_EVENT)
_gdk_broadway_events_got_input (&reply->event.msg);
else
g_warning ("Unhandled reply type %d\n", reply->base.type);
g_free (reply);
}
}
static gboolean
process_input_idle_cb (GdkBroadwayServer *server)
{
server->process_input_idle = 0;
process_input_messages (server);
return G_SOURCE_REMOVE;
}
static void
queue_process_input_at_idle (GdkBroadwayServer *server)
{
if (server->process_input_idle == 0)
server->process_input_idle =
g_idle_add_full (G_PRIORITY_DEFAULT, (GSourceFunc)process_input_idle_cb, server, NULL);
}
static gboolean
input_available_cb (gpointer stream, gpointer user_data)
{
GdkBroadwayServer *server = user_data;
read_some_input_nonblocking (server);
parse_all_input (server);
process_input_messages (server);
return G_SOURCE_CONTINUE;
}
static BroadwayReply *
gdk_broadway_server_wait_for_reply (GdkBroadwayServer *server,
guint32 serial)
{
BroadwayReply *reply;
while (TRUE)
{
reply = find_response_by_serial (server, serial);
if (reply)
{
server->incomming = g_list_remove (server->incomming, reply);
break;
}
read_some_input_blocking (server);
parse_all_input (server);
}
queue_process_input_at_idle (server);
return reply;
}
void
_gdk_broadway_server_flush (GdkBroadwayServer *server)
{
BroadwayRequestFlush msg;
gdk_broadway_server_send_message(server, msg, BROADWAY_REQUEST_FLUSH);
}
void
_gdk_broadway_server_sync (GdkBroadwayServer *server)
{
BroadwayRequestSync msg;
guint32 serial;
BroadwayReply *reply;
serial = gdk_broadway_server_send_message (server, msg,
BROADWAY_REQUEST_SYNC);
reply = gdk_broadway_server_wait_for_reply (server, serial);
g_assert (reply->base.type == BROADWAY_REPLY_SYNC);
g_free (reply);
return;
}
void
_gdk_broadway_server_query_mouse (GdkBroadwayServer *server,
guint32 *toplevel,
gint32 *root_x,
gint32 *root_y,
guint32 *mask)
{
BroadwayRequestQueryMouse msg;
guint32 serial;
BroadwayReply *reply;
serial = gdk_broadway_server_send_message (server, msg,
BROADWAY_REQUEST_QUERY_MOUSE);
reply = gdk_broadway_server_wait_for_reply (server, serial);
g_assert (reply->base.type == BROADWAY_REPLY_QUERY_MOUSE);
if (toplevel)
*toplevel = reply->query_mouse.toplevel;
if (root_x)
*root_x = reply->query_mouse.root_x;
if (root_y)
*root_y = reply->query_mouse.root_y;
if (mask)
*mask = reply->query_mouse.mask;
g_free (reply);
}
guint32
_gdk_broadway_server_new_window (GdkBroadwayServer *server,
int x,
int y,
int width,
int height,
gboolean is_temp)
{
BroadwayRequestNewWindow msg;
guint32 serial, id;
BroadwayReply *reply;
msg.x = x;
msg.y = y;
msg.width = width;
msg.height = height;
msg.is_temp = is_temp;
serial = gdk_broadway_server_send_message (server, msg,
BROADWAY_REQUEST_NEW_WINDOW);
reply = gdk_broadway_server_wait_for_reply (server, serial);
g_assert (reply->base.type == BROADWAY_REPLY_NEW_WINDOW);
id = reply->new_window.id;
g_free (reply);
return id;
}
void
_gdk_broadway_server_destroy_window (GdkBroadwayServer *server,
gint id)
{
BroadwayRequestDestroyWindow msg;
msg.id = id;
gdk_broadway_server_send_message (server, msg,
BROADWAY_REQUEST_DESTROY_WINDOW);
}
gboolean
_gdk_broadway_server_window_show (GdkBroadwayServer *server,
gint id)
{
BroadwayRequestShowWindow msg;
msg.id = id;
gdk_broadway_server_send_message (server, msg,
BROADWAY_REQUEST_SHOW_WINDOW);
return TRUE;
}
gboolean
_gdk_broadway_server_window_hide (GdkBroadwayServer *server,
gint id)
{
BroadwayRequestHideWindow msg;
msg.id = id;
gdk_broadway_server_send_message (server, msg,
BROADWAY_REQUEST_HIDE_WINDOW);
return TRUE;
}
void
_gdk_broadway_server_window_set_transient_for (GdkBroadwayServer *server,
gint id, gint parent)
{
BroadwayRequestSetTransientFor msg;
msg.id = id;
msg.parent = parent;
gdk_broadway_server_send_message (server, msg,
BROADWAY_REQUEST_SET_TRANSIENT_FOR);
}
gboolean
_gdk_broadway_server_window_translate (GdkBroadwayServer *server,
gint id,
cairo_region_t *area,
gint dx,
gint dy)
{
BroadwayRequestTranslate *msg;
cairo_rectangle_int_t rect;
int i, n_rects;
gsize msg_size;
n_rects = cairo_region_num_rectangles (area);
msg_size = sizeof (BroadwayRequestTranslate) + (n_rects-1) * sizeof (BroadwayRect);
msg = g_malloc (msg_size);
msg->id = id;
msg->dx = dx;
msg->dy = dy;
msg->n_rects = n_rects;
for (i = 0; i < n_rects; i++)
{
cairo_region_get_rectangle (area, i, &rect);
msg->rects[i].x = rect.x;
msg->rects[i].y = rect.y;
msg->rects[i].width = rect.width;
msg->rects[i].height = rect.height;
}
gdk_broadway_server_send_message_with_size (server, (BroadwayRequestBase *)msg, msg_size,
BROADWAY_REQUEST_TRANSLATE);
g_free (msg);
return TRUE;
}
static char
make_valid_fs_char (char c)
{
char chars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890";
return chars[c % sizeof (chars)];
}
/* name must have at least space for 34 bytes */
static int
create_random_shm (char *name)
{
guint32 r;
int i, o, fd;
while (TRUE)
{
o = 0;
name[o++] = '/';
name[o++] = 'b';
name[o++] = 'd';
name[o++] = 'w';
name[o++] = '-';
for (i = 0; i < 32/4 - 1; i++)
{
r = g_random_int ();
name[o++] = make_valid_fs_char ((r >> 0) & 0xff);
name[o++] = make_valid_fs_char ((r >> 8) & 0xff);
name[o++] = make_valid_fs_char ((r >> 16) & 0xff);
name[o++] = make_valid_fs_char ((r >> 24) & 0xff);
}
name[o++] = 0;
fd = shm_open(name, O_RDWR|O_CREAT|O_EXCL, 0600);
if (fd >= 0)
return fd;
if (errno != EEXIST)
{
g_printerr ("Unable to allocate shared mem for window");
exit (1);
}
}
}
static const cairo_user_data_key_t gdk_broadway_shm_cairo_key;
typedef struct {
char name[34];
void *data;
gsize data_size;
} BroadwayShmSurfaceData;
static void
shm_data_destroy (void *_data)
{
BroadwayShmSurfaceData *data = _data;
munmap (data->data, data->data_size);
shm_unlink (data->name);
g_free (data);
}
cairo_surface_t *
_gdk_broadway_server_create_surface (int width,
int height)
{
BroadwayShmSurfaceData *data;
cairo_surface_t *surface;
int res;
int fd;
data = g_new (BroadwayShmSurfaceData, 1);
data->data_size = width * height * sizeof (guint32);
fd = create_random_shm (data->name);
res = ftruncate (fd, data->data_size);
g_assert (res != -1);
data->data = mmap(0, data->data_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
(void) close(fd);
surface = cairo_image_surface_create_for_data ((guchar *)data->data,
CAIRO_FORMAT_RGB24, width, height, width * sizeof (guint32));
g_assert (surface != NULL);
cairo_surface_set_user_data (surface, &gdk_broadway_shm_cairo_key,
data, shm_data_destroy);
return surface;
}
void
_gdk_broadway_server_window_update (GdkBroadwayServer *server,
gint id,
cairo_surface_t *surface)
{
BroadwayRequestUpdate msg;
BroadwayShmSurfaceData *data;
if (surface == NULL)
return;
data = cairo_surface_get_user_data (surface, &gdk_broadway_shm_cairo_key);
g_assert (data != NULL);
msg.id = id;
memcpy (msg.name, data->name, 34);
msg.width = cairo_image_surface_get_width (surface);
msg.height = cairo_image_surface_get_height (surface);
gdk_broadway_server_send_message (server, msg,
BROADWAY_REQUEST_UPDATE);
}
gboolean
_gdk_broadway_server_window_move_resize (GdkBroadwayServer *server,
gint id,
gboolean with_move,
int x,
int y,
int width,
int height)
{
BroadwayRequestMoveResize msg;
msg.id = id;
msg.with_move = with_move;
msg.x = x;
msg.y = y;
msg.width = width;
msg.height = height;
gdk_broadway_server_send_message (server, msg,
BROADWAY_REQUEST_MOVE_RESIZE);
return TRUE;
}
GdkGrabStatus
_gdk_broadway_server_grab_pointer (GdkBroadwayServer *server,
gint id,
gboolean owner_events,
guint32 event_mask,
guint32 time_)
{
BroadwayRequestGrabPointer msg;
guint32 serial, status;
BroadwayReply *reply;
msg.id = id;
msg.owner_events = owner_events;
msg.event_mask = event_mask;
msg.time_ = time_;
serial = gdk_broadway_server_send_message (server, msg,
BROADWAY_REQUEST_GRAB_POINTER);
reply = gdk_broadway_server_wait_for_reply (server, serial);
g_assert (reply->base.type == BROADWAY_REPLY_GRAB_POINTER);
status = reply->grab_pointer.status;
g_free (reply);
return status;
}
guint32
_gdk_broadway_server_ungrab_pointer (GdkBroadwayServer *server,
guint32 time_)
{
BroadwayRequestUngrabPointer msg;
guint32 serial, status;
BroadwayReply *reply;
msg.time_ = time_;
serial = gdk_broadway_server_send_message (server, msg,
BROADWAY_REQUEST_UNGRAB_POINTER);
reply = gdk_broadway_server_wait_for_reply (server, serial);
g_assert (reply->base.type == BROADWAY_REPLY_UNGRAB_POINTER);
status = reply->ungrab_pointer.status;
g_free (reply);
return status;
}

View File

@@ -0,0 +1,71 @@
#ifndef __GDK_BROADWAY_SERVER__
#define __GDK_BROADWAY_SERVER__
#include <gdk/gdktypes.h>
#include "broadway-protocol.h"
typedef struct _GdkBroadwayServer GdkBroadwayServer;
typedef struct _GdkBroadwayServerClass GdkBroadwayServerClass;
#define GDK_TYPE_BROADWAY_SERVER (gdk_broadway_server_get_type())
#define GDK_BROADWAY_SERVER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_SERVER, GdkBroadwayServer))
#define GDK_BROADWAY_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_SERVER, GdkBroadwayServerClass))
#define GDK_IS_BROADWAY_SERVER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_BROADWAY_SERVER))
#define GDK_IS_BROADWAY_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_SERVER))
#define GDK_BROADWAY_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_SERVER, GdkBroadwayServerClass))
GdkBroadwayServer *_gdk_broadway_server_new (int port,
GError **error);
void _gdk_broadway_server_flush (GdkBroadwayServer *server);
void _gdk_broadway_server_sync (GdkBroadwayServer *server);
gulong _gdk_broadway_server_get_next_serial (GdkBroadwayServer *server);
guint32 _gdk_broadway_server_get_last_seen_time (GdkBroadwayServer *server);
gboolean _gdk_broadway_server_lookahead_event (GdkBroadwayServer *server,
const char *types);
void _gdk_broadway_server_query_mouse (GdkBroadwayServer *server,
guint32 *toplevel,
gint32 *root_x,
gint32 *root_y,
guint32 *mask);
GdkGrabStatus _gdk_broadway_server_grab_pointer (GdkBroadwayServer *server,
gint id,
gboolean owner_events,
guint32 event_mask,
guint32 time_);
guint32 _gdk_broadway_server_ungrab_pointer (GdkBroadwayServer *server,
guint32 time_);
gint32 _gdk_broadway_server_get_mouse_toplevel (GdkBroadwayServer *server);
guint32 _gdk_broadway_server_new_window (GdkBroadwayServer *server,
int x,
int y,
int width,
int height,
gboolean is_temp);
void _gdk_broadway_server_destroy_window (GdkBroadwayServer *server,
gint id);
gboolean _gdk_broadway_server_window_show (GdkBroadwayServer *server,
gint id);
gboolean _gdk_broadway_server_window_hide (GdkBroadwayServer *server,
gint id);
void _gdk_broadway_server_window_set_transient_for (GdkBroadwayServer *server,
gint id,
gint parent);
gboolean _gdk_broadway_server_window_translate (GdkBroadwayServer *server,
gint id,
cairo_region_t *area,
gint dx,
gint dy);
cairo_surface_t *_gdk_broadway_server_create_surface (int width,
int height);
void _gdk_broadway_server_window_update (GdkBroadwayServer *server,
gint id,
cairo_surface_t *surface);
gboolean _gdk_broadway_server_window_move_resize (GdkBroadwayServer *server,
gint id,
gboolean with_move,
int x,
int y,
int width,
int height);
#endif /* __GDK_BROADWAY_SERVER__ */

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_BROADWAY_CURSOR_H__
#define __GDK_BROADWAY_CURSOR_H__
#if !defined (__GDKBROADWAY_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkbroadway.h> can be included directly."
#endif
#ifndef __GDK_BROADWAY_CURSOR_H__
#define __GDK_BROADWAY_CURSOR_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -17,13 +17,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_BROADWAY_DISPLAY_MANAGER_H__
#define __GDK_BROADWAY_DISPLAY_MANAGER_H__
#if !defined(__GDKBROADWAY_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkbroadway.h> can be included directly."
#endif
#ifndef __GDK_BROADWAY_DISPLAY_MANAGER_H__
#define __GDK_BROADWAY_DISPLAY_MANAGER_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -156,7 +156,10 @@ gdk_broadway_device_query_state (GdkDevice *device,
GdkDisplay *display;
GdkBroadwayDisplay *broadway_display;
GdkScreen *screen;
gint device_root_x, device_root_y;
gint32 device_root_x, device_root_y;
gint32 mouse_toplevel_id;
GdkWindow *mouse_toplevel;
guint32 mask32;
if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
return;
@@ -173,36 +176,12 @@ gdk_broadway_device_query_state (GdkDevice *device,
*root_window = gdk_screen_get_root_window (screen);
}
if (broadway_display->output)
{
_gdk_broadway_display_consume_all_input (display);
if (root_x)
*root_x = broadway_display->future_root_x;
if (root_y)
*root_y = broadway_display->future_root_y;
/* TODO: Should really use future_x/y when we get configure events */
if (win_x)
*win_x = broadway_display->future_root_x - toplevel->x;
if (win_y)
*win_y = broadway_display->future_root_y - toplevel->y;
if (mask)
*mask = broadway_display->future_state;
if (child_window)
{
if (gdk_window_get_window_type (toplevel) == GDK_WINDOW_ROOT)
*child_window =
g_hash_table_lookup (broadway_display->id_ht,
GINT_TO_POINTER (broadway_display->future_mouse_in_toplevel));
else
*child_window = toplevel; /* No native children */
}
return;
}
/* Fallback when unconnected */
device_root_x = broadway_display->last_x;
device_root_y = broadway_display->last_y;
_gdk_broadway_server_query_mouse (broadway_display->server,
&mouse_toplevel_id,
&device_root_x,
&device_root_y,
&mask32);
mouse_toplevel = g_hash_table_lookup (broadway_display->id_ht, GINT_TO_POINTER (mouse_toplevel_id));
if (root_x)
*root_x = device_root_x;
@@ -213,12 +192,12 @@ gdk_broadway_device_query_state (GdkDevice *device,
if (win_y)
*win_y = device_root_y - toplevel->y;
if (mask)
*mask = broadway_display->last_state;
*mask = mask32;
if (child_window)
{
if (gdk_window_get_window_type (toplevel) == GDK_WINDOW_ROOT)
{
*child_window = broadway_display->mouse_in_toplevel;
*child_window = mouse_toplevel;
if (*child_window == NULL)
*child_window = toplevel;
}
@@ -236,13 +215,10 @@ void
_gdk_broadway_window_grab_check_destroy (GdkWindow *window)
{
GdkDisplay *display = gdk_window_get_display (window);
GdkBroadwayDisplay *broadway_display;
GdkDeviceManager *device_manager;
GdkDeviceGrabInfo *grab;
GList *devices, *d;
broadway_display = GDK_BROADWAY_DISPLAY (display);
device_manager = gdk_display_get_device_manager (display);
/* Get all devices */
@@ -257,8 +233,6 @@ _gdk_broadway_window_grab_check_destroy (GdkWindow *window)
{
grab->serial_end = grab->serial_start;
grab->implicit_ungrab = TRUE;
broadway_display->pointer_grab_window = NULL;
}
}
@@ -290,29 +264,11 @@ gdk_broadway_device_grab (GdkDevice *device,
else
{
/* Device is a pointer */
if (broadway_display->pointer_grab_window != NULL &&
time_ != 0 && broadway_display->pointer_grab_time > time_)
return GDK_GRAB_ALREADY_GRABBED;
if (time_ == 0)
time_ = broadway_display->last_seen_time;
broadway_display->pointer_grab_window = window;
broadway_display->pointer_grab_owner_events = owner_events;
broadway_display->pointer_grab_time = time_;
if (broadway_display->output)
{
broadway_output_grab_pointer (broadway_display->output,
return _gdk_broadway_server_grab_pointer (broadway_display->server,
GDK_WINDOW_IMPL_BROADWAY (window->impl)->id,
owner_events);
gdk_display_flush (display);
}
/* TODO: What about toplevel grab events if we're not connected? */
return GDK_GRAB_SUCCESS;
owner_events,
event_mask,
time_);
}
}
@@ -340,31 +296,17 @@ gdk_broadway_device_ungrab (GdkDevice *device,
else
{
/* Device is a pointer */
serial = _gdk_broadway_server_ungrab_pointer (broadway_display->server, time_);
if (broadway_display->pointer_grab_window != NULL &&
time_ != 0 && broadway_display->pointer_grab_time > time_)
return;
/* TODO: What about toplevel grab events if we're not connected? */
if (broadway_display->output)
if (serial != 0)
{
serial = broadway_output_ungrab_pointer (broadway_display->output);
gdk_display_flush (display);
}
else
{
serial = broadway_display->saved_serial;
}
grab = _gdk_display_get_last_device_grab (display, device);
if (grab &&
(time_ == GDK_CURRENT_TIME ||
grab->time == GDK_CURRENT_TIME ||
!TIME_IS_LATER (grab->time, time_)))
grab->serial_end = serial;
broadway_display->pointer_grab_window = NULL;
}
}
}
@@ -375,7 +317,6 @@ gdk_broadway_device_window_at_position (GdkDevice *device,
GdkModifierType *mask,
gboolean get_toplevel)
{
gboolean res;
GdkScreen *screen;
GdkWindow *root_window;
GdkWindow *window;

File diff suppressed because it is too large Load Diff

View File

@@ -27,15 +27,13 @@
#include "gdkwindow.h"
#include "gdkinternals.h"
#include "gdkmain.h"
#include "broadway.h"
#include "gdkbroadway-server.h"
G_BEGIN_DECLS
typedef struct _GdkBroadwayDisplay GdkBroadwayDisplay;
typedef struct _GdkBroadwayDisplayClass GdkBroadwayDisplayClass;
typedef struct BroadwayInput BroadwayInput;
#define GDK_TYPE_BROADWAY_DISPLAY (gdk_broadway_display_get_type())
#define GDK_BROADWAY_DISPLAY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_DISPLAY, GdkBroadwayDisplay))
#define GDK_BROADWAY_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_DISPLAY, GdkBroadwayDisplayClass))
@@ -43,82 +41,6 @@ typedef struct BroadwayInput BroadwayInput;
#define GDK_IS_BROADWAY_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_DISPLAY))
#define GDK_BROADWAY_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_DISPLAY, GdkBroadwayDisplayClass))
typedef struct {
char type;
guint32 serial;
guint64 time;
} BroadwayInputBaseMsg;
typedef struct {
BroadwayInputBaseMsg base;
guint32 mouse_window_id; /* The real window, not taking grabs into account */
guint32 event_window_id;
int root_x;
int root_y;
int win_x;
int win_y;
guint32 state;
} BroadwayInputPointerMsg;
typedef struct {
BroadwayInputPointerMsg pointer;
guint32 mode;
} BroadwayInputCrossingMsg;
typedef struct {
BroadwayInputPointerMsg pointer;
guint32 button;
} BroadwayInputButtonMsg;
typedef struct {
BroadwayInputPointerMsg pointer;
int dir;
} BroadwayInputScrollMsg;
typedef struct {
BroadwayInputBaseMsg base;
guint32 state;
int key;
} BroadwayInputKeyMsg;
typedef struct {
BroadwayInputBaseMsg base;
int res;
} BroadwayInputGrabReply;
typedef struct {
BroadwayInputBaseMsg base;
int id;
int x;
int y;
int width;
int height;
} BroadwayInputConfigureNotify;
typedef struct {
BroadwayInputBaseMsg base;
int width;
int height;
} BroadwayInputScreenResizeNotify;
typedef struct {
BroadwayInputBaseMsg base;
int id;
} BroadwayInputDeleteNotify;
typedef union {
BroadwayInputBaseMsg base;
BroadwayInputPointerMsg pointer;
BroadwayInputCrossingMsg crossing;
BroadwayInputButtonMsg button;
BroadwayInputScrollMsg scroll;
BroadwayInputKeyMsg key;
BroadwayInputGrabReply grab_reply;
BroadwayInputConfigureNotify configure_notify;
BroadwayInputDeleteNotify delete_notify;
BroadwayInputScreenResizeNotify screen_resize_notify;
} BroadwayInputMsg;
struct _GdkBroadwayDisplay
{
GdkDisplay parent_instance;
@@ -129,10 +51,6 @@ struct _GdkBroadwayDisplay
GList *toplevels;
GSource *event_source;
GdkWindow *mouse_in_toplevel;
int last_x, last_y; /* in root coords */
guint32 last_state;
GdkWindow *real_mouse_in_toplevel; /* Not affected by grabs */
/* Keyboard related information */
GdkKeymap *keymap;
@@ -147,24 +65,7 @@ struct _GdkBroadwayDisplay
/* The offscreen window that has the pointer in it (if any) */
GdkWindow *active_offscreen_window;
GSocketService *service;
BroadwayOutput *output;
guint32 saved_serial;
guint64 last_seen_time;
BroadwayInput *input;
GList *input_messages;
guint process_input_idle;
/* Explicit pointer grabs: */
GdkWindow *pointer_grab_window;
guint32 pointer_grab_time;
gboolean pointer_grab_owner_events;
/* Future data, from the currently queued events */
int future_root_x;
int future_root_y;
GdkModifierType future_state;
int future_mouse_in_toplevel;
GdkBroadwayServer *server;
};
struct _GdkBroadwayDisplayClass

View File

@@ -87,9 +87,9 @@ gdk_event_source_check (GSource *source)
}
void
_gdk_broadway_events_got_input (GdkDisplay *display,
BroadwayInputMsg *message)
_gdk_broadway_events_got_input (BroadwayInputMsg *message)
{
GdkDisplay *display = gdk_display_get_default ();
GdkBroadwayDisplay *display_broadway = GDK_BROADWAY_DISPLAY (display);
GdkScreen *screen;
GdkWindow *window;
@@ -97,17 +97,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
GList *node;
switch (message->base.type) {
case 'e': /* Enter */
display_broadway->last_x = message->pointer.root_x;
display_broadway->last_y = message->pointer.root_y;
display_broadway->last_state = message->pointer.state;
display_broadway->real_mouse_in_toplevel =
g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.mouse_window_id));
case BROADWAY_EVENT_ENTER:
window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_window_id));
/* TODO: Unset when it dies */
display_broadway->mouse_in_toplevel = window;
if (window)
{
event = gdk_event_new (GDK_ENTER_NOTIFY);
@@ -134,16 +125,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
_gdk_windowing_got_event (display, node, event, message->base.serial);
}
break;
case 'l': /* Leave */
display_broadway->last_x = message->pointer.root_x;
display_broadway->last_y = message->pointer.root_y;
display_broadway->last_state = message->pointer.state;
display_broadway->real_mouse_in_toplevel =
g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.mouse_window_id));
case BROADWAY_EVENT_LEAVE:
window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_window_id));
display_broadway->mouse_in_toplevel = NULL;
if (window)
{
event = gdk_event_new (GDK_LEAVE_NOTIFY);
@@ -170,13 +153,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
_gdk_windowing_got_event (display, node, event, message->base.serial);
}
break;
case 'm': /* Mouse move */
display_broadway->last_x = message->pointer.root_x;
display_broadway->last_y = message->pointer.root_y;
display_broadway->last_state = message->pointer.state;
display_broadway->real_mouse_in_toplevel =
g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.mouse_window_id));
case BROADWAY_EVENT_POINTER_MOVE:
if (_gdk_broadway_moveresize_handle_event (display, message))
break;
@@ -198,14 +175,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
}
break;
case 'b':
case 'B':
display_broadway->last_x = message->pointer.root_x;
display_broadway->last_y = message->pointer.root_y;
display_broadway->last_state = message->pointer.state;
display_broadway->real_mouse_in_toplevel =
g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.mouse_window_id));
case BROADWAY_EVENT_BUTTON_PRESS:
case BROADWAY_EVENT_BUTTON_RELEASE:
if (message->base.type != 'b' &&
_gdk_broadway_moveresize_handle_event (display, message))
break;
@@ -229,13 +200,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
}
break;
case 's':
display_broadway->last_x = message->pointer.root_x;
display_broadway->last_y = message->pointer.root_y;
display_broadway->last_state = message->pointer.state;
display_broadway->real_mouse_in_toplevel =
g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.mouse_window_id));
case BROADWAY_EVENT_SCROLL:
window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_window_id));
if (window)
{
@@ -254,10 +219,10 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
}
break;
case 'k':
case 'K':
window = display_broadway->mouse_in_toplevel;
case BROADWAY_EVENT_KEY_PRESS:
case BROADWAY_EVENT_KEY_RELEASE:
window = g_hash_table_lookup (display_broadway->id_ht,
GINT_TO_POINTER (message->key.mouse_window_id));
if (window)
{
event = gdk_event_new (message->base.type == 'k' ? GDK_KEY_PRESS : GDK_KEY_RELEASE);
@@ -269,19 +234,17 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
event->key.length = 0;
gdk_event_set_device (event, display->core_pointer);
display_broadway->last_state = message->key.state;
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event, message->base.serial);
}
break;
case 'g':
case 'u':
case BROADWAY_EVENT_GRAB_NOTIFY:
case BROADWAY_EVENT_UNGRAB_NOTIFY:
_gdk_display_device_grab_update (display, display->core_pointer, NULL, message->base.serial);
break;
case 'w':
case BROADWAY_EVENT_CONFIGURE_NOTIFY:
window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->configure_notify.id));
if (window)
{
@@ -312,7 +275,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
}
break;
case 'W':
case BROADWAY_EVENT_DELETE_NOTIFY:
window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->delete_notify.id));
if (window)
{
@@ -324,7 +287,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
}
break;
case 'd':
case BROADWAY_EVENT_SCREEN_SIZE_CHANGED:
screen = gdk_display_get_default_screen (display);
window = gdk_screen_get_root_window (screen);
window->width = message->screen_resize_notify.width;
@@ -335,7 +298,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
break;
default:
g_printerr ("Unknown input command %c\n", message->base.type);
g_printerr ("_gdk_broadway_events_got_input - Unknown input command %c\n", message->base.type);
break;
}
}

View File

@@ -126,8 +126,7 @@ GList *_gdk_broadway_screen_list_visuals (GdkScreen *screen);
void _gdk_broadway_screen_size_changed (GdkScreen *screen,
BroadwayInputScreenResizeNotify *msg);
void _gdk_broadway_events_got_input (GdkDisplay *display,
BroadwayInputMsg *message);
void _gdk_broadway_events_got_input (BroadwayInputMsg *message);
void _gdk_broadway_screen_init_root_window (GdkScreen *screen);
void _gdk_broadway_screen_init_visuals (GdkScreen *screen);

View File

@@ -83,95 +83,17 @@ G_DEFINE_TYPE (GdkWindowImplBroadway,
gdk_window_impl_broadway,
GDK_TYPE_WINDOW_IMPL)
static void
diff_surfaces (cairo_surface_t *surface,
cairo_surface_t *old_surface)
{
guint8 *data, *old_data;
guint32 *line, *old_line;
int w, h, stride, old_stride;
int x, y;
data = cairo_image_surface_get_data (surface);
old_data = cairo_image_surface_get_data (old_surface);
w = cairo_image_surface_get_width (surface);
h = cairo_image_surface_get_height (surface);
stride = cairo_image_surface_get_stride (surface);
old_stride = cairo_image_surface_get_stride (old_surface);
for (y = 0; y < h; y++)
{
line = (guint32 *)data;
old_line = (guint32 *)old_data;
for (x = 0; x < w; x++)
{
if ((*line & 0xffffff) == (*old_line & 0xffffff))
*old_line = 0;
else
*old_line = *line | 0xff000000;
line ++;
old_line ++;
}
data += stride;
old_data += old_stride;
}
}
static guint dirty_flush_id = 0;
static void
window_data_send (BroadwayOutput *output, GdkWindowImplBroadway *impl)
{
cairo_t *cr;
if (impl->surface == NULL)
return;
if (impl->last_synced)
{
diff_surfaces (impl->surface,
impl->last_surface);
broadway_output_put_rgba (output, impl->id, 0, 0,
cairo_image_surface_get_width (impl->last_surface),
cairo_image_surface_get_height (impl->last_surface),
cairo_image_surface_get_stride (impl->last_surface),
cairo_image_surface_get_data (impl->last_surface));
}
else
{
impl->last_synced = TRUE;
broadway_output_put_rgb (output, impl->id, 0, 0,
cairo_image_surface_get_width (impl->surface),
cairo_image_surface_get_height (impl->surface),
cairo_image_surface_get_stride (impl->surface),
cairo_image_surface_get_data (impl->surface));
}
broadway_output_surface_flush (output, impl->id);
cr = cairo_create (impl->last_surface);
cairo_set_source_surface (cr, impl->surface, 0, 0);
cairo_paint (cr);
cairo_destroy (cr);
}
static gboolean
dirty_flush_idle (gpointer data)
{
GList *l;
GdkBroadwayDisplay *display;
BroadwayOutput *output;
dirty_flush_id = 0;
display = GDK_BROADWAY_DISPLAY (gdk_display_get_default ());
output = display->output;
if (output == NULL)
return FALSE;
for (l = display->toplevels; l != NULL; l = l->next)
{
@@ -180,11 +102,15 @@ dirty_flush_idle (gpointer data)
if (impl->dirty)
{
impl->dirty = FALSE;
window_data_send (display->output, impl);
_gdk_broadway_server_window_update (display->server,
impl->id,
impl->surface);
}
}
gdk_display_flush (GDK_DISPLAY (display));
/* We sync here to ensure all references to the impl->surface memory
is done, as we may later paint new data in them. */
gdk_display_sync (GDK_DISPLAY (display));
return FALSE;
}
@@ -192,64 +118,10 @@ dirty_flush_idle (gpointer data)
static void
queue_dirty_flush (GdkBroadwayDisplay *display)
{
if (dirty_flush_id == 0 && display->output != NULL)
if (dirty_flush_id == 0)
dirty_flush_id = gdk_threads_add_idle (dirty_flush_idle, NULL);
}
void
_gdk_broadway_resync_windows (void)
{
GdkBroadwayDisplay *display;
GList *l;
dirty_flush_id = 0;
display = GDK_BROADWAY_DISPLAY (gdk_display_get_default ());
/* First create all windows */
for (l = display->toplevels; l != NULL; l = l->next)
{
GdkWindowImplBroadway *impl = l->data;
GdkWindow *window;
window = impl->wrapper;
if (impl->id == 0)
continue; /* Skip root */
impl->dirty = FALSE;
impl->last_synced = FALSE;
broadway_output_new_surface (display->output,
impl->id,
window->x,
window->y,
window->width,
window->height,
window->window_type == GDK_WINDOW_TEMP);
}
/* Then do everything that may reference other windows */
for (l = display->toplevels; l != NULL; l = l->next)
{
GdkWindowImplBroadway *impl = l->data;
if (impl->id == 0)
continue; /* Skip root */
if (impl->transient_for)
broadway_output_set_transient_for (display->output, impl->id, impl->transient_for);
/* Can't check GDK_WINDOW_IS_MAPPED here, because that doesn't correctly handle
withdrawn windows like menus */
if (impl->visible)
{
broadway_output_show_surface (display->output, impl->id);
window_data_send (display->output, impl);
}
}
gdk_display_flush (GDK_DISPLAY (display));
}
static void
gdk_window_impl_broadway_init (GdkWindowImplBroadway *impl)
{
@@ -275,12 +147,6 @@ gdk_window_impl_broadway_finalize (GObject *object)
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (impl->wrapper));
if (broadway_display->mouse_in_toplevel == GDK_WINDOW (wrapper))
{
/* TODO: Send leave + enter event, update cursors, etc */
broadway_display->mouse_in_toplevel = NULL;
}
g_hash_table_remove (broadway_display->id_ht, GINT_TO_POINTER(impl->id));
if (impl->cursor)
@@ -315,6 +181,7 @@ _gdk_broadway_screen_init_root_window (GdkScreen * screen)
impl->screen = screen;
impl->wrapper = window;
impl->id = 0;
window->window_type = GDK_WINDOW_ROOT;
window->depth = 24;
@@ -341,13 +208,17 @@ _gdk_broadway_display_create_window_impl (GdkDisplay *display,
{
GdkWindowImplBroadway *impl;
GdkBroadwayDisplay *broadway_display;
static int current_id = 1; /* 0 is the root window */
broadway_display = GDK_BROADWAY_DISPLAY (display);
impl = g_object_new (GDK_TYPE_WINDOW_IMPL_BROADWAY, NULL);
window->impl = (GdkWindowImpl *)impl;
impl->id = current_id++;
impl->id = _gdk_broadway_server_new_window (broadway_display->server,
window->x,
window->y,
window->width,
window->height,
window->window_type == GDK_WINDOW_TEMP);
g_hash_table_insert (broadway_display->id_ht, GINT_TO_POINTER(impl->id), window);
impl->wrapper = window;
@@ -358,37 +229,22 @@ _gdk_broadway_display_create_window_impl (GdkDisplay *display,
g_assert (GDK_WINDOW_TYPE (window->parent) == GDK_WINDOW_ROOT);
broadway_display->toplevels = g_list_prepend (broadway_display->toplevels, impl);
if (broadway_display->output)
broadway_output_new_surface (broadway_display->output,
impl->id,
window->x,
window->y,
window->width,
window->height,
window->window_type == GDK_WINDOW_TEMP);
}
void
_gdk_broadway_window_resize_surface (GdkWindow *window)
{
GdkWindowImplBroadway *impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
cairo_surface_t *old, *last_old;
cairo_surface_t *old;
if (impl->surface)
{
old = impl->surface;
last_old = impl->last_surface;
impl->surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
gdk_window_get_width (impl->wrapper),
gdk_window_get_height (impl->wrapper));
impl->last_surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
gdk_window_get_width (impl->wrapper),
impl->surface = _gdk_broadway_server_create_surface (gdk_window_get_width (impl->wrapper),
gdk_window_get_height (impl->wrapper));
cairo_surface_destroy (old);
cairo_surface_destroy (last_old);
}
if (impl->ref_surface)
@@ -413,7 +269,6 @@ static cairo_surface_t *
gdk_window_broadway_ref_cairo_surface (GdkWindow *window)
{
GdkWindowImplBroadway *impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
cairo_t *cr;
int w, h;
if (GDK_IS_WINDOW_IMPL_BROADWAY (window) &&
@@ -425,22 +280,7 @@ gdk_window_broadway_ref_cairo_surface (GdkWindow *window)
/* Create actual backing store if missing */
if (!impl->surface)
{
impl->surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, w, h);
impl->last_surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, w, h);
cr = cairo_create (impl->surface);
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
cairo_rectangle (cr, 0, 0, w, h);
cairo_fill (cr);
cairo_destroy (cr);
cr = cairo_create (impl->last_surface);
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
cairo_rectangle (cr, 0, 0, w, h);
cairo_fill (cr);
cairo_destroy (cr);
}
impl->surface = _gdk_broadway_server_create_surface (w, h);
/* Create a destroyable surface referencing the real one */
if (!impl->ref_surface)
@@ -485,15 +325,12 @@ _gdk_broadway_window_destroy (GdkWindow *window,
{
cairo_surface_destroy (impl->surface);
impl->surface = NULL;
cairo_surface_destroy (impl->last_surface);
impl->last_surface = NULL;
}
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window));
g_hash_table_remove (broadway_display->id_ht, GINT_TO_POINTER(impl->id));
if (broadway_display->output)
broadway_output_destroy_surface (broadway_display->output,
_gdk_broadway_server_destroy_window (broadway_display->server,
impl->id);
}
@@ -546,11 +383,9 @@ gdk_window_broadway_show (GdkWindow *window, gboolean already_mapped)
_gdk_make_event (GDK_WINDOW (window), GDK_MAP, NULL, FALSE);
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window));
if (broadway_display->output)
{
broadway_output_show_surface (broadway_display->output, impl->id);
if (_gdk_broadway_server_window_show (broadway_display->server, impl->id))
queue_dirty_flush (broadway_display);
}
}
static void
@@ -569,17 +404,8 @@ gdk_window_broadway_hide (GdkWindow *window)
_gdk_make_event (GDK_WINDOW (window), GDK_UNMAP, NULL, FALSE);
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window));
if (broadway_display->output)
{
broadway_output_hide_surface (broadway_display->output, impl->id);
if (_gdk_broadway_server_window_hide (broadway_display->server, impl->id))
queue_dirty_flush (broadway_display);
}
if (broadway_display->mouse_in_toplevel == window)
{
/* TODO: Send leave + enter event, update cursors, etc */
broadway_display->mouse_in_toplevel = NULL;
}
_gdk_window_clear_update_area (window);
}
@@ -600,23 +426,14 @@ gdk_window_broadway_move_resize (GdkWindow *window,
{
GdkWindowImplBroadway *impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
GdkBroadwayDisplay *broadway_display;
gboolean changed, size_changed;;
gboolean with_resize;
gboolean size_changed;
size_changed = changed = FALSE;
size_changed = FALSE;
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window));
if (with_move)
{
changed = TRUE;
window->x = x;
window->y = y;
}
with_resize = FALSE;
if (width > 0 || height > 0)
{
with_resize = TRUE;
if (width < 1)
width = 1;
@@ -626,7 +443,6 @@ gdk_window_broadway_move_resize (GdkWindow *window,
if (width != window->width ||
height != window->height)
{
changed = TRUE;
size_changed = TRUE;
/* Resize clears the content */
@@ -639,35 +455,14 @@ gdk_window_broadway_move_resize (GdkWindow *window,
}
}
if (changed)
{
GdkEvent *event;
GList *node;
if (broadway_display->output != NULL)
{
broadway_output_move_resize_surface (broadway_display->output,
_gdk_broadway_server_window_move_resize (broadway_display->server,
impl->id,
with_move, window->x, window->y,
with_resize, window->width, window->height);
with_move,
x, y,
window->width, window->height);
queue_dirty_flush (broadway_display);
if (size_changed)
window->resize_count++;
}
event = gdk_event_new (GDK_CONFIGURE);
event->configure.window = g_object_ref (window);
event->configure.x = window->x;
event->configure.y = window->y;
event->configure.width = window->width;
event->configure.height = window->height;
gdk_event_set_device (event, GDK_DISPLAY_OBJECT (broadway_display)->core_pointer);
node = _gdk_event_queue_append (GDK_DISPLAY_OBJECT (broadway_display), event);
_gdk_windowing_got_event (GDK_DISPLAY_OBJECT (broadway_display), node, event,
_gdk_display_get_next_serial (GDK_DISPLAY (broadway_display)) - 1);
}
}
static gboolean
@@ -787,11 +582,7 @@ gdk_broadway_window_set_transient_for (GdkWindow *window,
impl->transient_for = parent_id;
display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (impl->wrapper));
if (display->output)
{
broadway_output_set_transient_for (display->output, impl->id, impl->transient_for);
gdk_display_flush (GDK_DISPLAY (display));
}
_gdk_broadway_server_window_set_transient_for (display->server, impl->id, impl->transient_for);
}
static void
@@ -1324,20 +1115,10 @@ moveresize_lookahead (GdkDisplay *display,
BroadwayInputMsg *event)
{
GdkBroadwayDisplay *broadway_display;
BroadwayInputMsg *message;
GList *l;
broadway_display = GDK_BROADWAY_DISPLAY (display);
for (l = broadway_display->input_messages; l != NULL; l = l->next)
{
message = l->data;
if (message->base.type == 'm')
return FALSE;
if (message->base.type == 'b')
return FALSE;
}
return TRUE;
return !_gdk_broadway_server_lookahead_event (broadway_display->server, "mb");
}
gboolean
@@ -1480,8 +1261,6 @@ gdk_broadway_window_begin_resize_drag (GdkWindow *window,
/* We need a connection to be able to get mouse events, if not, punt */
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window));
if (!broadway_display->output)
return;
mv_resize = get_move_resize_data (GDK_WINDOW_DISPLAY (window), TRUE);
@@ -1622,9 +1401,6 @@ _gdk_broadway_window_translate (GdkWindow *window,
{
GdkWindowImplBroadway *impl;
GdkBroadwayDisplay *broadway_display;
int n_rects, i;
BroadwayRect *rects;
cairo_rectangle_int_t rect;
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
@@ -1632,26 +1408,11 @@ _gdk_broadway_window_translate (GdkWindow *window,
{
copy_region (impl->surface, area, dx, dy);
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window));
if (GDK_WINDOW_IMPL_BROADWAY (impl)->last_synced &&
broadway_display->output)
{
copy_region (impl->last_surface, area, dx, dy);
n_rects = cairo_region_num_rectangles (area);
rects = g_new (BroadwayRect, n_rects);
for (i = 0; i < n_rects; i++)
{
cairo_region_get_rectangle (area, i, &rect);
rects[i].x = rect.x;
rects[i].y = rect.y;
rects[i].width = rect.width;
rects[i].height = rect.height;
}
broadway_output_copy_rectangles (broadway_display->output,
GDK_WINDOW_IMPL_BROADWAY (impl)->id,
rects, n_rects, dx, dy);
if (_gdk_broadway_server_window_translate (broadway_display->server,
impl->id,
area, dx, dy))
queue_dirty_flush (broadway_display);
g_free (rects);
}
}
}
@@ -1661,8 +1422,7 @@ gdk_broadway_get_last_seen_time (GdkWindow *window)
GdkDisplay *display;
display = gdk_window_get_display (window);
_gdk_broadway_display_consume_all_input (display);
return (guint32) GDK_BROADWAY_DISPLAY (display)->last_seen_time;
return _gdk_broadway_server_get_last_seen_time (GDK_BROADWAY_DISPLAY (display)->server);
}
static void

View File

@@ -18,13 +18,13 @@
* Author: Alexander Larsson <alexl@redhat.com>
*/
#ifndef __GDK_APP_LAUNCH_CONTEXT_H__
#define __GDK_APP_LAUNCH_CONTEXT_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_APP_LAUNCH_CONTEXT_H__
#define __GDK_APP_LAUNCH_CONTEXT_H__
#include <gio/gio.h>
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>

View File

@@ -15,13 +15,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_CAIRO_H__
#define __GDK_CAIRO_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_CAIRO_H__
#define __GDK_CAIRO_H__
#include <gdk/gdkversionmacros.h>
#include <gdk/gdkcolor.h>
#include <gdk/gdkrgba.h>

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_COLOR_H__
#define __GDK_COLOR_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_COLOR_H__
#define __GDK_COLOR_H__
#include <cairo.h>
#include <gdk/gdktypes.h>

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_CURSOR_H__
#define __GDK_CURSOR_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_CURSOR_H__
#define __GDK_CURSOR_H__
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <gdk-pixbuf/gdk-pixbuf.h>

View File

@@ -15,13 +15,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_DEVICE_H__
#define __GDK_DEVICE_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_DEVICE_H__
#define __GDK_DEVICE_H__
#include <gdk/gdktypes.h>

View File

@@ -15,13 +15,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_DEVICE_MANAGER_H__
#define __GDK_DEVICE_MANAGER_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_DEVICE_MANAGER_H__
#define __GDK_DEVICE_MANAGER_H__
#include <gdk/gdktypes.h>
#include <gdk/gdkdevice.h>

View File

@@ -19,13 +19,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_DISPLAY_H__
#define __GDK_DISPLAY_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_DISPLAY_H__
#define __GDK_DISPLAY_H__
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkevents.h>

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_DISPLAY_MANAGER_H__
#define __GDK_DISPLAY_MANAGER_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_DISPLAY_MANAGER_H__
#define __GDK_DISPLAY_MANAGER_H__
#include <gdk/gdktypes.h>
#include <gdk/gdkdisplay.h>

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_DND_H__
#define __GDK_DND_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_DND_H__
#define __GDK_DND_H__
#include <gdk/gdktypes.h>
#include <gdk/gdkdevice.h>

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_EVENTS_H__
#define __GDK_EVENTS_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_EVENTS_H__
#define __GDK_EVENTS_H__
#include <gdk/gdkversionmacros.h>
#include <gdk/gdkcolor.h>
#include <gdk/gdktypes.h>

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_KEYS_H__
#define __GDK_KEYS_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_KEYS_H__
#define __GDK_KEYS_H__
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_MAIN_H__
#define __GDK_MAIN_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_MAIN_H__
#define __GDK_MAIN_H__
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>

View File

@@ -15,13 +15,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_PANGO_H__
#define __GDK_PANGO_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_PANGO_H__
#define __GDK_PANGO_H__
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_PIXBUF_H__
#define __GDK_PIXBUF_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_PIXBUF_H__
#define __GDK_PIXBUF_H__
#include <cairo.h>
#include <gdk/gdktypes.h>
#include <gdk-pixbuf/gdk-pixbuf.h>

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_PROPERTY_H__
#define __GDK_PROPERTY_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_PROPERTY_H__
#define __GDK_PROPERTY_H__
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_RECTANGLE_H__
#define __GDK_RECTANGLE_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_RECTANGLE_H__
#define __GDK_RECTANGLE_H__
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_RGBA_H__
#define __GDK_RGBA_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_RGBA_H__
#define __GDK_RGBA_H__
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -19,13 +19,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_SCREEN_H__
#define __GDK_SCREEN_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_SCREEN_H__
#define __GDK_SCREEN_H__
#include <cairo.h>
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_SELECTION_H__
#define __GDK_SELECTION_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_SELECTION_H__
#define __GDK_SELECTION_H__
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -16,13 +16,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_TEST_UTILS_H__
#define __GDK_TEST_UTILS_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_TEST_UTILS_H__
#define __GDK_TEST_UTILS_H__
#include <gdk/gdkwindow.h>
G_BEGIN_DECLS

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_THREADS_H__
#define __GDK_THREADS_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_THREADS_H__
#define __GDK_THREADS_H__
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_TYPES_H__
#define __GDK_TYPES_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_TYPES_H__
#define __GDK_TYPES_H__
/* GDK uses "glib". (And so does GTK).
*/
#include <glib.h>

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_VISUAL_H__
#define __GDK_VISUAL_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_VISUAL_H__
#define __GDK_VISUAL_H__
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -6550,7 +6550,7 @@ gdk_window_set_background (GdkWindow *window,
**/
void
gdk_window_set_background_rgba (GdkWindow *window,
GdkRGBA *rgba)
const GdkRGBA *rgba)
{
cairo_pattern_t *pattern;

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_WINDOW_H__
#define __GDK_WINDOW_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_WINDOW_H__
#define __GDK_WINDOW_H__
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkevents.h>
@@ -660,7 +660,7 @@ GDK_DEPRECATED_IN_3_4_FOR(gdk_window_set_background_rgba)
void gdk_window_set_background (GdkWindow *window,
const GdkColor *color);
void gdk_window_set_background_rgba (GdkWindow *window,
GdkRGBA *rgba);
const GdkRGBA *rgba);
void gdk_window_set_background_pattern (GdkWindow *window,
cairo_pattern_t *pattern);
cairo_pattern_t *gdk_window_get_background_pattern (GdkWindow *window);

View File

@@ -28,9 +28,14 @@ GdkWindow *_gdk_root = NULL;
GdkOSXVersion
gdk_quartz_osx_version (void)
{
gint minor;
OSErr err = Gestalt (gestaltSystemVersionMinor, &minor);
static gint32 minor = GDK_OSX_UNSUPPORTED;
if (minor == GDK_OSX_UNSUPPORTED)
{
OSErr err = Gestalt (gestaltSystemVersionMinor, (SInt32*)&minor);
g_return_val_if_fail (err == noErr, GDK_OSX_UNSUPPORTED);
}
if (minor < GDK_OSX_MIN)
return GDK_OSX_UNSUPPORTED;

View File

@@ -48,7 +48,8 @@ typedef enum
GDK_OSX_LEOPARD = 5,
GDK_OSX_SNOW_LEOPARD = 6,
GDK_OSX_LION = 7,
GDK_OSX_CURRENT = 7,
GDK_OSX_MOUNTAIN_LION = 8,
GDK_OSX_CURRENT = 8,
GDK_OSX_NEW = 99
} GdkOSXVersion;

View File

@@ -17,13 +17,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_QUARTZ_CURSOR_H__
#define __GDK_QUARTZ_CURSOR_H__
#if !defined(__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkquartz.h> can be included directly."
#endif
#ifndef __GDK_QUARTZ_CURSOR_H__
#define __GDK_QUARTZ_CURSOR_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -15,13 +15,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_QUARTZ_DEVICE_CORE_H__
#define __GDK_QUARTZ_DEVICE_CORE_H__
#if !defined(__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkquartz.h> can be included directly."
#endif
#ifndef __GDK_QUARTZ_DEVICE_CORE_H__
#define __GDK_QUARTZ_DEVICE_CORE_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -15,13 +15,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_QUARTZ_DEVICE_MANAGER_CORE_H__
#define __GDK_QUARTZ_DEVICE_MANAGER_CORE_H__
#if !defined(__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkquartz.h> can be included directly."
#endif
#ifndef __GDK_QUARTZ_DEVICE_MANAGER_CORE_H__
#define __GDK_QUARTZ_DEVICE_MANAGER_CORE_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -17,13 +17,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_QUARTZ_DISPLAY_H__
#define __GDK_QUARTZ_DISPLAY_H__
#if !defined(__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkquartz.h> can be included directly."
#endif
#ifndef __GDK_QUARTZ_DISPLAY_H__
#define __GDK_QUARTZ_DISPLAY_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -17,13 +17,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_QUARTZ_DISPLAY_MANAGER_H__
#define __GDK_QUARTZ_DISPLAY_MANAGER_H__
#if !defined(__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkquartz.h> can be included directly."
#endif
#ifndef __GDK_QUARTZ_DISPLAY_MANAGER_H__
#define __GDK_QUARTZ_DISPLAY_MANAGER_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -16,13 +16,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_QUARTZ_DND_H__
#define __GDK_QUARTZ_DND_H__
#if !defined(__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkquartz.h> can be included directly."
#endif
#ifndef __GDK_QUARTZ_DND_H__
#define __GDK_QUARTZ_DND_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -17,13 +17,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_QUARTZ_KEYS_H__
#define __GDK_QUARTZ_KEYS_H__
#if !defined (__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkquartz.h> can be included directly."
#endif
#ifndef __GDK_QUARTZ_KEYS_H__
#define __GDK_QUARTZ_KEYS_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -16,13 +16,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_QUARTZ_SCREEN_H__
#define __GDK_QUARTZ_SCREEN_H__
#if !defined(__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkquartz.h> can be included directly."
#endif
#ifndef __GDK_QUARTZ_SCREEN_H__
#define __GDK_QUARTZ_SCREEN_H__
G_BEGIN_DECLS
#include <gdk/gdk.h>

View File

@@ -17,13 +17,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_QUARTZ_UTILS_H__
#define __GDK_QUARTZ_UTILS_H__
#if !defined (__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkquartz.h> can be included directly."
#endif
#ifndef __GDK_QUARTZ_UTILS_H__
#define __GDK_QUARTZ_UTILS_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -17,13 +17,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_QUARTZ_VISUAL_H__
#define __GDK_QUARTZ_VISUAL_H__
#if !defined (__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkquartz.h> can be included directly."
#endif
#ifndef __GDK_QUARTZ_VISUAL_H__
#define __GDK_QUARTZ_VISUAL_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -17,13 +17,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_QUARTZ_WINDOW_H__
#define __GDK_QUARTZ_WINDOW_H__
#if !defined (__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkquartz.h> can be included directly."
#endif
#ifndef __GDK_QUARTZ_WINDOW_H__
#define __GDK_QUARTZ_WINDOW_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_WIN32_CURSOR_H__
#define __GDK_WIN32_CURSOR_H__
#if !defined (__GDKWIN32_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkwin32.h> can be included directly."
#endif
#ifndef __GDK_WIN32_CURSOR_H__
#define __GDK_WIN32_CURSOR_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_WIN32_DISPLAY_H__
#define __GDK_WIN32_DISPLAY_H__
#if !defined (__GDKWIN32_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkwin32.h> can be included directly."
#endif
#ifndef __GDK_WIN32_DISPLAY_H__
#define __GDK_WIN32_DISPLAY_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -15,13 +15,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_WIN32_DISPLAY_MANAGER_H__
#define __GDK_WIN32_DISPLAY_MANAGER_H__
#if !defined (__GDKWIN32_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkwin32.h> can be included directly."
#endif
#ifndef __GDK_WIN32_DISPLAY_MANAGER_H__
#define __GDK_WIN32_DISPLAY_MANAGER_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -15,13 +15,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_WIN32_DND_H__
#define __GDK_WIN32_DND_H__
#if !defined (__GDKWIN32_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkwin32.h> can be included directly."
#endif
#ifndef __GDK_WIN32_DND_H__
#define __GDK_WIN32_DND_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -15,13 +15,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_WIN32_KEYS_H__
#define __GDK_WIN32_KEYS_H__
#if !defined (__GDKWIN32_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkwin32.h> can be included directly."
#endif
#ifndef __GDK_WIN32_KEYS_H__
#define __GDK_WIN32_KEYS_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_WIN32_SCREEN_H__
#define __GDK_WIN32_SCREEN_H__
#if !defined (__GDKWIN32_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkwin32.h> can be included directly."
#endif
#ifndef __GDK_WIN32_SCREEN_H__
#define __GDK_WIN32_SCREEN_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_WIN32_WINDOW_H__
#define __GDK_WIN32_WINDOW_H__
#if !defined (__GDKWIN32_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkwin32.h> can be included directly."
#endif
#ifndef __GDK_WIN32_WINDOW_H__
#define __GDK_WIN32_WINDOW_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -27,6 +27,7 @@
#include "config.h"
#include <stdlib.h>
#include <windows.h>
#include "gdk.h"
#include "gdkwindowimpl.h"
@@ -1533,7 +1534,7 @@ gdk_win32_window_set_urgency_hint (GdkWindow *window,
gboolean urgent)
{
FLASHWINFO flashwinfo;
typedef BOOL (*PFN_FlashWindowEx) (FLASHWINFO*);
typedef BOOL (WINAPI *PFN_FlashWindowEx) (FLASHWINFO*);
PFN_FlashWindowEx flashWindowEx = NULL;
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -3264,7 +3265,7 @@ gdk_win32_window_set_opacity (GdkWindow *window,
gdouble opacity)
{
LONG exstyle;
typedef BOOL (*PFN_SetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD);
typedef BOOL (WINAPI *PFN_SetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD);
PFN_SetLayeredWindowAttributes setLayeredWindowAttributes = NULL;
g_return_if_fail (GDK_IS_WINDOW (window));

View File

@@ -917,12 +917,14 @@ is_parent_of (GdkWindow *parent,
return FALSE;
}
static GdkWindow *
static gboolean
get_event_window (GdkEventTranslator *translator,
XIEvent *ev)
XIEvent *ev,
GdkWindow **window_p)
{
GdkDisplay *display;
GdkWindow *window = NULL;
gboolean should_have_window = TRUE;
display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (translator));
@@ -976,9 +978,17 @@ get_event_window (GdkEventTranslator *translator,
window = gdk_x11_window_lookup_for_display (display, xev->event);
}
break;
default:
should_have_window = FALSE;
break;
}
return window;
*window_p = window;
if (should_have_window && !window)
return FALSE;
return TRUE;
}
static gboolean
@@ -1122,7 +1132,8 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
if (!ev)
return FALSE;
window = get_event_window (translator, ev);
if (!get_event_window (translator, ev, &window))
return FALSE;
if (window && GDK_WINDOW_DESTROYED (window))
return FALSE;
@@ -1650,6 +1661,7 @@ gdk_x11_device_manager_xi2_get_window (GdkEventTranslator *translator,
{
GdkX11DeviceManagerXI2 *device_manager;
XIEvent *ev;
GdkWindow *window = NULL;
device_manager = (GdkX11DeviceManagerXI2 *) translator;
@@ -1659,7 +1671,8 @@ gdk_x11_device_manager_xi2_get_window (GdkEventTranslator *translator,
ev = (XIEvent *) xevent->xcookie.data;
return get_event_window (translator, ev);
get_event_window (translator, ev, &window);
return window;
}
GdkDevice *

View File

@@ -1369,15 +1369,14 @@ _gdk_x11_display_open (const gchar *display_name)
XSynchronize (display_x11->xdisplay, True);
class_hint = XAllocClassHint();
class_hint->res_name = g_get_prgname ();
class_hint->res_name = (char *) g_get_prgname ();
class_hint->res_class = (char *)gdk_get_program_class ();
/* XmbSetWMProperties sets the RESOURCE_NAME environment variable
* from argv[0], so we just synthesize an argument array here.
*/
argc = 1;
argv[0] = g_get_prgname ();
argv[0] = (char *) g_get_prgname ();
XmbSetWMProperties (display_x11->xdisplay,
display_x11->leader_window,

View File

@@ -280,6 +280,10 @@ get_current_desktop (GdkScreen *screen)
unsigned char *data_return = NULL;
int workspace = 0;
if (!gdk_x11_screen_supports_net_wm_hint (screen,
gdk_atom_intern_static_string ("_NET_CURRENT_DESKTOP")))
return workspace;
display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
win = XRootWindow (display, GDK_SCREEN_XNUMBER (screen));
@@ -330,6 +334,10 @@ get_work_area (GdkScreen *screen,
area->width = gdk_screen_get_width (screen);
area->height = gdk_screen_get_height (screen);
if (!gdk_x11_screen_supports_net_wm_hint (screen,
gdk_atom_intern_static_string ("_NET_WORKAREA")))
return;
if (workarea == None)
return;

View File

@@ -82,7 +82,8 @@ static const char gdk_settings_names[] =
"Gtk/VisibleFocus\0" "gtk-visible-focus\0"
"Gtk/ShellShowsAppMenu\0" "gtk-shell-shows-app-menu\0"
"Gtk/ShellShowsMenubar\0" "gtk-shell-shows-menubar\0"
"Gtk/EnablePrimaryPaste\0" "gtk-enable-primary-paste\0";
"Gtk/EnablePrimaryPaste\0" "gtk-enable-primary-paste\0"
"Gtk/RecentFilesMaxAge\0" "gtk-recent-files-max-age\0";
@@ -140,5 +141,6 @@ static const struct
{ 1767, 1784 },
{ 1802, 1824 },
{ 1849, 1871 },
{ 1895, 1918 }
{ 1895, 1918 },
{ 1943, 1965 }
};

View File

@@ -1738,7 +1738,9 @@ static void
move_to_current_desktop (GdkWindow *window)
{
if (gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
gdk_atom_intern_static_string ("_NET_WM_DESKTOP")))
gdk_atom_intern_static_string ("_NET_WM_DESKTOP")) &&
gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
gdk_atom_intern_static_string ("_NET_CURRENT_DESKTOP")))
{
Atom type;
gint format;
@@ -2717,7 +2719,9 @@ gdk_x11_window_get_frame_extents (GdkWindow *window,
xwindow = GDK_WINDOW_XID (window);
/* first try: use _NET_FRAME_EXTENTS */
if (XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), xwindow,
if (gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
gdk_atom_intern_static_string ("_NET_FRAME_EXTENTS")) &&
XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), xwindow,
gdk_x11_get_xatom_by_name_for_display (display,
"_NET_FRAME_EXTENTS"),
0, G_MAXLONG, False, XA_CARDINAL, &type_return,
@@ -2764,7 +2768,9 @@ gdk_x11_window_get_frame_extents (GdkWindow *window,
/* use NETWM_VIRTUAL_ROOTS if available */
root = GDK_WINDOW_XROOTWIN (window);
if (XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), root,
if (gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
gdk_atom_intern_static_string ("_NET_VIRTUAL_ROOTS")) &&
XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), root,
gdk_x11_get_xatom_by_name_for_display (display,
"_NET_VIRTUAL_ROOTS"),
0, G_MAXLONG, False, XA_WINDOW, &type_return,

View File

@@ -15,13 +15,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_X11_APP_LAUNCH_CONTEXT_H__
#define __GDK_X11_APP_LAUNCH_CONTEXT_H__
#if !defined (__GDKX_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkx.h> can be included directly."
#endif
#ifndef __GDK_X11_APP_LAUNCH_CONTEXT_H__
#define __GDK_X11_APP_LAUNCH_CONTEXT_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_X11_CURSOR_H__
#define __GDK_X11_CURSOR_H__
#if !defined (__GDKX_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkx.h> can be included directly."
#endif
#ifndef __GDK_X11_CURSOR_H__
#define __GDK_X11_CURSOR_H__
#include <gdk/gdk.h>
#include <X11/Xlib.h>

View File

@@ -15,13 +15,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_X11_DEVICE_H__
#define __GDK_X11_DEVICE_H__
#if !defined (__GDKX_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkx.h> can be included directly."
#endif
#ifndef __GDK_X11_DEVICE_H__
#define __GDK_X11_DEVICE_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -15,13 +15,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_X11_DEVICE_MANAGER_H__
#define __GDK_X11_DEVICE_MANAGER_H__
#if !defined (__GDKX_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkx.h> can be included directly."
#endif
#ifndef __GDK_X11_DEVICE_MANAGER_H__
#define __GDK_X11_DEVICE_MANAGER_H__
#include <gdk/gdk.h>
#include <X11/Xlib.h>

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_X11_DISPLAY_H__
#define __GDK_X11_DISPLAY_H__
#if !defined (__GDKX_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkx.h> can be included directly."
#endif
#ifndef __GDK_X11_DISPLAY_H__
#define __GDK_X11_DISPLAY_H__
#include <gdk/gdk.h>
#include <X11/Xlib.h>

View File

@@ -15,13 +15,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_X11_DISPLAY_MANAGER_H__
#define __GDK_X11_DISPLAY_MANAGER_H__
#if !defined (__GDKX_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkx.h> can be included directly."
#endif
#ifndef __GDK_X11_DISPLAY_MANAGER_H__
#define __GDK_X11_DISPLAY_MANAGER_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -15,13 +15,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_X11_DND_H__
#define __GDK_X11_DND_H__
#if !defined (__GDKX_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkx.h> can be included directly."
#endif
#ifndef __GDK_X11_DND_H__
#define __GDK_X11_DND_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -15,13 +15,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_X11_KEYS_H__
#define __GDK_X11_KEYS_H__
#if !defined (__GDKX_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkx.h> can be included directly."
#endif
#ifndef __GDK_X11_KEYS_H__
#define __GDK_X11_KEYS_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_X11_PROPERTY_H__
#define __GDK_X11_PROPERTY_H__
#if !defined (__GDKX_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkx.h> can be included directly."
#endif
#ifndef __GDK_X11_PROPERTY_H__
#define __GDK_X11_PROPERTY_H__
#include <gdk/gdk.h>
#include <X11/Xlib.h>

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_X11_SCREEN_H__
#define __GDK_X11_SCREEN_H__
#if !defined (__GDKX_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkx.h> can be included directly."
#endif
#ifndef __GDK_X11_SCREEN_H__
#define __GDK_X11_SCREEN_H__
#include <gdk/gdk.h>
#include <X11/Xlib.h>

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_X11_SELECTION_H__
#define __GDK_X11_SELECTION_H__
#if !defined (__GDKX_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkx.h> can be included directly."
#endif
#ifndef __GDK_X11_SELECTION_H__
#define __GDK_X11_SELECTION_H__
#include <gdk/gdk.h>
#include <X11/Xlib.h>

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_X11_UTILS_H__
#define __GDK_X11_UTILS_H__
#if !defined (__GDKX_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkx.h> can be included directly."
#endif
#ifndef __GDK_X11_UTILS_H__
#define __GDK_X11_UTILS_H__
#include <gdk/gdk.h>
#include <X11/Xlib.h>

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_X11_VISUAL_H__
#define __GDK_X11_VISUAL_H__
#if !defined (__GDKX_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkx.h> can be included directly."
#endif
#ifndef __GDK_X11_VISUAL_H__
#define __GDK_X11_VISUAL_H__
#include <gdk/gdk.h>
#include <X11/Xlib.h>

View File

@@ -22,13 +22,13 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_X11_WINDOW_H__
#define __GDK_X11_WINDOW_H__
#if !defined (__GDKX_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkx.h> can be included directly."
#endif
#ifndef __GDK_X11_WINDOW_H__
#define __GDK_X11_WINDOW_H__
#include <gdk/gdk.h>
#include <X11/Xlib.h>

View File

@@ -16,7 +16,7 @@ else
GTK_PRINT_PREVIEW_COMMAND="evince --unlink-tempfile --preview --print-settings %s %f"
endif
SUBDIRS = a11y . tests
SUBDIRS = a11y native . tests
if HAVE_PAPI_CUPS
GTK_PRINT_BACKENDS=file,papi,cups
@@ -107,12 +107,12 @@ endif
libgtkincludedir = $(includedir)/gtk-3.0/gtk
libadd = \
$(top_builddir)/gdk/libgdk-3.la \
$(top_builddir)/gtk/a11y/libgail.la \
$(top_builddir)/gtk/a11y/libgtka11y.la \
$(GMODULE_LIBS) \
$(GTK_DEP_LIBS)
deps = \
$(top_builddir)/gdk/libgdk-3.la \
$(top_builddir)/gtk/a11y/libgail.la
$(top_builddir)/gtk/a11y/libgtka11y.la
# libtool stuff: set version and export symbols for resolving
# since automake doesn't support conditionalized libsomething_la_LDFLAGS
@@ -176,6 +176,7 @@ deprecated_private_h_sources = \
gtk_public_h_sources = \
gtk.h \
gtkx.h \
gtk-a11y.h \
gtkaboutdialog.h \
gtkaccelgroup.h \
gtkaccellabel.h \
@@ -1653,12 +1654,20 @@ stamp-icons: $(STOCK_ICONS)
if USE_EXTERNAL_ICON_CACHE
gtk_update_icon_cache_program = $(GTK_UPDATE_ICON_CACHE)
else
if CROSS_COMPILING
gtk_update_icon_cache_program = ./native/native-update-icon-cache
else
gtk_update_icon_cache_program = ./gtk-update-icon-cache
endif
endif
gtkbuiltincache.h: @REBUILD@ stamp-icons
if !USE_EXTERNAL_ICON_CACHE
$(AM_V_at) $(MAKE) $(AM_MAKEFLAGS) gtk-update-icon-cache$(EXEEXT) $(GTK_UPDATE_ICON_CACHE_MANIFEST)
if CROSS_COMPILING
$(AM_V_at) $(MAKE) $(AM_MAKEFLAGS) -C native/
else
$(AM_V_at) $(MAKE) $(AM_MAKEFLAGS) gtk-update-icon-cache$(EXEEXT)
endif
endif
$(AM_V_GEN) $(gtk_update_icon_cache_program) --quiet --force --ignore-theme-index \
--source builtin_icons stock-icons > gtkbuiltincache.h.tmp && \

View File

@@ -1,9 +1,11 @@
include $(top_srcdir)/Makefile.decl
noinst_LTLIBRARIES = libgail.la
noinst_LTLIBRARIES = libgtka11y.la
gail_c_sources = \
gail.c \
gtka11y_c_sources = \
gtkaccessibility.c \
gtkaccessibilitymisc.c \
gtkaccessibilityutil.c \
gtkarrowaccessible.c \
gtkbooleancellaccessible.c \
gtkbuttonaccessible.c \
@@ -36,7 +38,6 @@ gail_c_sources = \
gtkrenderercellaccessible.c \
gtkscaleaccessible.c \
gtkscalebuttonaccessible.c \
gtkscrollbaraccessible.c \
gtkscrolledwindowaccessible.c \
gtkspinbuttonaccessible.c \
gtkspinneraccessible.c \
@@ -48,19 +49,16 @@ gail_c_sources = \
gtktoplevelaccessible.c \
gtktreeviewaccessible.c \
gtkwidgetaccessible.c \
gtkwindowaccessible.c \
gailutil.c \
gailmisc.c
gtkwindowaccessible.c
gail_private_h_sources = \
gail.h \
gtka11yincludedir = $(includedir)/gtk-3.0/gtk/a11y
gtka11yinclude_HEADERS = \
gtkarrowaccessible.h \
gtkbooleancellaccessible.h \
gtkbuttonaccessible.h \
gtkcellaccessible.h \
gtkcellaccessibleparent.h \
gtkcheckmenuitemaccessible.h \
gtkcolorswatchaccessible.h \
gtkcomboboxaccessible.h \
gtkcontaineraccessible.h \
gtkcontainercellaccessible.h \
@@ -74,8 +72,8 @@ gail_private_h_sources = \
gtklinkbuttonaccessible.h \
gtklockbuttonaccessible.h \
gtkmenuaccessible.h \
gtkmenushellaccessible.h \
gtkmenuitemaccessible.h \
gtkmenushellaccessible.h \
gtknotebookaccessible.h \
gtknotebookpageaccessible.h \
gtkpanedaccessible.h \
@@ -86,7 +84,6 @@ gail_private_h_sources = \
gtkrenderercellaccessible.h \
gtkscaleaccessible.h \
gtkscalebuttonaccessible.h \
gtkscrollbaraccessible.h \
gtkscrolledwindowaccessible.h \
gtkspinbuttonaccessible.h \
gtkspinneraccessible.h \
@@ -98,15 +95,25 @@ gail_private_h_sources = \
gtktoplevelaccessible.h \
gtktreeviewaccessible.h \
gtkwidgetaccessible.h \
gtkwindowaccessible.h \
gailutil.h \
gailmisc.h
gtkwindowaccessible.h
libgail_la_SOURCES = \
$(gail_c_sources) \
$(gail_private_h_sources)
gtka11y_private_h_sources = \
gtkaccessibility.h \
gtkaccessibilitymisc.h \
gtkaccessibilityutil.h \
gtkcellaccessibleprivate.h \
gtkcolorswatchaccessibleprivate.h \
gtkiconviewaccessibleprivate.h \
gtklockbuttonaccessibleprivate.h \
gtktextviewaccessibleprivate.h \
gtktreeviewaccessibleprivate.h \
gtkwidgetaccessibleprivate.h
libgail_la_CPPFLAGS = \
libgtka11y_la_SOURCES = \
$(gtka11y_c_sources) \
$(gtka11y_private_h_sources)
libgtka11y_la_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/gdk \
-I$(top_builddir)/gdk \
@@ -116,16 +123,16 @@ libgail_la_CPPFLAGS = \
-DGTK_COMPILATION \
$(AM_CPPFLAGS)
libgail_la_CFLAGS = \
libgtka11y_la_CFLAGS = \
$(GTK_DEP_CFLAGS) \
$(GTK_DEBUG_FLAGS) \
$(AM_CFLAGS)
libgail_la_LIBADD = \
libgtka11y_la_LIBADD = \
$(GTK_DEP_LIBS) \
$(INTLLIBS)
libgail_la_LDFLAGS = \
libgtka11y_la_LDFLAGS = \
$(LDFLAGS)
dist-hook: ../../build/win32/vs9/libgail.vcproj ../../build/win32/vs10/libgail.vcxproj ../../build/win32/vs10/libgail.vcxproj.filters

View File

@@ -1,49 +0,0 @@
/* GAIL - The GNOME Accessibility Implementation Library
* Copyright 2001 Sun Microsystems Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GAIL_MISC_H__
#define __GAIL_MISC_H__
#include <atk/atk.h>
G_BEGIN_DECLS
#define GAIL_TYPE_MISC (_gail_misc_get_type ())
#define GAIL_MISC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_MISC, GailMisc))
#define GAIL_MISC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_MISC, GailMiscClass))
#define GAIL_IS_MISC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_MISC))
#define GAIL_IS_MISC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_MISC))
#define GAIL_MISC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_MISC, GailMiscClass))
typedef struct _GailMisc GailMisc;
typedef struct _GailMiscClass GailMiscClass;
struct _GailMisc
{
AtkMisc parent;
};
struct _GailMiscClass
{
AtkMiscClass parent_class;
};
GType _gail_misc_get_type (void);
G_END_DECLS
#endif /* __GAIL_MISC_H__ */

View File

@@ -1,373 +0,0 @@
/* GAIL - The GNOME Accessibility Implementation Library
* Copyright 2011, F123 Consulting & Mais Diferenças
* Copyright 2001, 2002, 2003 Sun Microsystems Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <stdlib.h>
#include <gtk/gtk.h>
#include "gailutil.h"
#include "gtktoplevelaccessible.h"
#include "gtkwindowaccessible.h"
static GSList *key_listener_list = NULL;
typedef struct _GailKeyEventInfo GailKeyEventInfo;
struct _GailKeyEventInfo
{
AtkKeyEventStruct *key_event;
gpointer func_data;
};
static gboolean
state_event_watcher (GSignalInvocationHint *hint,
guint n_param_values,
const GValue *param_values,
gpointer data)
{
GObject *object;
GtkWidget *widget;
AtkObject *atk_obj;
AtkObject *parent;
GdkEventWindowState *event;
gchar *signal_name;
object = g_value_get_object (param_values + 0);
if (!GTK_IS_WINDOW (object))
return FALSE;
event = g_value_get_boxed (param_values + 1);
if (event->type == GDK_WINDOW_STATE)
return FALSE;
widget = GTK_WIDGET (object);
if (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED)
signal_name = "maximize";
else if (event->new_window_state & GDK_WINDOW_STATE_ICONIFIED)
signal_name = "minimize";
else if (event->new_window_state == 0)
signal_name = "restore";
else
return TRUE;
atk_obj = gtk_widget_get_accessible (widget);
if (GTK_IS_WINDOW_ACCESSIBLE (atk_obj))
{
parent = atk_object_get_parent (atk_obj);
if (parent == atk_get_root ())
g_signal_emit_by_name (atk_obj, signal_name);
return TRUE;
}
return FALSE;
}
static gboolean
configure_event_watcher (GSignalInvocationHint *hint,
guint n_param_values,
const GValue *param_values,
gpointer data)
{
GtkAllocation allocation;
GObject *object;
GtkWidget *widget;
AtkObject *atk_obj;
AtkObject *parent;
GdkEvent *event;
gchar *signal_name;
object = g_value_get_object (param_values + 0);
if (!GTK_IS_WINDOW (object))
return FALSE;
event = g_value_get_boxed (param_values + 1);
if (event->type != GDK_CONFIGURE)
return FALSE;
widget = GTK_WIDGET (object);
gtk_widget_get_allocation (widget, &allocation);
if (allocation.x == ((GdkEventConfigure *)event)->x &&
allocation.y == ((GdkEventConfigure *)event)->y &&
allocation.width == ((GdkEventConfigure *)event)->width &&
allocation.height == ((GdkEventConfigure *)event)->height)
return TRUE;
if (allocation.width != ((GdkEventConfigure *)event)->width ||
allocation.height != ((GdkEventConfigure *)event)->height)
signal_name = "resize";
else
signal_name = "move";
atk_obj = gtk_widget_get_accessible (widget);
if (GTK_IS_WINDOW_ACCESSIBLE (atk_obj))
{
parent = atk_object_get_parent (atk_obj);
if (parent == atk_get_root ())
g_signal_emit_by_name (atk_obj, signal_name);
return TRUE;
}
return FALSE;
}
static gboolean
window_focus (GtkWidget *widget,
GdkEventFocus *event)
{
AtkObject *atk_obj;
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
atk_obj = gtk_widget_get_accessible (widget);
g_signal_emit_by_name (atk_obj, event->in ? "activate" : "deactivate");
return FALSE;
}
static void
window_added (AtkObject *atk_obj,
guint index,
AtkObject *child)
{
GtkWidget *widget;
if (!GTK_IS_WINDOW_ACCESSIBLE (child))
return;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (child));
if (!widget)
return;
g_signal_connect (widget, "focus-in-event", (GCallback) window_focus, NULL);
g_signal_connect (widget, "focus-out-event", (GCallback) window_focus, NULL);
g_signal_emit_by_name (child, "create");
}
static void
window_removed (AtkObject *atk_obj,
guint index,
AtkObject *child)
{
GtkWidget *widget;
GtkWindow *window;
if (!GTK_IS_WINDOW_ACCESSIBLE (child))
return;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (child));
if (!widget)
return;
window = GTK_WINDOW (widget);
/*
* Deactivate window if it is still focused and we are removing it. This
* can happen when a dialog displayed by gok is removed.
*/
if (gtk_window_is_active (window) &&
gtk_window_has_toplevel_focus (window))
g_signal_emit_by_name (child, "deactivate");
g_signal_handlers_disconnect_by_func (widget, (gpointer) window_focus, NULL);
g_signal_emit_by_name (child, "destroy");
}
static void
do_window_event_initialization (void)
{
AtkObject *root;
g_type_class_ref (GTK_TYPE_WINDOW_ACCESSIBLE);
g_signal_add_emission_hook (g_signal_lookup ("window-state-event", GTK_TYPE_WIDGET),
0, state_event_watcher, NULL, (GDestroyNotify) NULL);
g_signal_add_emission_hook (g_signal_lookup ("configure-event", GTK_TYPE_WIDGET),
0, configure_event_watcher, NULL, (GDestroyNotify) NULL);
root = atk_get_root ();
g_signal_connect (root, "children-changed::add",
(GCallback) window_added, NULL);
g_signal_connect (root, "children-changed::remove",
(GCallback) window_removed, NULL);
}
static void
undo_window_event_initialization (void)
{
AtkObject *root;
root = atk_get_root ();
g_signal_handlers_disconnect_by_func (root, (GCallback) window_added, NULL);
g_signal_handlers_disconnect_by_func (root, (GCallback) window_removed, NULL);
}
static AtkKeyEventStruct *
atk_key_event_from_gdk_event_key (GdkEventKey *key)
{
AtkKeyEventStruct *event = g_new0 (AtkKeyEventStruct, 1);
switch (key->type)
{
case GDK_KEY_PRESS:
event->type = ATK_KEY_EVENT_PRESS;
break;
case GDK_KEY_RELEASE:
event->type = ATK_KEY_EVENT_RELEASE;
break;
default:
g_assert_not_reached ();
return NULL;
}
event->state = key->state;
event->keyval = key->keyval;
event->length = key->length;
if (key->string && key->string [0] &&
(key->state & GDK_CONTROL_MASK ||
g_unichar_isgraph (g_utf8_get_char (key->string))))
{
event->string = key->string;
}
else if (key->type == GDK_KEY_PRESS ||
key->type == GDK_KEY_RELEASE)
{
event->string = gdk_keyval_name (key->keyval);
}
event->keycode = key->hardware_keycode;
event->timestamp = key->time;
#ifdef GAIL_DEBUG
g_print ("GailKey:\tsym %u\n\tmods %x\n\tcode %u\n\ttime %lx\n",
(unsigned int) event->keyval,
(unsigned int) event->state,
(unsigned int) event->keycode,
(unsigned long int) event->timestamp);
#endif
return event;
}
typedef struct {
AtkKeySnoopFunc func;
gpointer data;
guint key;
} KeyEventListener;
gboolean
_gail_util_key_snooper (GtkWidget *the_widget,
GdkEventKey *event)
{
GSList *l;
AtkKeyEventStruct *atk_event;
gboolean result;
atk_event = atk_key_event_from_gdk_event_key (event);
result = FALSE;
for (l = key_listener_list; l; l = l->next)
{
KeyEventListener *listener = l->data;
result |= listener->func (atk_event, listener->data);
}
g_free (atk_event);
return result;
}
static guint
gail_util_add_key_event_listener (AtkKeySnoopFunc listener_func,
gpointer listener_data)
{
static guint key = 0;
KeyEventListener *listener;
key++;
listener = g_slice_new0 (KeyEventListener);
listener->func = listener_func;
listener->data = listener_data;
listener->key = key;
key_listener_list = g_slist_append (key_listener_list, listener);
return key;
}
static void
gail_util_remove_key_event_listener (guint listener_key)
{
GSList *l;
for (l = key_listener_list; l; l = l->next)
{
KeyEventListener *listener = l->data;
if (listener->key == listener_key)
{
g_slice_free (KeyEventListener, listener);
key_listener_list = g_slist_delete_link (key_listener_list, l);
break;
}
}
}
static AtkObject *
gail_util_get_root (void)
{
static AtkObject *root = NULL;
if (!root)
{
root = g_object_new (GTK_TYPE_TOPLEVEL_ACCESSIBLE, NULL);
atk_object_initialize (root, NULL);
}
return root;
}
static const gchar *
gail_util_get_toolkit_name (void)
{
return "gtk";
}
static const gchar *
gail_util_get_toolkit_version (void)
{
return GTK_VERSION;
}
void
_gail_util_uninstall (void)
{
undo_window_event_initialization ();
}
void
_gail_util_install (void)
{
AtkUtilClass *atk_class = ATK_UTIL_CLASS (g_type_class_ref (ATK_TYPE_UTIL));
atk_class->add_key_event_listener = gail_util_add_key_event_listener;
atk_class->remove_key_event_listener = gail_util_remove_key_event_listener;
atk_class->get_root = gail_util_get_root;
atk_class->get_toolkit_name = gail_util_get_toolkit_name;
atk_class->get_toolkit_version = gail_util_get_toolkit_version;
do_window_event_initialization ();
}

View File

@@ -1,4 +1,4 @@
/* GAIL - The GNOME Accessibility Implementation Library
/* GTK+ - accessibility implementations
* Copyright 2001 Sun Microsystems Inc.
*
* This library is free software; you can redistribute it and/or
@@ -17,7 +17,11 @@
#include "config.h"
#include "gail.h"
#include "gtkaccessibility.h"
#include "gtkaccessibilityutil.h"
#include "gtkaccessibilitymisc.h"
#include "gtkwindowaccessible.h"
#include <stdio.h>
#include <stdlib.h>
@@ -32,8 +36,6 @@
#include <gtk/gtktogglebutton.h>
#include <gtk/gtkcombobox.h>
#include <gtk/gtkaccessible.h>
#include "gailutil.h"
#include "gailmisc.h"
#ifdef GDK_WINDOWING_X11
#include <atk-bridge.h>
@@ -81,7 +83,7 @@ static GQuark quark_focus_object = 0;
static int initialized = FALSE;
static AtkObject*
gail_get_accessible_for_widget (GtkWidget *widget,
get_accessible_for_widget (GtkWidget *widget,
gboolean *transient)
{
AtkObject *obj = NULL;
@@ -516,7 +518,7 @@ gail_focus_notify (GtkWidget *widget)
else
{
if (_focus_widget)
atk_obj = gail_get_accessible_for_widget (_focus_widget, &transient);
atk_obj = get_accessible_for_widget (_focus_widget, &transient);
else
atk_obj = NULL;
/*
@@ -797,6 +799,186 @@ gail_set_focus_object (AtkObject *focus_obj,
}
}
static gboolean
state_event_watcher (GSignalInvocationHint *hint,
guint n_param_values,
const GValue *param_values,
gpointer data)
{
GObject *object;
GtkWidget *widget;
AtkObject *atk_obj;
AtkObject *parent;
GdkEventWindowState *event;
gchar *signal_name;
object = g_value_get_object (param_values + 0);
if (!GTK_IS_WINDOW (object))
return FALSE;
event = g_value_get_boxed (param_values + 1);
if (event->type == GDK_WINDOW_STATE)
return FALSE;
widget = GTK_WIDGET (object);
if (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED)
signal_name = "maximize";
else if (event->new_window_state & GDK_WINDOW_STATE_ICONIFIED)
signal_name = "minimize";
else if (event->new_window_state == 0)
signal_name = "restore";
else
return TRUE;
atk_obj = gtk_widget_get_accessible (widget);
if (GTK_IS_WINDOW_ACCESSIBLE (atk_obj))
{
parent = atk_object_get_parent (atk_obj);
if (parent == atk_get_root ())
g_signal_emit_by_name (atk_obj, signal_name);
return TRUE;
}
return FALSE;
}
static gboolean
configure_event_watcher (GSignalInvocationHint *hint,
guint n_param_values,
const GValue *param_values,
gpointer data)
{
GtkAllocation allocation;
GObject *object;
GtkWidget *widget;
AtkObject *atk_obj;
AtkObject *parent;
GdkEvent *event;
gchar *signal_name;
object = g_value_get_object (param_values + 0);
if (!GTK_IS_WINDOW (object))
return FALSE;
event = g_value_get_boxed (param_values + 1);
if (event->type != GDK_CONFIGURE)
return FALSE;
widget = GTK_WIDGET (object);
gtk_widget_get_allocation (widget, &allocation);
if (allocation.x == ((GdkEventConfigure *)event)->x &&
allocation.y == ((GdkEventConfigure *)event)->y &&
allocation.width == ((GdkEventConfigure *)event)->width &&
allocation.height == ((GdkEventConfigure *)event)->height)
return TRUE;
if (allocation.width != ((GdkEventConfigure *)event)->width ||
allocation.height != ((GdkEventConfigure *)event)->height)
signal_name = "resize";
else
signal_name = "move";
atk_obj = gtk_widget_get_accessible (widget);
if (GTK_IS_WINDOW_ACCESSIBLE (atk_obj))
{
parent = atk_object_get_parent (atk_obj);
if (parent == atk_get_root ())
g_signal_emit_by_name (atk_obj, signal_name);
return TRUE;
}
return FALSE;
}
static gboolean
window_focus (GtkWidget *widget,
GdkEventFocus *event)
{
AtkObject *atk_obj;
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
atk_obj = gtk_widget_get_accessible (widget);
g_signal_emit_by_name (atk_obj, event->in ? "activate" : "deactivate");
return FALSE;
}
static void
window_added (AtkObject *atk_obj,
guint index,
AtkObject *child)
{
GtkWidget *widget;
if (!GTK_IS_WINDOW_ACCESSIBLE (child))
return;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (child));
if (!widget)
return;
g_signal_connect (widget, "focus-in-event", (GCallback) window_focus, NULL);
g_signal_connect (widget, "focus-out-event", (GCallback) window_focus, NULL);
g_signal_emit_by_name (child, "create");
}
static void
window_removed (AtkObject *atk_obj,
guint index,
AtkObject *child)
{
GtkWidget *widget;
GtkWindow *window;
if (!GTK_IS_WINDOW_ACCESSIBLE (child))
return;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (child));
if (!widget)
return;
window = GTK_WINDOW (widget);
/*
* Deactivate window if it is still focused and we are removing it. This
* can happen when a dialog displayed by gok is removed.
*/
if (gtk_window_is_active (window) && gtk_window_has_toplevel_focus (window))
g_signal_emit_by_name (child, "deactivate");
g_signal_handlers_disconnect_by_func (widget, (gpointer) window_focus, NULL);
g_signal_emit_by_name (child, "destroy");
}
static void
do_window_event_initialization (void)
{
AtkObject *root;
g_type_class_ref (GTK_TYPE_WINDOW_ACCESSIBLE);
g_signal_add_emission_hook (g_signal_lookup ("window-state-event", GTK_TYPE_WIDGET),
0, state_event_watcher, NULL, (GDestroyNotify) NULL);
g_signal_add_emission_hook (g_signal_lookup ("configure-event", GTK_TYPE_WIDGET),
0, configure_event_watcher, NULL, (GDestroyNotify) NULL);
root = atk_get_root ();
g_signal_connect (root, "children-changed::add", (GCallback) window_added, NULL);
g_signal_connect (root, "children-changed::remove", (GCallback) window_removed, NULL);
}
static void
undo_window_event_initialization (void)
{
AtkObject *root;
root = atk_get_root ();
g_signal_handlers_disconnect_by_func (root, (GCallback) window_added, NULL);
g_signal_handlers_disconnect_by_func (root, (GCallback) window_removed, NULL);
}
void
_gtk_accessibility_shutdown (void)
{
@@ -810,13 +992,13 @@ _gtk_accessibility_shutdown (void)
#ifdef GDK_WINDOWING_X11
atk_bridge_adaptor_cleanup ();
#endif
_gail_util_uninstall ();
undo_window_event_initialization ();
}
void
_gtk_accessibility_init (void)
{
if (initialized)
return;
@@ -826,10 +1008,12 @@ _gtk_accessibility_init (void)
atk_focus_tracker_init (gail_focus_tracker_init);
focus_tracker_id = atk_add_focus_tracker (gail_focus_tracker);
_gail_util_install ();
_gtk_accessibility_override_atk_util ();
do_window_event_initialization ();
#ifdef GDK_WINDOWING_X11
atk_bridge_adaptor_init (NULL, NULL);
#endif
atk_misc_instance = g_object_new (GAIL_TYPE_MISC, NULL);
atk_misc_instance = g_object_new (GTK_TYPE_MISC_IMPL, NULL);
}

View File

@@ -1,4 +1,4 @@
/* GAIL - The GNOME Accessibility Implementation Library
/* GTK+ - accessibility implementations
* Copyright 2001 Sun Microsystems Inc.
*
* This library is free software; you can redistribute it and/or
@@ -15,16 +15,20 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_GAIL_H__
#define __GTK_GAIL_H__
#ifndef __GTK_ACCESSIBILITY_H__
#define __GTK_ACCESSIBILITY_H__
#include <glib.h>
#include "gtk/gtkwidget.h"
G_BEGIN_DECLS
void _gtk_accessibility_shutdown (void);
void _gtk_accessibility_init (void);
gboolean _gtk_accessibility_key_snooper (GtkWidget *widget,
GdkEventKey *event);
G_END_DECLS
#endif /* __GTK_GAIL_H__ */
#endif /* __GTK_ACCESSIBILITY_H__ */

View File

@@ -1,4 +1,4 @@
/* GAIL - The GNOME Accessibility Implementation Library
/* GTK+ - accessibility implementations
* Copyright 2001, 2002, 2003 Sun Microsystems Inc.
*
* This library is free software; you can redistribute it and/or
@@ -18,33 +18,33 @@
#include "config.h"
#include <gtk/gtk.h>
#include "gailmisc.h"
#include "gtkaccessibilitymisc.h"
G_DEFINE_TYPE (GailMisc, _gail_misc, ATK_TYPE_MISC)
G_DEFINE_TYPE (GtkMiscImpl, _gtk_misc_impl, ATK_TYPE_MISC)
static void
gail_misc_threads_enter (AtkMisc *misc)
gtk_misc_impl_threads_enter (AtkMisc *misc)
{
gdk_threads_enter ();
}
static void
gail_misc_threads_leave (AtkMisc *misc)
gtk_misc_impl_threads_leave (AtkMisc *misc)
{
gdk_threads_leave ();
}
static void
_gail_misc_class_init (GailMiscClass *klass)
_gtk_misc_impl_class_init (GtkMiscImplClass *klass)
{
AtkMiscClass *misc_class = ATK_MISC_CLASS (klass);
misc_class->threads_enter = gail_misc_threads_enter;
misc_class->threads_leave = gail_misc_threads_leave;
misc_class->threads_enter = gtk_misc_impl_threads_enter;
misc_class->threads_leave = gtk_misc_impl_threads_leave;
}
static void
_gail_misc_init (GailMisc *misc)
_gtk_misc_impl_init (GtkMiscImpl *misc)
{
}

View File

@@ -0,0 +1,44 @@
/* GTK+ - accessibility implementations
* Copyright 2001 Sun Microsystems Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_ACCESSIBILITY_MISC_H__
#define __GTK_ACCESSIBILITY_MISC_H__
#include <atk/atk.h>
G_BEGIN_DECLS
#define GTK_TYPE_MISC_IMPL (_gtk_misc_impl_get_type ())
typedef struct _GtkMiscImpl GtkMiscImpl;
typedef struct _GtkMiscImplClass GtkMiscImplClass;
struct _GtkMiscImpl
{
AtkMisc parent;
};
struct _GtkMiscImplClass
{
AtkMiscClass parent_class;
};
GType _gtk_misc_impl_get_type (void);
G_END_DECLS
#endif /* __GTK_ACCESSIBILITY_MISC_H__ */

View File

@@ -0,0 +1,156 @@
/* GTK+ - accessibility implementations
* Copyright 2011, F123 Consulting & Mais Diferenças
* Copyright 2001, 2002, 2003 Sun Microsystems Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <stdlib.h>
#include <gtk/gtk.h>
#include "gtkaccessibility.h"
#include "gtkaccessibilityutil.h"
#include "gtktoplevelaccessible.h"
static GSList *key_listener_list = NULL;
typedef struct {
AtkKeySnoopFunc func;
gpointer data;
guint key;
} KeyEventListener;
static guint
add_key_event_listener (AtkKeySnoopFunc listener_func,
gpointer listener_data)
{
static guint key = 0;
KeyEventListener *listener;
key++;
listener = g_slice_new0 (KeyEventListener);
listener->func = listener_func;
listener->data = listener_data;
listener->key = key;
key_listener_list = g_slist_append (key_listener_list, listener);
return key;
}
static void
remove_key_event_listener (guint listener_key)
{
GSList *l;
for (l = key_listener_list; l; l = l->next)
{
KeyEventListener *listener = l->data;
if (listener->key == listener_key)
{
g_slice_free (KeyEventListener, listener);
key_listener_list = g_slist_delete_link (key_listener_list, l);
break;
}
}
}
static AtkObject *
get_root (void)
{
static AtkObject *root = NULL;
if (!root)
{
root = g_object_new (GTK_TYPE_TOPLEVEL_ACCESSIBLE, NULL);
atk_object_initialize (root, NULL);
}
return root;
}
static const gchar *
get_toolkit_name (void)
{
return "gtk";
}
static const gchar *
get_toolkit_version (void)
{
return GTK_VERSION;
}
void
_gtk_accessibility_override_atk_util (void)
{
AtkUtilClass *atk_class = ATK_UTIL_CLASS (g_type_class_ref (ATK_TYPE_UTIL));
atk_class->add_key_event_listener = add_key_event_listener;
atk_class->remove_key_event_listener = remove_key_event_listener;
atk_class->get_root = get_root;
atk_class->get_toolkit_name = get_toolkit_name;
atk_class->get_toolkit_version = get_toolkit_version;
}
static void
atk_key_event_from_gdk_event_key (GdkEventKey *key,
AtkKeyEventStruct *event)
{
if (key->type == GDK_KEY_PRESS)
event->type = ATK_KEY_EVENT_PRESS;
else if (key->type == GDK_KEY_RELEASE)
event->type = ATK_KEY_EVENT_RELEASE;
else
g_assert_not_reached ();
event->state = key->state;
event->keyval = key->keyval;
event->length = key->length;
if (key->string && key->string[0] &&
(key->state & GDK_CONTROL_MASK ||
g_unichar_isgraph (g_utf8_get_char (key->string))))
event->string = key->string;
else
event->string = gdk_keyval_name (key->keyval);
event->keycode = key->hardware_keycode;
event->timestamp = key->time;
}
gboolean
_gtk_accessibility_key_snooper (GtkWidget *widget,
GdkEventKey *event)
{
GSList *l;
AtkKeyEventStruct atk_event;
gboolean result;
result = FALSE;
atk_key_event_from_gdk_event_key (event, &atk_event);
for (l = key_listener_list; l; l = l->next)
{
KeyEventListener *listener = l->data;
result |= listener->func (&atk_event, listener->data);
}
return result;
}

Some files were not shown because too many files have changed in this diff Show More