Merge lp:~muktupavels/compiz/gtk-window-decorator-5 into lp:compiz/0.9.12

Proposed by Alberts Muktupāvels
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 3876
Merged at revision: 3882
Proposed branch: lp:~muktupavels/compiz/gtk-window-decorator-5
Merge into: lp:compiz/0.9.12
Diff against target: 61 lines (+42/-2)
1 file modified
gtk/window-decorator/cairo.c (+42/-2)
To merge this branch: bzr merge lp:~muktupavels/compiz/gtk-window-decorator-5
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
Review via email: mp+224651@code.launchpad.net

Commit message

Calculate correct button position in cairo theme.

Description of the change

Calculate correct button position in cairo theme.

Calculator window has minimize and close buttons, but does not have maximize button. In this case button position is returned incorrectly. Minimize button is visually in correct place, but event window is in wrong place (In place where it would be if window would have maximize button too).

To post a comment you must log in.
3876. By Alberts Muktupāvels

Merge with lp:compiz

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Ok seems reasonable

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/cairo.c'
2--- gtk/window-decorator/cairo.c 2013-05-13 15:39:25 +0000
3+++ gtk/window-decorator/cairo.c 2014-07-09 10:49:50 +0000
4@@ -817,6 +817,38 @@
5 return FALSE;
6 }
7
8+static gboolean
9+button_present (decor_t *d,
10+ gint i)
11+{
12+ switch (i) {
13+ case BUTTON_MIN:
14+ if (d->actions & WNCK_WINDOW_ACTION_MINIMIZE)
15+ return TRUE;
16+ break;
17+ case BUTTON_MAX:
18+ if (d->actions & WNCK_WINDOW_ACTION_MAXIMIZE)
19+ return TRUE;
20+ break;
21+ case BUTTON_CLOSE:
22+ if (d->actions & WNCK_WINDOW_ACTION_CLOSE)
23+ return TRUE;
24+ break;
25+ case BUTTON_MENU:
26+ case BUTTON_SHADE:
27+ case BUTTON_ABOVE:
28+ case BUTTON_STICK:
29+ case BUTTON_UNSHADE:
30+ case BUTTON_UNABOVE:
31+ case BUTTON_UNSTICK:
32+ break;
33+ default:
34+ break;
35+ }
36+
37+ return FALSE;
38+}
39+
40 gboolean
41 get_button_position (decor_t *d,
42 gint i,
43@@ -848,8 +880,16 @@
44 (d->frame->titlebar_height - 17);
45
46 /* hack to position multiple buttons on the right */
47- if (i != BUTTON_MENU)
48- *x -= 10 + 16 * i;
49+ if (i != BUTTON_MENU) {
50+ gint position = 0;
51+ gint button = 0;
52+ while (button != i) {
53+ if (button_present (d, button))
54+ position++;
55+ button++;
56+ }
57+ *x -= 10 + 16 * position;
58+ }
59
60 return TRUE;
61 }

Subscribers

People subscribed via source and target branches