Commit Graph

311 Commits

Author SHA1 Message Date
Florian Müllner
bc9547f29e theme: Add method to adjust styles for frame state
GTK+ expresses the window state as style classes and widget state for
client-side decorations. Add a helper method to translate our own frame
state to the corresponding changes to the style context hierarchy.

https://bugzilla.gnome.org/show_bug.cgi?id=741917
2014-12-29 08:46:36 -08:00
Florian Müllner
89a371ec98 frames: Use title style to set up title layout
Sounds obvious, doesn't it?

After this change when titlebar-uses-system-font is set, the "system
font" used will not be a generic one, but match what GTK+ uses in
client-side decorations.

https://bugzilla.gnome.org/show_bug.cgi?id=741917
2014-12-29 08:46:36 -08:00
Florian Müllner
2db71e73b4 theme: Build a StyleContext hierarchy that matches GTK+'s CSD
In order to pick up all theme information from GTK+, a single style
context is not enough; a style hierarchy that closely matches the widget
hierarchy by GTK+'s client-side decorations will allow this soon.

https://bugzilla.gnome.org/show_bug.cgi?id=741917
2014-12-29 08:46:36 -08:00
Florian Müllner
472f2a4b8e theme: Add MetaStyleInfo for wrapping frame style context
Our current use of style contexts is fairly limited - we don't
use them for much more than picking up some color information.
We will soon start to make more elaborate use of GTK style
information, but a single context will no longer be enough
to draw a frame then.
To prepare for this, add a simple ref-counted type to wrap
style information.

https://bugzilla.gnome.org/show_bug.cgi?id=741917
2014-12-29 08:46:36 -08:00
Florian Müllner
db04ac9eb7 theme: Add titlebar_spacing
Rather than defining the space to the left and right of buttons, add a
simple spacing property that defines the space between buttons, which is
what GTK+ does for client-side decorations (e.g. GtkButtons in a GtkBox).
Unfortunately the value is hardcoded in GTK+; if it is exposed in the
theme in the future, we should pick it up from there, but for now we
just use the same value as GTK+.

https://bugzilla.gnome.org/show_bug.cgi?id=741917
2014-12-29 08:46:36 -08:00
Florian Müllner
75105e254f theme: Rename button_rect() to get_button_rect()
Basically it's odd to have "button_rect" be a function with all the
foo_rect GdkRectangles around - renaming to get_button_rect() will
free the name for the generically named "rect" once buttons are the
only movable pieces in the frame.

https://bugzilla.gnome.org/show_bug.cgi?id=741917
2014-12-29 16:25:19 +01:00
Jasper St. Pierre
cd4206764e Remove a few more guards for frees 2014-12-28 19:51:22 -08:00
Florian Müllner
af00ca534a ui: Adapt to GtkStyleContext changes
Since GTK+ commit 3a337156d11a86c7, save()/restore() may only be
used for subelements; in this particular case, the change broke
the backdrop state in decorations. Luckily we don't actually need
the save()/restore() pair anyway, as we only touch the context's
state and always set it explicitly.
2014-10-25 18:16:49 +02:00
Jasper St. Pierre
8a6542c242 theme: Remove COLORIZE feature of images
From a quick code search and grep of gnome-themes-standard, none of
the themes that I inspected used this feature. Since it's the last
thing that uses a lot of old legacy GdkPixbuf code, I'd rather just
consider the feature unsupported at this point and clean up everything
I need to.

https://bugzilla.gnome.org/show_bug.cgi?id=662962
2014-10-14 17:45:14 -07:00
Jasper St. Pierre
7e12000d97 theme: Use cairo for drawing uncolorized IMAGEs
https://bugzilla.gnome.org/show_bug.cgi?id=662962
2014-10-14 17:45:14 -07:00
Jasper St. Pierre
23f086da8a theme: Use cairo for TINT operations with alpha
https://bugzilla.gnome.org/show_bug.cgi?id=662962
2014-10-14 17:45:14 -07:00
Jasper St. Pierre
4c2c1c4dd2 theme: Use cairo for drawing ICON
Thanks to Benjamin Otte for helping me clean this up.

https://bugzilla.gnome.org/show_bug.cgi?id=662962
2014-10-14 17:45:07 -07:00
Jasper St. Pierre
545f298921 theme: Remove our own gradient stuff
Part one of porting to cairo.

Thanks to Benjamin Otte for helping me clean this up.

https://bugzilla.gnome.org/show_bug.cgi?id=662962
2014-10-14 17:37:49 -07:00
Jasper St. Pierre
0faa900207 frames: Make sure to initialize button_state
Otherwise, we're comparing with uninitialized memory. Spotted by
valgrind.
2014-09-30 15:16:07 -06:00
Owen W. Taylor
95d9a95b2b Add meta_ui_window_is_dummy()
For reasons related to interaction between the GTK+ CSS code and the
frame sync protocol, the dummy GtkWindow that MetaUI creates to track
theme properties has to be mapped and have MetaWindow associated with it.
Add a private function so that the test framework can filter this out.

