1
0
Fork 0
Commit graph

176 commits

Author SHA1 Message Date
Jasper St. Pierre
cac660a5bc frames: Remove shape_applied
It's also unused.
2015-01-01 11:42:20 -08:00
Jasper St. Pierre
dcce4e64bc frames: We don't need to pass in the frame rect to get_bounds either
The MetaFrameGeometry already has this information.
2015-01-01 11:42:13 -08:00
Jasper St. Pierre
4d3511649b frames: Don't pass the frame rect into get_mask
We can query it directly.
2015-01-01 11:19:35 -08:00
Jasper St. Pierre
d4ea2bbd9c frames: Don't pass the width/height as separate args to get_client_rect
We already have them in the fgeom.
2015-01-01 11:04:11 -08:00
Jasper St. Pierre
2ca4ed6b04 frames: Rename meta_frames_* to meta_ui_frame_* where appropriate 2014-12-31 22:52:50 -08:00
Jasper St. Pierre
a5ad89dd65 frames: Remove last_motion_frame
Nothing cares about it.
2014-12-31 22:46:48 -08:00
Jasper St. Pierre
8fdbae192a frame: Start converting over to direct usage of MetaUIFrame 2014-12-31 22:44:20 -08:00
Jasper St. Pierre
2413e672c8 frame: Put a MetaUIFrame* in our MetaFrame
This is a small start, but it lets us start to clean up this
UI split mess.
2014-12-31 22:43:00 -08:00
Jasper St. Pierre
c8432cc430 frames: Use an early return
To be more consistent with the rest of the code.
2014-12-31 22:43:00 -08:00
Jasper St. Pierre
015864da09 frames: Embed a pointer to MetaFrames inside MetaUIFrame
This removes the MetaFrames argument from our internal APIs.
2014-12-31 22:35:35 -08:00
Jasper St. Pierre
669c9da2a4 frames: Fix astonishing accidental pointer trickery
Whenever we added a frame to the GHashTable, we added the frame itself
as the value, and a pointer to its storage of the frame window XID,
as the key.

When we iterated over the hash table, we actually looked up the
MetaUIFrame in the key, which might seem extraordinarily wrong, but
eagle-eyed viewers might notice that the XID is the first field in
MetaUIFrame, so the key and value are actually the same pointer.

Changing the layout of MetaUIFrame at all causes this to go haywire,
so let's not do this and simply put the MetaUIFrame in the value,
as expected.
2014-12-31 22:35:35 -08:00
Jasper St. Pierre
4d1d8e831e frames: Revert the logic here when the frame type updates
When the frame type updates, we were doing something funky that
caused us to reset the title used for the text layout here. I can't
really think of any place that it would trigger, and in testing I
haven't hit this either, so let's just remove the fancy logic and
assert this.
2014-12-31 22:35:30 -08:00
Jasper St. Pierre
9e199e6350 frames: Pass MetaFrameType into ensure_layout
All the callers already have it, so don't make us fetch it again.
2014-12-31 22:35:29 -08:00
Jasper St. Pierre
4673d8f245 theme: Remove flags argument from get_frame_layout
It's unused.
2014-12-31 22:35:29 -08:00
Jasper St. Pierre
af7f51b992 x11: Change the iconcache / window icons to being cairo surfaces
This simplifies the drawing codepath and makes us able to delete
a bunch of GdkPixbuf manipulation.
2014-12-31 21:11:21 -08:00
Florian Müllner
ee461b5495 theme: Remove MetaFrameStyle/MetaFrameStyleSet
MetaFrameStyle now only holds a MetaFrameLayout, so we can cut out
the middle man and use the layout directly. And as we are already
using a single style/layout per frame set and handle frame state
and focus by setting appropriate style flags, MetaFrameStyleSet
is pointless too - just store one MetaFrameLayout per frame type
directly in the theme.

https://bugzilla.gnome.org/show_bug.cgi?id=741917
2014-12-29 08:55:08 -08:00
Florian Müllner
ef32899b4d frames: Rename layout to text_layout
... to differentiate PangoLayout from MetaFrameLayout.

