Merge lp:~muktupavels/compiz/gwd-metacity-fix-button-width-calculation into lp:compiz/0.9.12

Proposed by Alberts Muktupāvels
Status: Merged
Approved by: Stephen M. Webb
Approved revision: 3942
Merged at revision: 3957
Proposed branch: lp:~muktupavels/compiz/gwd-metacity-fix-button-width-calculation
Merge into: lp:compiz/0.9.12
Prerequisite: lp:~muktupavels/compiz/gwd-remove-unused-setting
Diff against target: 72 lines (+50/-2)
1 file modified
gtk/window-decorator/metacity.c (+50/-2)
To merge this branch: bzr merge lp:~muktupavels/compiz/gwd-metacity-fix-button-width-calculation
Reviewer Review Type Date Requested Status
Stephen M. Webb Approve
MC Return Needs Information
Review via email: mp+255253@code.launchpad.net

Commit message

Fix button_width calculation in metacity theme.

Description of the change

Fix button_width calculation in metacity theme.

This fixes following visual problem:
http://postimg.org/image/54bgd5q3x/

To post a comment you must log in.
Revision history for this message
Stephen M. Webb (bregma) wrote :

Is there a COmpiz ug associated with this?

Revision history for this message
Alberts Muktupāvels (muktupavels) wrote :

> Is there a COmpiz ug associated with this?

I don't know.

Revision history for this message
MC Return (mc-return) wrote :

Do I need a special theme to test this ?
With my theme Metacity's buttons are rendered correctly and I cannot reproduce the problem.

This looks unnecessary complicated:
if (!(frame_type < META_FRAME_TYPE_LAST))

could be:
if (frame_type >= META_FRAME_TYPE_LAST)

This is redundant as the value gets overwritten anyway in the next line:
mutter_draggable_border_width = 0;

or does
g_object_get (settings, "draggable-border-width", &mutter_draggable_border_width, NULL);
not overwrite the value of mutter_draggable_border_width in every case ?

review: Needs Information
Revision history for this message
Alberts Muktupāvels (muktupavels) wrote :

> Do I need a special theme to test this ?
> With my theme Metacity's buttons are rendered correctly and I cannot reproduce
> the problem.

https://github.com/horst3180/Vertex-theme
Problem was reported with his theme. In metacity buttons are rendered correctly but not in gwd. Buttons must be on right side.

> This looks unnecessary complicated:
> if (!(frame_type < META_FRAME_TYPE_LAST))
>
> could be:
> if (frame_type >= META_FRAME_TYPE_LAST)

I did not write much, it is copy & paste from existing code. I will change if needed.

> This is redundant as the value gets overwritten anyway in the next line:
> mutter_draggable_border_width = 0;

same as above...

> or does
> g_object_get (settings, "draggable-border-width",
> &mutter_draggable_border_width, NULL);
> not overwrite the value of mutter_draggable_border_width in every case ?

Revision history for this message
MC Return (mc-return) wrote :

I guess this depends on lp:~albertsmuktupavels/compiz/gwd-support-metacity-3-16 ?

As compiling with those changes only on Ubuntu 14.04 results in:
error: unknown type name ‘MetaFrameBorders’
error: too few arguments to function ‘meta_theme_get_frame_borders’
error: request for member ‘visible’ in something not a structure or union

Revision history for this message
Alberts Muktupāvels (muktupavels) wrote :

No, it does not depend on that branch.

Metacity version is 3.12, right? MetaFrameBorders are available in metacity 3.14. I will fix this later.

Did you reproduce problem?

3942. By Alberts Muktupāvels

Fix build with metacity 3.12.x

Revision history for this message
Alberts Muktupāvels (muktupavels) wrote :

I did not test, but i think it should build now.

Revision history for this message
Stephen M. Webb (bregma) wrote :

This doesn;t seem to *break* anything in the themes I've tested with, so I'm going to go ahead an approve it.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'gtk/window-decorator/metacity.c'
2--- gtk/window-decorator/metacity.c 2014-10-07 20:06:52 +0000
3+++ gtk/window-decorator/metacity.c 2015-04-29 16:07:58 +0000
4@@ -819,10 +819,58 @@
5 void
6 meta_calc_button_size (decor_t *d)
7 {
8+ MetaTheme *theme;
9+ MetaFrameType frame_type;
10+ MetaFrameFlags flags;
11+ MetaFrameGeometry fgeom;
12+ MetaButtonLayout button_layout;
13+ GdkRectangle clip;
14+#ifdef HAVE_METACITY_3_14_0
15+ MetaFrameBorders borders;
16+#else
17+ gint left_width, right_width, top_height, bottom_height;
18+#endif
19+ gint mutter_draggable_border_width;
20 gint i, min_x, x, y, w, h, width;
21
22+ if (!d->context)
23+ {
24+ d->button_width = 0;
25+ return;
26+ }
27+
28+ theme = meta_theme_get_current ();
29+
30+ frame_type = meta_frame_type_from_string (d->frame->type);
31+ if (!(frame_type < META_FRAME_TYPE_LAST))
32+ frame_type = META_FRAME_TYPE_NORMAL;
33+
34+ meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout,
35+ frame_type, &clip);
36+
37+#ifdef HAVE_METACITY_3_14_0
38+ meta_theme_get_frame_borders (theme, frame_type, d->frame->text_height,
39+ flags, &borders);
40+#else
41+ meta_theme_get_frame_borders (theme, frame_type, d->frame->text_height,
42+ flags, &top_height, &bottom_height,
43+ &left_width, &right_width);
44+#endif
45+
46+ mutter_draggable_border_width = 0;
47+ g_object_get (settings, "draggable-border-width", &mutter_draggable_border_width, NULL);
48+
49 width = d->border_layout.top.x2 - d->border_layout.top.x1 -
50- d->context->left_space - d->context->right_space;
51+ d->context->left_space - d->context->right_space +
52+#ifdef HAVE_METACITY_3_14_0
53+ borders.visible.left + borders.visible.right;
54+#else
55+ left_width + right_width;
56+#endif
57+
58+ if (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE)
59+ width += mutter_draggable_border_width;
60+
61 min_x = width;
62
63 for (i = 0; i < 3; ++i)
64@@ -844,7 +892,7 @@
65 }
66 }
67
68- d->button_width = width - min_x + 6;
69+ d->button_width = width - min_x;
70 }
71
72 gboolean

Subscribers

People subscribed via source and target branches