https://bugzilla.gnome.org/show_bug.cgi?id=736505
2014-09-12 11:00:55 -04:00
Jasper St. Pierre
f42258327b util: Move the text direction stuff out of MetaUI
GTK+ doesn't need to be initialized to get locale direction,
which means we can do this without bringing up MetaUI at all.
2014-08-17 22:59:43 -04:00
Jasper St. Pierre
67be4e2bf3 window: Don't use GTK+ to fetch the drag threshold
Just look it up in GSettings ourselves.
2014-08-15 18:35:20 -04:00
Giovanni Campagna
d0f2c6be6d ui: always set the frame background to None
This way the xserver never paints the frame background, even if
the client window is destroyed. This allows us to have clean
destroy window animation.

There is no problem with interactive resizing because applications
are using the XSync protocol, so we're not painting unless the
client has redrawn.

https://bugzilla.gnome.org/show_bug.cgi?id=734054
2014-07-31 17:54:38 +02:00
Jasper St. Pierre
941d202938 window: Move X11-specific icon code to MetaWindowX11 2014-07-14 12:15:23 -04:00
Jasper St. Pierre
799de4f0f4 frames: Don't make a round trip to the X server for every MotionNotify
Instead, simply use the coordinates that were passed to us from the
MotionNotify event.
2014-07-13 17:34:08 -04:00
Jasper St. Pierre
13b7fa4eba ui: Bring back the is_input_event helper
This makes the logic clearer and easier to reason about.
2014-07-08 12:59:35 -04:00
Jasper St. Pierre
909a46087f ui: Fix the check for the XInput opcode
When converting is_input_event to be the opposite, I forgot to make this
change.
2014-07-08 12:58:43 -04:00
Carlos Garnacho
d05b750b8d frames: Keep information about the ongoing grab operation, and retry if needed.
When a passive touch grab is rejected over the frame, management is punted to
the frame itself, and pointer events emulated, but the attempt to transfer the
grab from the GDK connection to the Clutter one fails with AlreadyGrabbed, and
will fail until the Clutter connection receives the XI_TouchEnd resulting from
XIRejectTouch, gotten after the XI_ButtonPress on the GDK connection.

In order to bypass this shortcoming, store the current grab operation on the
frame as long as the button is pressed, so it is retried once on the next
motion event happening during frame dragging, that will have a recent enough
timestamp to succeed. If no grabbing succeeded, the current grab operation
data will be reset on GDK_BUTTON_RELEASE.
2014-07-08 11:21:36 -04:00
Jasper St. Pierre
2edf822bc6 ui: Fill in more fields on our emulated motion / crossing events
This will be required by the gestures work.
2014-07-08 11:21:24 -04:00
Jasper St. Pierre
355621b0ab ui: Remove a superfluous set on emulated motion events
This is already set by the gdk_event_new above.
2014-07-08 11:20:35 -04:00
Jasper St. Pierre
a307e13a63 ui: Filter out touch events 2014-07-08 10:50:09 -04:00
Carlos Garnacho
0db172edbf ui: Remove XI_TouchBegin handling from window frame event handlers
This is now unnecessary as only pointer events are selected, so pointer
emulation will take care of sending only pointer events.
2014-07-07 19:17:06 -04:00
Carlos Garnacho
0919b37c34 ui: Remove unneeded code
There's no way now that GDK will hold a grab, so it is safe to remove
this now.
2014-07-07 19:17:05 -04:00
Jasper St. Pierre
e377e82cfd theme: Remove bogus comment
This isn't happening anytime soon.
2014-07-07 12:54:36 -04:00
Rico Tzschichholz
fa8174a200 gradient: Fix warning/typo
In addition to c068c2122d
2014-07-07 10:59:23 +02:00
Florian Müllner
ef95133b1c theme: Also support alpha values in blend/shade functions
This doesn't appear to be used currently, but fix it while at it ...
2014-07-03 20:09:49 +02:00
Florian Müllner
c068c2122d gradient: Support alpha values in colors
Designers got used to RGBA support in GTK+, so the colors we pick
up from there might well have an alpha channel; update our gradient
rendering to support this - eventually we should probably port that
code to cairo ...
2014-07-03 20:01:51 +02:00
Florian Müllner
d8c47b0abd gradient: Remove unused parameter 2014-07-03 20:01:51 +02:00
Jasper St. Pierre
ff8d5281f0 frames: Simplify the clip region calculation
Since GTK+ already clips to the extended region for us, there's no need
to combine the two. This does lose the fast-path, but I don't actually
expect this to fire, as when we're composited, we really won't ever get
partial exposes.
2014-06-21 13:50:44 -04:00
Jasper St. Pierre
4f9b994e73 frames: Don't bother painting the background
GDK (and also GTK+!) do this for us already.
2014-06-21 13:50:43 -04:00
Jasper St. Pierre
b8b0dc5c78 frames: Hackily adapt to GTK+ drawing changes
mutter is quite bad at using GTK+ correctly, relying on dumb things
like the single-buffering stuff. Hack up a temporary fix for the
newer GTK+ rendering changes.
2014-06-21 13:50:36 -04:00
Jasper St. Pierre
86dae6d4c7 theme: Replace char array element comparisons with strncmp
https://bugzilla.gnome.org/show_bug.cgi?id=662962
2014-06-14 14:12:53 -04:00
Jasper St. Pierre
d06600aeb0 theme: Remove dead code
While the comment claims that we may want to keep this around
for optimization purposes, the operations are raw bitmap operations
that would be cleaner done in cairo.