https://bugzilla.gnome.org/show_bug.cgi?id=741917
2014-12-29 08:46:37 -08:00
Florian Müllner
662dd6a289 theme: Use a singleton theme
Different themes don't make sense when we are always using the current
GTK+ theme for everything, so adapt the MetaTheme API to use a singleton.

https://bugzilla.gnome.org/show_bug.cgi?id=741917
2014-12-29 08:46:37 -08:00
Florian Müllner
2cabc067d1 frames: Adapt frame mask/bounds
The frame shape is relevant in three places:
 - the window decoration we draw
 - the frame mask (used for the shape region)
 - the frame bounds (used for clipping)

All three should match, so make sure to use the same GTK+ method for
the first two, and bring the (non-antialiased) third closer to the
other two by removing an obscure modifier from the corner radius.

https://bugzilla.gnome.org/show_bug.cgi?id=741917
2014-12-29 08:46:36 -08:00
Florian Müllner
26c4c21e13 Properly update on GTK+ theme changes
With geometry information picked up from GTK+, we need to queue a
resize on GTK+ theme changes to correctly update to the new geometry.

https://bugzilla.gnome.org/show_bug.cgi?id=741917
2014-12-29 08:46:36 -08:00
Florian Müllner
6eda784cf0 theme: Use style information from GTK+
We now have everything in place to pick up geometry and drawing
information from GTK+ rather than the metacity theme, so do just
that; the metacity theme is now only used for some constants
(title_scale, hide_buttons, ...), which we will replace soon.

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
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
Jasper St. Pierre
cd4206764e Remove a few more guards for frees 2014-12-28 19:51:22 -08: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
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
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
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
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
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
Jasper St. Pierre
6513cbb470 Add back coordinates to the window menu
It looks weird to have Alt+Space pop up under the cursor instead
of the top-left corner of the window, and the Wayland request will
pass through the coordinates as well.

Add it to the compositor interface, and extend the
_GTK_SHOW_WINDOW_MENU ClientMessage to support it as well.
2014-05-22 10:50:57 -04:00
Rico Tzschichholz
91a6f42345 Drop leftover menu.h/metaaccellabel.h references
In addition to 8640982e68
2014-05-18 15:51:14 +02:00
Jasper St. Pierre
8640982e68 Convert window menus to a compositor implementation 2014-05-17 15:16:23 -04:00
Jasper St. Pierre
25a16c3379 Remove trailing whitespace 2014-05-02 09:34:48 -04:00
Jasper St. Pierre
ebb6847bd1 ui: Don't use grab ops for grab negotation
Grab operations are now always taken on the backend connection, and
this breaks GTK+'s event handling.

Instead of taking a grab op, just do the handling ourselves. The
GTK+ connection will get an implicit grab, which means pointer /
keyboard events won't be sent to the rest of mutter, which is good.
2014-04-24 13:36:40 -04:00
Jasper St. Pierre
20a0eb9809 Require the XSync and XShape extensions at build-time
It's been long enough. We can mandate support for these, at least
at build-time. The code doesn't actually compile without either
of these, so just consider that unsupported.
2014-04-22 14:17:09 -04:00
Owen W. Taylor
4a8f7aa884 Fix handling of dynamic updates to colors/font/etc.
Since the introduction of frame sync in GTK+, updates to titlebar font and
colors haven't been working because GTK+ counts on the frame clock to
do style updates, and the frame clock doesn't run for an unmapped
GdkWindow. (It's possible that GtkStyleContext changes subsequent to
the introduction of the frame clock were also needed to fully break
things.)

We actually need to map the MetaFrames GdkWindow and let the
compositor code send out the frame sync messages in order to pick up
style changes.

Hopefully no bad side effects will occur from this - we make the window
override-redirect, 1x1, and outside the bounds of the screen.

https://bugzilla.gnome.org/show_bug.cgi?id=725751
2014-03-05 17:21:27 -05:00
Andika Triwidada
fbec4718f8 Changed obsolete FSF postal address into generic URL.
Fix https://bugzilla.gnome.org/show_bug.cgi?id=721517 #2
2014-01-12 08:42:06 +07:00
Simon McVittie
c2a9ccb7e2 Let the UI layer (via the core) construct the frame mask
This essentially just moves install_corners() from the compositor, through
the core, into the UI layer where it arguably should have been anyway,
leaving behind stub functions which call through the various layers. This
removes the compositor's special knowledge of how rounded corners work,
replacing it with "ask the UI for an alpha mask".

The computation of border widths and heights changes a bit, because the
width and height used in install_corners() are the
meta_window_get_outer_rect() (which includes the visible borders but not
the invisible ones), whereas the more readily-available rectangle is the
MetaFrame.rect (which includes both). Computing the same width and height
as meta_window_get_outer_rect() involves compensating for the invisible
borders, but the UI layer is the authority on those anyway, so it seems
clearer to have it do the calculations from scratch.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=697758
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2013-04-17 13:35:06 +01:00
Simon McVittie
c7c1225393 MetaFrames: factor out MetaUIFrame accessors for borders, corner radiuses
This makes it a bit simpler for other functions on a MetaUIFrame to
get this information.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=697758
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-04-12 17:55:00 +01:00
William Jon McCann
27e0e44d8b Don't allow multiline window titles
https://bugzilla.gnome.org/show_bug.cgi?id=683056
2013-01-16 14:25:11 -05:00
Jasper St. Pierre
5c33b0d768 theme-viewer: use the same GtkStyleContext as mutter usually renders
https://bugzilla.gnome.org/show_bug.cgi?id=690317
2013-01-09 14:06:24 -05:00
Jasper St. Pierre
22a3126a2b theme: Make meta_frame_draw_theme take a GtkStyleContext instead of a widget
The style context of the widget is rarely what we want. We won't
fix this to be a MetaFrames style context yet; this just changes
the internal API.

https://bugzilla.gnome.org/show_bug.cgi?id=690317
2013-01-09 14:06:24 -05:00
Florian Müllner
93a16f6d43 frames: Bump priority of style providers
Since GTK+ commit b1ad5c8abc2c, GtkSetting's CSS provider uses a
priority of GTK_STYLE_PROVIDER_PRIORITY_SETTINGS, which means it
will overwrite the ones we create ourselves.
Bump the priority to fix dark window decorations.

https://bugzilla.gnome.org/show_bug.cgi?id=688182
2012-11-12 19:27:34 +01:00
Jasper St. Pierre
dc50ccf9b7 frames: Add a multiplier to increase the size of resize corners
Now the resize corners will extend into the actual border edges.

https://bugzilla.gnome.org/show_bug.cgi?id=677669
2012-06-08 23:09:32 -04:00
Jasper St. Pierre
6fb857cb23 frames: Remove frame border pixel caching and related optimizations
Since we now cache windows in the X server, we don't really need to cache
them here. Since we are redirecting windows in most cases, we're not gaining
anything except added memory usage. Additionally, remove the clip to screen
optimization - if a window is partially off-screen, we still need to draw
the entire thing as redirection means we won't get an expose event for it.

Additionally, when introducing invisible borders, something accidentally
slipped through: we were getting expose events on the invisible borders,
and they weren't in the cached pixels rect, so we were painting the theme
for them, even if we didn't actually paint anything with cairo. Make sure
to clip out the invisible borders instead of just the client rect so that
we don't draw if our expose event is on the invisible borders.

https://bugzilla.gnome.org/show_bug.cgi?id=675111
2012-05-21 12:51:32 -04:00
Jasper St. Pierre
fc87a635b2 frames: Remove expose_delayed
This was introduced for the effects API and wireframe mode, and was
forgotten when that went the way of the dinosaur.