https://bugzilla.gnome.org/show_bug.cgi?id=662962
2014-06-14 14:12:52 -04:00
Jasper St. Pierre
895a3d1f39 theme: Properly indent code
s/tabs/spaces/

https://bugzilla.gnome.org/show_bug.cgi?id=662962
2014-06-14 14:11:32 -04:00
Jasper St. Pierre
381ef5c683 theme: Consolidate unused ops
https://bugzilla.gnome.org/show_bug.cgi?id=662962
2014-06-14 14:11:00 -04:00
Jasper St. Pierre
62097897be theme: Remove unused RECTANGLE code
https://bugzilla.gnome.org/show_bug.cgi?id=662962
2014-06-14 14:04:59 -04:00
Rico Tzschichholz
8766db2593 common: Do not leak MetaResizePopup to the public api 2014-06-04 15:53:29 +02:00
Florian Müllner
a7f083897f frames: Only skip updating prelight when both control and state match
prelit_control is used for both prelight and pressed states, so the early
return in update_prelit_control() misses the case where prelit_control
already matches the control we are updating, but its state is PRESSED
rather than PRELIGHT. Fix the condition to not have pressed controls
linger around erroneously.

https://bugzilla.gnome.org/show_bug.cgi?id=731058
2014-06-02 23:49:48 +02:00
Florian Müllner
e2105dc721 frames: Fix pressed state of window menu buttons
Since window menus have been moved to the compositor, the pressed
state of the corresponding window buttons is messed up, as it is
reset immediately when getting a LeaveNotify event due to the
compositor taking a grab. Fix this by ignoring that particular
event.

https://bugzilla.gnome.org/show_bug.cgi?id=731058
2014-06-02 23:49:48 +02:00
Florian Müllner
b64548ee1f Pass button_rect when opening window menu from button
When opening the window menu without an associated control - e.g.
by right-clicking the titlebar or by keyboard - using coordinates
for the menu position is appropriate. However when the menu is
associated with a window button, the expected behavior in the
shell can be implemented much easier with the full button geometry:
the menu will point to the center of the button's bottom edge
rather than align to the left/right side of the titlebar as it
does now, and the clickable area where a release event does not
dismiss the menu will match the actual clickable area in mutter.

So add an additional show_window_menu_for_rect() function and
use it when opening the menu from a button.

https://bugzilla.gnome.org/show_bug.cgi?id=731058
2014-06-02 23:49:48 +02:00
Jasper St. Pierre
afb41f715b core: Make META_CORE_GET_FRAME_RECT return the "frame rect"
We have two different coordinate spaces here. One is the rectangle
returned by meta_window_get_frame_rect, which is called the "frame
rect" or "the window geometry", which includes visible frame borders
but not invisible frame borders. The other is "frame->rect" which
corresponds to the frame's server geometry. That is, it includes
both visible and invisible frame borders.

These two were of course the same until we introduced invisible
frame borders, and an executive decision was made to make
meta_window_get_frame_rect return the rectangle bounding the
visible portions of the frame.

As time went on, the "frame rect" turned out to be more useful when
making decisions upon, since the user often doesn't think about the
invisible window geometry as part of the window.

We already calculate what amounts to the "frame rect" in the theme
code, so just change META_CORE_GET_FRAME_RECT to consume that
directly.
2014-05-27 15:44:33 -04:00
Jasper St. Pierre
19d26dde92 core: Convert GET_FRAME_WIDTH / GET_FRAME_HEIGHT to GET_FRAME_RECT
Since we're going to be calling meta_window_get_frame_rect in here
soon, I'd rather it be one method call, rather than two. We can't
put it at the toplevel, since that might cause infinite recursion
(e.g. meta_core_get calls meta_window_get_frame_rect calls
meta_ui_get_frame_borders calls meta_core_get, ...)
2014-05-27 15:44:33 -04:00
Florian Müllner
31db32e826 Actually implement opening the app menu
The last commit added support for the "appmenu" button in decorations,
but didn't actually implement it. Add a new MetaWindowMenuType parameter
to the show_window_menu () functions and use it to ask the compositor
to display the app menu when the new button is activated.

https://bugzilla.gnome.org/show_bug.cgi?id=730752
2014-05-27 19:40:06 +02:00
Florian Müllner
c2ea650b3c Add support for app-menu button in window decorations
We want to synchronize the button layouts of our server side
decorations and GTK+'s client side ones. However each currently
may contain buttons not supported by the other, which makes this
unnecessarily tricky.
So add support for a new "appmenu" button in the layout, to display
the fallback app menu in the decorations.

https://bugzilla.gnome.org/show_bug.cgi?id=730752
2014-05-27 19:40:05 +02:00
Florian Müllner
04449923bd Remove MetaMenuIconType
Unused since 2006, quick, before we hit the 10-year mark!
2014-05-23 20:45:55 +02:00