https://bugzilla.gnome.org/show_bug.cgi?id=671104
2012-05-14 15:44:49 -03:00
Jasper St. Pierre
b0a099935b frames: Remove forgotten references to tooltips
Tooltips were removed a little while back, but two historical artifacts
were untouched. We're not in the museum business, now are we...
2012-04-30 16:36:18 -04:00
Jasper St. Pierre
b58366d3ad theme: Remove unused "widget" parameter to frame style drawing
It seems that the only usage of the "widget" parameter throughout
the entire call chain was to pass between two function calls as
mutual recursion.

https://bugzilla.gnome.org/show_bug.cgi?id=671104
2012-04-24 16:54:49 -04:00
Florian Müllner
8ca86fa8bf ui: Kill tooltips
After the changes in style handling in GTK+, mutter's tooltips no
longer match the tooltip style used in applications. Given that
all buttons in the default layout are well-known, killing tooltips
altogether rather than fixing the styling issues looks like a valid
approach.

https://bugzilla.gnome.org/show_bug.cgi?id=645101
2012-03-15 22:27:43 +01:00
Florian Müllner
7253a75b18 frames: Explicitly initialize style contexts
We were relying on GTK+ emitting GtkWidget::style-updated during
widget initialization to create the GtkStyleContexts used for
window decorations. A recent GTK+ update broke this assumption,
so do the necessary initialization ourselves.

https://bugzilla.gnome.org/show_bug.cgi?id=671796
2012-03-10 22:11:22 +01:00
Florian Müllner
d0910da036 Port preferences to GSettings
Move preferences to GSettings, using mainly shared schemas from
gsettings-desktop-schemas.

Unlike GConf, GSettings support is not optional, as Gio is already
a hard dependency of GTK+.

https://bugzilla.gnome.org/show_bug.cgi?id=635378
2011-11-11 20:26:38 +01:00
Jasper St. Pierre
70db187c36 frames: Don't use deprecated API to grab pointer position
https://bugzilla.gnome.org/show_bug.cgi?id=662574
2011-10-25 09:42:04 -04:00
Jasper St. Pierre
d624e85bc1 frames: Disable the titlebar "inner resize"
Since invisible draggable borders have been around, there isn't really a big
need for this feature

https://bugzilla.gnome.org/show_bug.cgi?id=660129
2011-10-21 09:16:39 -04:00
Jasper St. Pierre
00e49b330c frames: Take out accidental south resize disable of attached dialogs
https://bugzilla.gnome.org/show_bug.cgi?id=657795
2011-09-20 15:30:29 -04:00
Jasper St. Pierre
5f1c3de29a frames: Fall back to title bar if nothing else matched
The condition got removed in eeb2efe010 but that
had a side effect of adding a couple of rows of dead pixels so add it back.

https://bugzilla.gnome.org/show_bug.cgi?id=658069
2011-09-16 18:16:37 -04:00
Jasper St. Pierre
d6b528a955 Disable top resizing for attached modal dialogs, for real this time
https://bugzilla.gnome.org/show_bug.cgi?id=657795
2011-09-14 20:03:40 -04:00
Jasper St. Pierre
0b4cc14aa6 frames: Fix the visible region when we have a rounded bottom-right corner
https://bugzilla.gnome.org/show_bug.cgi?id=657661
2011-08-30 10:55:06 -04:00
Jasper St. Pierre
e4da6495d3 Disable top resizing for attached modal dialogs
https://bugzilla.gnome.org/show_bug.cgi?id=656619
2011-08-29 13:00:26 -04:00
Jasper St. Pierre
d33d113746 frame: Add "get_corner_radiuses" chain
https://bugzilla.gnome.org/show_bug.cgi?id=628195
2011-08-24 09:38:23 -04:00
Jasper St. Pierre
eeb2efe010 ui: Replace inline borders in MetaFrameGeometry with MetaFrameBorder
... and start compensating for invisible borders in all of the math.

https://bugzilla.gnome.org/show_bug.cgi?id=644930
2011-08-09 17:14:51 -04:00
Jasper St. Pierre
e0fb83c691 Replace public MetaFrameGeometry with MetaFrameBorders
There were actually *two* MetaFrameGeometry structs: one in theme-private.h,
one in frame.h. The latter public struct was populated by a mix of (void*)
casting and int pointers, usually pulling directly from the data in the private
struct.

Remove the public struct, replace it with MetaFrameBorders and scrap all
the pointer hacks to populate it, instead relying on both structs being used
in common code.

This commit should be relatively straightforward, and it should not do any
tricky logic at all, just a sophisticated find and replace.

https://bugzilla.gnome.org/show_bug.cgi?id=644930
2011-08-09 17:14:50 -04:00
Jasper St. Pierre
183bcd6fc7 Stop shaping the frame window
In preparation for switching to handling the output shape purely by what we
paint, stop applying a shape to the frame of the window. Even when we restore
handling the output shape, this will change the behavior with respect to input;
transparent areas between the frame and the contents will stop clicks rather
than passing them through, but that is arguably at least as expected
considering how that we decorate shaped windows with a frame all around.

https://bugzilla.gnome.org/show_bug.cgi?id=644930
2011-08-09 17:14:50 -04:00
Dan Winship
d2b63eaf1f fix a crash-on-exit
meta_frames_destroy() was not safe to be called multiple times, which
was causing a crash on exit due to something else changing somewhere
that makes it get called multiple times.

https://bugzilla.gnome.org/show_bug.cgi?id=654489
2011-07-12 13:53:19 -04:00
Florian Müllner
ce1369609f theme: Port from GdkColor to GdkRGBA
GdkColor is about to be deprecated, so move to GdkRGBA instead.

https://bugzilla.gnome.org/show_bug.cgi?id=650586
2011-07-08 01:29:54 +02:00
Jasper St. Pierre
d752096cdf Fix XShape
Commit c3a04bf unintentionally broke XShape handling. By studying the code
extremely carefully, I found this inconsistency with the code that was
there before.

https://bugzilla.gnome.org/show_bug.cgi?id=635268
2011-06-29 16:07:34 -04:00
Florian Müllner
526bc34bba frames: Always start grab operation on left click
When left-clicking the frame border with the titlebar being
off-screen, rather than starting the expected grab operation the
window menu was popped up.
This behavior is pretty confusing, especially since the menu button
was removed from the default layout, making right-clicking the only
way to get to the window menu.

https://bugzilla.gnome.org/show_bug.cgi?id=652369
2011-06-15 21:34:04 +02:00
Florian Müllner
7577437167 ui-frames: Delay attaching the style to new frames
Like the setting of new frames' background is delayed until the
frame is associated with its window, delay attaching the initial
style, so that the correct style variant is picked.

https://bugzilla.gnome.org/show_bug.cgi?id=645355
2011-05-18 23:07:23 +02:00
Florian Müllner
4affd22817 ui-frame: Add support for style variants
Rather than sharing a single style context between all frames, use
a default style and one style per encountered variant (as determined
by the _GTK_THEME_VARIANT property), so that colors from the GTK+ style
are picked from the correct theme variant.

https://bugzilla.gnome.org/show_bug.cgi?id=645355
2011-05-18 23:07:23 +02:00
Florian Müllner
eb17cd9ba9 ui: Add meta_ui_update_frame_style()
This method allows forcing a style update of a particular frame
from the core, so that it can pick up style variants.

https://bugzilla.gnome.org/show_bug.cgi?id=645355
2011-05-18 23:07:23 +02:00
Florian Müllner
da4486b833 theme: Get GTK+ colors from style context
Rather than using a single widget's style for GTK+ colors in themes,
use the style context parameter of the drawing functions for those
colors. Right now, a single style context is shared between frames,
but this will change to support different style variants.

https://bugzilla.gnome.org/show_bug.cgi?id=645355
2011-05-18 23:07:22 +02:00
Owen W. Taylor
67c3c93b8f Only shadow ARGB windows with a frame outside the frame
An ARGB window with a frame is likely something like a transparent
terminal. It looks awful (and breaks transparency) to draw a big
opaque black shadow under the window, so clip out the region under
the terminal from the shadow we draw.

Add meta_window_get_frame_bounds() to get a cairo region for the
outer bounds of the frame of a window, and modify the frame handling
code to notice changes to the frame shape and discard a cached
region. meta_frames_apply_shapes() is refactored so we can extract
meta_frames_get_frame_bounds() from it.

https://bugzilla.gnome.org/show_bug.cgi?id=635268
2011-04-26 15:10:02 -04:00
Owen W. Taylor
c3a04bf394 Convert frame region handling to cairo regions
It's useful to get frame shapes and manipulate them within Mutter, for
example so that the compositor can use them to clip drawing.
For this, we'll need the regions as cairo regions not X regions, so
convert frame shaping code to work in terms of cairo_region_t.

https://bugzilla.gnome.org/show_bug.cgi?id=635268
2011-04-26 15:10:02 -04:00
Dan Winship
c84da3ce1b Move the installed includes to a subdir
If mutter is going to be a "real" library, then it should install its
includes so that users can do

    #include <meta/display.h>

rather than

    #include <display.h>

So rename the includedir accordingly, move src/include to src/meta,
and fix up all internal references.

There were a handful of header files in src/include that were not
installed; this appears to have been part of a plan to keep core/,
ui/, and compositor/ from looking at each others' private includes,
but that wasn't really working anyway. So move all non-installed
headers back into core/ or ui/.

https://bugzilla.gnome.org/show_bug.cgi?id=643959
2011-03-07 18:19:53 -05:00
Florian Müllner
565f002bc4 ui: Port to GtkStyleContext
GtkStyle has been deprecated in favor of GtkStyleContext. A full
port would involve replacing GdkColor with GdkRGBA - leave this
out for the time being.

Bump the required version of GTK+.

https://bugzilla.gnome.org/show_bug.cgi?id=637761
2011-01-13 18:55:39 +01:00
Florian Müllner
9f2581318a buttons: Fix background functions for non-default layouts
While the configured layout is taken into account for positioning
the buttons, the mapping from button function states to button
position states just assumed the default button layout in LTR
locales.
Do a proper mapping depending on the actual layout instead.

https://bugzilla.gnome.org/show_bug.cgi?id=635686
2011-01-04 19:00:30 +01:00
Florian Müllner
b445ee3763 Remove compatibility for GTK+-2.0
While the Meego developers agreed to switching mutter to GTK+-3.0
unconditionally a while ago, Canonical used a GTK+-2.0 build for their
Unity project. As Canonical now announced a switch to compiz as their
window manager, there is no longer a reason to maintain GTK+-2.0
compatibility.

https://bugzilla.gnome.org/show_bug.cgi?id=633133
2010-10-28 12:16:14 +02:00
Owen W. Taylor
804117c456 Remove MetaRegion
In many places, MetaRegion was being used entirely internally, rather
than for gtk2/gtk3 compatibility. In these cases, it's simpler to just
depend on cairo-1.10 (for both gtk2 and gtk3) and use cairo_region_t.

The few places where we did need GDK compatibility (GdkEvent.region and
gdk_window_shape_combine_mask) are replaced with a combination of
converting GdkRegion to cairo_region_t and conditional code.

https://bugzilla.gnome.org/show_bug.cgi?id=632474
2010-10-23 15:48:29 -04:00
Matthias Clasen
33e2d15495 Adapt to GtkObject removal in GTK3
The destroy signal has been moved to GtkWidget, so change the class_init
functions of MetaFrames and MetaAccelLabel to match.

https://bugzilla.gnome.org/show_bug.cgi?id=630671
2010-09-27 13:58:36 -04:00
Benjamin Otte
b265e8099a theme: Get rid of x/y_offset usage when drawing frames
Commit aa65f94c67 that started passing
cairo_t around broke offsets. Since passing cairo_t makes them
unnecessary, this patches removes them rather than fixing them.

This patch changes API.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-27 17:07:23 +02:00
Benjamin Otte
a2b3f9aeb0 frames.c: Clip the client area correctly
The code switched the x and y variables. Oops.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-27 17:07:23 +02:00
Benjamin Otte
9f5d8d1a2a Fix compilation against latest GTK3 changes
With the newest changes to GTK3, some things were changed. This patch
now uses the features introduced in gtk3-compat.h in previous patches.

This patch also introduces a macro named USE_GTK3 that is used to
differentiate between GTK3 and GTK2. Its main use is differenting
between expose and draw handlers for GtkWidget subclasses.

The draw vs expose handlers question is usually handled by using ifdefs
at the beginning and end to set up/tear down a cairo_t and then use it.

However, when the function is too different and too many ifdefs would be
necessary, two versions of the function are written. This is currently
the case for:
- MetaAccelLabel
- MetaFrames

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-26 17:09:20 +02:00
Benjamin Otte
e75abacec6 frames.c: Make cached_pixels_draw() take a cairo_t
This basically just moves the creation of the cairo_t out of the
function. It is done in preparation for GTK3.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-26 17:09:20 +02:00
Benjamin Otte
1083a4c0b7 Introduce MetaPixmap compatibility wrapper
Similar to the region compatibility shim, we will soon need a
compatibility shim around GdkPixmap/cairo_surface_t. For now, the patch
just introduces the compatibility layer.

This patch also does not include the function
meta_gdk_pixbuf_get_from_pixmap() as that function will need special
treatment in GTK3 anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-26 17:09:20 +02:00
Benjamin Otte
d212be799a frames.c: Merge clear_backing() function into its only user
Avoids creating a cairo_t twice. And without the code to create a
cairo_t, there was not a lot left to warrant a separate function.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-26 17:09:20 +02:00
Benjamin Otte
84986c7695 frames.c: Change meta_frames_paint() to take a cairo_t
Rename meta_frames_paint_to_drawable() to meta_frames_paint() and make
it take a cairo_t as an argument instead of creating the cairo_t itself.

This patch refactors code for GTK3 changes where code needs to handle
cairo_t and not GdkDrawable arguments.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-26 17:09:20 +02:00
Benjamin Otte
aa65f94c67 theme: Upgrade to use Cairo for painting (changes API)
This commit is in preparation for the work happening in GTK3, which will
use Cairo for drawing exclusively. So it is necessary to move all
drawing code to Cairo. In this commit the "gtk2" code is used for both
gtk2 and gtk3; compatibility with newer versions of gtk3 where different
code is needed will be added subsequently.
For compatibility with older GTK versions, the file gdk2-drawing-utils.h
provides a compatibility layer.

The commit changes the API of libmutter-private.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-26 17:09:20 +02:00
Benjamin Otte
5c3b0cda2e ui: gtk_widget_show() the MetaFrames object
The widget needs to be visible and mapped for GTK3 to deliver expose
events to the widget. This is achieved by making the map function a
no-op and calling gtk_widget_show() instead of just calling
gtk_widget_realize().
Apart from making GTK think the widget is drawable, the effect is the
same.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-23 12:54:14 +02:00
Benjamin Otte
741d2b761a frames.c: Simplify cached area subtraction code
Because we store the affected rectangle in the piece, we can just
subtract it and don't need any complicated computations.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-23 12:54:14 +02:00
Benjamin Otte
a0ffe71db3 Change the cached rectangle ares to a GdkRectangle
Simplifies the code as the rectangle is mainly interacting with GDK
APIs.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-23 12:54:14 +02:00
Benjamin Otte
ecf812db83 frames.c: Do not create pixmaps when there's nothing to draw
https://bugzilla.gnome.org/show_bug.cgi?id=630203

Take advantage of existing handling for CachedFramePiece.piece == NULL
to avoid generating pixmaps when width/height are 0
2010-09-23 12:54:14 +02:00
Benjamin Otte
afd3b96e2e Simplify code: Use cairo_paint() to paint the whole pixmap
Also, gdk_drawable_get_size() is going away soon

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-23 12:54:14 +02:00