Merge lp:~muktupavels/compiz/gtk-window-decorator-3 into lp:compiz/0.9.12
- gtk-window-decorator-3
- Merge into 0.9.12
Status: | Merged |
---|---|
Approved by: | Marco Trevisan (Treviño) |
Approved revision: | 3917 |
Merged at revision: | 3885 |
Proposed branch: | lp:~muktupavels/compiz/gtk-window-decorator-3 |
Merge into: | lp:compiz/0.9.12 |
Prerequisite: | lp:~muktupavels/compiz/gtk-window-decorator-1 |
Diff against target: |
1244 lines (+216/-267) 20 files modified
debian/control (+1/-2) gtk/CMakeLists.txt (+2/-10) gtk/window-decorator/actionmenu.c (+5/-0) gtk/window-decorator/blurprops.c (+2/-2) gtk/window-decorator/cairo.c (+11/-9) gtk/window-decorator/decorator.c (+51/-47) gtk/window-decorator/decorprops.c (+4/-4) gtk/window-decorator/events.c (+4/-2) gtk/window-decorator/forcequit.c (+13/-18) gtk/window-decorator/frames.c (+7/-7) gtk/window-decorator/gdk.c (+38/-50) gtk/window-decorator/gtk-window-decorator.c (+2/-5) gtk/window-decorator/gtk-window-decorator.h (+10/-38) gtk/window-decorator/gwd-settings-notified.h (+2/-1) gtk/window-decorator/metacity.c (+1/-5) gtk/window-decorator/style.c (+1/-1) gtk/window-decorator/switcher.c (+26/-26) gtk/window-decorator/tests/CMakeLists.txt (+2/-0) gtk/window-decorator/tooltip.c (+7/-9) gtk/window-decorator/wnck.c (+27/-31) |
To merge this branch: | bzr merge lp:~muktupavels/compiz/gtk-window-decorator-3 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Marco Trevisan (Treviño) | Approve | ||
Review via email: mp+223897@code.launchpad.net |
Commit message
Port gtk-window-
Description of the change
Port gtk-window-
This branch does not port metacity part. Metacity will be disabled.
Alberts Muktupāvels (muktupavels) wrote : | # |
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
As for the crash, I think it's better to trap errors, before crashing, so if a BadWindow error is thrown (sometimes it happens also because of the async nature of X, where you might have already destroyed that window), it's better to warn than to crash.
Alberts Muktupāvels (muktupavels) wrote : | # |
Ok. I will add error trap.
But do you have any idea why it is crashing with GTK+ 3, but not with GTK+ 2? I guess there could be several reasons:
1) I have done something wrong.
2) Something has changed in libwnck.
3) Something has changed in gtk+.
> As for the crash, I think it's better to trap errors, before crashing, so if a
> BadWindow error is thrown (sometimes it happens also because of the async
> nature of X, where you might have already destroyed that window), it's better
> to warn than to crash.
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
> Ok. I will add error trap.
>
> But do you have any idea why it is crashing with GTK+ 3, but not with GTK+ 2?
> I guess there could be several reasons:
> 1) I have done something wrong.
I've not checked the code yet...
> 2) Something has changed in libwnck.
This might be the most likely option
Alberts Muktupāvels (muktupavels) wrote : | # |
Marco can you please review code?
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Sorry for the delay, and thanks for the heads up... I've finally got some time to review this.
First of all, I'm getting some compilation issues when compiling the tests here (but also in previous branches), so you'd also need to apply this:
http://
Then, on a test-run the decorations work well, but I've a problem with the libwnck menu that never pop-ups here (neither clicking on the menu icon or right-clicking on the decoration). And this is weird since I don't see anything wrong in the code.
Another thing: in switcher.c there's something like
decor_post_
But the d->win is always null for the switcher, then we get a critical error, and I think that nothing get still deleted on compiz side (as the window sent to the decor plugin is an invalid value), so... Wondering if makes sense to change this call to avoid errors.
I'm also curious about the state of lp:~mitya57/metacity/3.12.0/+merge/226573 since we'd need to get that in as well.
Finally see the diff-comments I wrote.
Marco Trevisan (Treviño) (3v1n0) : | # |
Alberts Muktupāvels (muktupavels) wrote : | # |
> Sorry for the delay, and thanks for the heads up... I've finally got some time
> to review this.
Thanks for review!
> First of all, I'm getting some compilation issues when compiling the tests
> here (but also in previous branches), so you'd also need to apply this:
>
> http://
How to compile tests?
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Ok, thanks for the fixes.
> > First of all, I'm getting some compilation issues when compiling the tests
> > here (but also in previous branches), so you'd also need to apply this:
> >
> > http://
>
> How to compile tests?
You can use the cmake variables
-DBUILD_
As for change you did in http://
Do you have any plan for that? Since we'd need to get that.
What about the context menu issue?
Alberts Muktupāvels (muktupavels) wrote : | # |
> You can use the cmake variables
>
> -DBUILD_
Thanks!
> As for change you did in
> http://
> decorator-
> the lp:~mitya57/metacity/3.12.0/+merge/226573 branch and the relative changes
> are in, right?
Yes and no. It simply won't be possible to build with metacity.
1) GWD now will be GTK+ 3, but all other metacity version are GTK+ 2. Even if it will compile there will be error - GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported.
2) With metacity 3.12 above problem disappears, bet have another - this branch does not include metacity part related changes.
So we have only one option - temporarily disable metacity.
> Do you have any plan for that? Since we'd need to get that.
My only plan is to fix this branch so it can be merged. Then I will work on next brach to restore metacity part. That branch will require metacity 3.12.
I will ask Dmitry about https:/
> What about the context menu issue?
Have not looked at this issue.
I will try to fix this and all other remaining issues till end of this month. I might not have enough free time to do it faster. :(
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
> > As for change you did in
> > http://
> > decorator-
> until
> > the lp:~mitya57/metacity/3.12.0/+merge/226573 branch and the relative
> changes
> > are in, right?
>
> Yes and no. It simply won't be possible to build with metacity.
Ok, that's fine for now...
> 2) With metacity 3.12 above problem disappears, bet have another - this branch
> does not include metacity part related changes.
> So we have only one option - temporarily disable metacity.
>
> > Do you have any plan for that? Since we'd need to get that.
>
> My only plan is to fix this branch so it can be merged. Then I will work on
> next brach to restore metacity part. That branch will require metacity 3.12.
Ok, but we need the metacity support back as soon as possible (I'd say end of August, to be safe), since gnome flashback session uses it, and we can't regress in a release (and this would meant that we'd need to revert all these changes, which sucks).
> I will ask Dmitry about
> https:/
> it will be merged sooner or later.
Good, btw I think that, not to create more troubles later, it would be nice to merge that branch when also a metacity-3 branch for compiz is ready (do you know how long might that take?).
> I will try to fix this and all other remaining issues till end of this month.
> I might not have enough free time to do it faster. :(
Ok, that's fine.
Alberts Muktupāvels (muktupavels) wrote : | # |
> Ok, but we need the metacity support back as soon as possible (I'd say end of
> August, to be safe), since gnome flashback session uses it, and we can't
> regress in a release (and this would meant that we'd need to revert all these
> changes, which sucks).
Reverting won't solve anything. When metacity will be uploaded compiz will fail to build with metacity. There is only two solutions:
1) Port GWD to GTK+ 3.
2) Drop metacity support.
> > I will ask Dmitry about
> > https:/
> think
> > it will be merged sooner or later.
>
> Good, btw I think that, not to create more troubles later, it would be nice to
> merge that branch when also a metacity-3 branch for compiz is ready (do you
> know how long might that take?).
I don't think it will take much time. I already had almost working version, but it was crashing (maybe crashing was not related to metacity part at all). So first I need to fix this branch.
About tests. Can you write short info on how to build and run tests? I am doing this:
1) bzr branch lp:~albertsmuktupavels/compiz/gtk-window-decorator-3
2) cd gtk-window-
3) mkdir build && cd build
4) cmake -DCMAKE_
5) make
But it seems that tests is not building.
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
> > Ok, but we need the metacity support back as soon as possible (I'd say end
> of
> > August, to be safe), since gnome flashback session uses it, and we can't
> > regress in a release (and this would meant that we'd need to revert all
> these
> > changes, which sucks).
>
> Reverting won't solve anything. When metacity will be uploaded compiz will
> fail to build with metacity. There is only two solutions:
> 1) Port GWD to GTK+ 3.
> 2) Drop metacity support.
Yeah, but it's very likely that in case that there's the risk of this regression also metacity won't be accepted or reverted. And I'd prefer to avoid that.
> > > I will ask Dmitry about
> > > https:/
> > think
> > > it will be merged sooner or later.
> >
> > Good, btw I think that, not to create more troubles later, it would be nice
> to
> > merge that branch when also a metacity-3 branch for compiz is ready (do you
> > know how long might that take?).
>
> I don't think it will take much time. I already had almost working version,
> but it was crashing (maybe crashing was not related to metacity part at all).
> So first I need to fix this branch.
Cool, if you've that somewhere I could give a look as well.
> About tests. Can you write short info on how to build and run tests? I am
> doing this:
> 1) bzr branch lp:~albertsmuktupavels/compiz/gtk-window-decorator-3
> 2) cd gtk-window-
> 3) mkdir build && cd build
> 4) cmake -DCMAKE_
> -DCOMPIZ_
The cmake flags should include:
Weird, that should work, try to add also -DCOMPIZ_
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Ah, make sure you've libxorg-gtest-dev installed
Alberts Muktupāvels (muktupavels) wrote : | # |
> Ah, make sure you've libxorg-gtest-dev installed
I had it installed already. I should read more carefully what is printed in terminal. I needed to install google-mock to enable tests. Should not it be installed when running apt-get build-dep compiz?
Fixed tests compilation as you suggested.
Alberts Muktupāvels (muktupavels) wrote : | # |
> Another thing: in switcher.c there's something like
>
> decor_post_
> d->x11Pixmap);
>
> But the d->win is always null for the switcher, then we get a critical error,
> and I think that nothing get still deleted on compiz side (as the window sent
> to the decor plugin is an invalid value), so... Wondering if makes sense to
> change this call to avoid errors.
x11Pixmap is only used decor_post_
Alberts Muktupāvels (muktupavels) wrote : | # |
> What about the context menu issue?
Launching gwd with --gdk-debug=all and then trying to open context menu application is crashing with X Window System error:
The error was 'BadMatch (invalid parameter attributes)'.
Maybe you have some ideas what could cause it? gdb output - http://
Most likely this is not problem with libwnck as I tried to create test menu with one item. It did not show up too. :(
Sam Spilsbury (smspillaz) wrote : | # |
On Sat, Jul 26, 2014 at 11:08 PM, Alberts Muktupāvels <
<email address hidden>> wrote:
> > Another thing: in switcher.c there's something like
> >
> > decor_post_
> > d->x11Pixmap);
> >
> > But the d->win is always null for the switcher, then we get a critical
> error,
> > and I think that nothing get still deleted on compiz side (as the window
> sent
> > to the decor plugin is an invalid value), so... Wondering if makes sense
> to
> > change this call to avoid errors.
>
> x11Pixmap is only used decor_post_
> We get this pixmap from surface. Is not pixmap deleted/destroyed when
> cairo_surface_
>
It is deleted, but you need to tell compiz about the fact that it has been
deleted so that it can remove it from its own internal cache. This is
basically a synchronisation message to avoid a race condition in compiz
since compiz can't actually know (without doing round-trips all the time)
whether or not the pixmap has actually been destroyed and is safe or unsafe
to bind.
> --
>
> https:/
> Your team Compiz Maintainers is subscribed to branch lp:compiz.
>
--
Sam Spilsbury
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
> > What about the context menu issue?
>
> Launching gwd with --gdk-debug=all and then trying to open context menu
> application is crashing with X Window System error:
> The error was 'BadMatch (invalid parameter attributes)'.
>
> Maybe you have some ideas what could cause it? gdb output -
> http://
Mh, not much from that... I'd probably need to enter in a full debug session.
> Most likely this is not problem with libwnck as I tried to create test menu
> with one item. It did not show up too. :(
Mh, weird... We're currently using this in unity as well right now (thought bamf, not to add libwnck dependency in unity itself) and works well. The code involved [1] is much like this one so, I don't see what could cause that. Maybe it might be also related to the WnckWindow, but again I'd need to debug this better.
Alberts Muktupāvels (muktupavels) wrote : | # |
> > > What about the context menu issue?
> >
> > Launching gwd with --gdk-debug=all and then trying to open context menu
> > application is crashing with X Window System error:
> > The error was 'BadMatch (invalid parameter attributes)'.
> >
> > Maybe you have some ideas what could cause it? gdb output -
> > http://
>
> Mh, not much from that... I'd probably need to enter in a full debug session.
>
> > Most likely this is not problem with libwnck as I tried to create test menu
> > with one item. It did not show up too. :(
>
> Mh, weird... We're currently using this in unity as well right now (thought
> bamf, not to add libwnck dependency in unity itself) and works well. The code
> involved [1] is much like this one so, I don't see what could cause that.
> Maybe it might be also related to the WnckWindow, but again I'd need to debug
> this better.
>
> [1] lp:~3v1n0/bamf/window-action-menu/+merge/206318
Do you have time to debug this?
Today I found that context menu will show if opened with alt + space (without --gdk-debug=all, otherwise it will crash with same error). Seems that it does not work only when trying to open menu with mouse.
Maybe this is related to one of these bugs:
1) https:/
2) https:/
With --gdk-debug=all I see only shadow and then gwd will crash.
Metacity is already merged and in -proposed. Can you merge gtk-window-
Alberts Muktupāvels (muktupavels) wrote : | # |
> On Sat, Jul 26, 2014 at 11:08 PM, Alberts Muktupāvels <
> <email address hidden>> wrote:
>
> > > Another thing: in switcher.c there's something like
> > >
> > > decor_post_
> > > d->x11Pixmap);
> > >
> > > But the d->win is always null for the switcher, then we get a critical
> > error,
> > > and I think that nothing get still deleted on compiz side (as the window
> > sent
> > > to the decor plugin is an invalid value), so... Wondering if makes sense
> > to
> > > change this call to avoid errors.
> >
> > x11Pixmap is only used decor_post_
> > We get this pixmap from surface. Is not pixmap deleted/destroyed when
> > cairo_surface_
> >
>
> It is deleted, but you need to tell compiz about the fact that it has been
> deleted so that it can remove it from its own internal cache. This is
> basically a synchronisation message to avoid a race condition in compiz
> since compiz can't actually know (without doing round-trips all the time)
> whether or not the pixmap has actually been destroyed and is safe or unsafe
> to bind.
Hmm... Ok, it is needed. But now my question is - does it has ever worked as it should? For example update_
1) if d->surface then we destory it
2) if d->x11Pixmap we call decor_post_
3) and then we do this d->x11Pixmap = cairo_xlib_
So how this should be fixed?
1) Get x11Pixmap from d->surface before destroying it and use it in decor_post_
2) Or d->x11Pixmap should be created from surface not d->surface?
Alberts Muktupāvels (muktupavels) wrote : | # |
Marco could you please reply to my previous comments?
And why lp:compiz is missing some fixes that are applied in lp:compiz/0.9.11?
Alberts Muktupāvels (muktupavels) wrote : | # |
In revision 3907 I added error trap to fix crash.
Destroying event_windows[
event_windows and button_windows are created with parent window so most likely these windows are destroyed when parent is destroyed. At least documentation says that XDestroyWindow destroys specified window and all subwindows. But I could not find where and when parent window is destoryed.
Alberts Muktupāvels (muktupavels) wrote : | # |
> What about the context menu issue?
If I change GButtonPress to GButtonRelease in menu_button_event in events.c then context menu works by clicking on menu icon.
Do you have any idea why it work with GButtonRelease but does not work with GButtonPress?
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
> Marco could you please reply to my previous comments?
Hi, sorry for the late reply, but I've been in holidays for a while...
> And why lp:compiz is missing some fixes that are applied in lp:compiz/0.9.11?
Mh, what fixes do you mean, specifically?
> > What about the context menu issue?
>
> If I change GButtonPress to GButtonRelease in menu_button_event in events.c
> then context menu works by clicking on menu icon.
>
> Do you have any idea why it work with GButtonRelease but does not work with
> GButtonPress?
Nice debug... This seems a grabbing issue, and in fact just doing something like:
http://
Is enough to get things fixed.
This doesn't fix the crash when using --gdk-debug=all, though but it's related to some code inside gdk that is disabled when not debugging (see gdk_x11_
I would love to avoid this, but from a quick look I've not been able to see why was that happening, and it doesn't seem harmful.
> Destroying event_windows[
> time generate BadWindow error. It is 19 errors every time when
> remove_frame_window is called.
>
> event_windows and button_windows are created with parent window so most likely
> these windows are destroyed when parent is destroyed. At least documentation
> says that XDestroyWindow destroys specified window and all subwindows. But I
> could not find where and when parent window is destoryed.
Since the parent window is created by compiz (in the decor plugin), and exported to the window through the _COMPIZ_
I don't think that trapping the errors is a problem here, we just make sure that they get deleted.
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
> Hmm... Ok, it is needed. But now my question is - does it has ever worked as
> it should? For example update_
> 1) if d->surface then we destory it
> 2) if d->x11Pixmap we call decor_post_
> 3) and then we do this d->x11Pixmap = cairo_xlib_
> (d->surface); but d->surface is destroyed already. That means d->x11Pixmap is
> always 0.
No, on point (3), d->surface is now set to a new surface created above using create_
As for muting this error, btw I'd use something like http://
Alberts Muktupāvels (muktupavels) wrote : | # |
I fixed context menu issue with your suggestion. But in switcher.c I replaced wnck_window_get_xid (d->win) with 0 as it seems that d->win is always NULL.
Is there someting else that still needs to be fixed for this branch or can we move to metacity part?
About missing fixes - my fault, everything is ok.
Alberts Muktupāvels (muktupavels) wrote : | # |
Seems that there is still at least one problem. :( After loging in session sometimes decorator will crash. Do you know how to debug this? It is crashing with BadWindow error...
Metacity - https:/
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
A possibility would be to make sure that compiz launches the gdk-widow-decorator using these args:
GDK_SYNCHRONIZE=1 ./gtk-window-
You might change the path of the decorator to launch in decor plugin settings in ccsm, to a script containing that call (if you don't want to include that env var everywhere), and then from tty1 using "sudo gdb $(pidof gtk-window-
It would also possible to launch that decorator from gdbserver using a script with something like:
GDK_SYNCHRONIZE=1 gdbserver :2345 ./file/
Then from tty1 you can launch it using:
gdb -q -ex "target remote localhost:2345" -ex "continue" ./file/
Although you need to be fast as not sure if things might not fail otherwise.
Another possibility (the safest) would be to make sure that gtk-window-
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
This seems good to go from my POV now (no crashes here), but since you get some crashes, it would be better to squash them. Have you found anything?
Alberts Muktupāvels (muktupavels) wrote : | # |
> This seems good to go from my POV now (no crashes here), but since you get
> some crashes, it would be better to squash them. Have you found anything?
Unfortunately, no.
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
No crashes or no way to debug them?
Alberts Muktupāvels (muktupavels) wrote : | # |
> No crashes or no way to debug them?
I could not find why it is crashing.
Alberts Muktupāvels (muktupavels) wrote : | # |
Added one more error trap. I have no idea why that part is generation BadWindow error. Looks like this fixes crashes with BadWindow for me. :) Please re-approve if everything looks good.
- 3917. By Alberts Muktupāvels
-
Revert 'Don't leak pixmaps' commit.
Marco Trevisan (Treviño) (3v1n0) : | # |
Preview Diff
1 | === modified file 'debian/control' |
2 | --- debian/control 2014-06-20 06:06:21 +0000 |
3 | +++ debian/control 2014-09-10 12:50:41 +0000 |
4 | @@ -20,7 +20,6 @@ |
5 | libboost-serialization-dev, |
6 | libglib2.0-dev, |
7 | libglibmm-2.4-dev, |
8 | - libgtk2.0-dev, |
9 | libgtk-3-dev, |
10 | libice-dev (>= 1:1.0.1), |
11 | libmetacity-dev (>= 1:2.34.0), |
12 | @@ -28,7 +27,7 @@ |
13 | libpng12-dev | libpng-dev, |
14 | librsvg2-dev, |
15 | libsm-dev (>= 1:1.0.1), |
16 | - libwnck-dev (>= 1:2.30.7), |
17 | + libwnck-3-dev, |
18 | libx11-dev, |
19 | libxcomposite-dev (>= 1:0.3-2), |
20 | libxext-dev, |
21 | |
22 | === modified file 'gtk/CMakeLists.txt' |
23 | --- gtk/CMakeLists.txt 2014-06-14 16:04:23 +0000 |
24 | +++ gtk/CMakeLists.txt 2014-09-10 12:50:41 +0000 |
25 | @@ -9,8 +9,8 @@ |
26 | if (USE_GTK) |
27 | pkg_check_modules (GTK_WINDOW_DECORATOR |
28 | xrender>=0.8.4 |
29 | - gtk+-2.0>=2.18.0 |
30 | - libwnck-1.0 |
31 | + gtk+-3.0 |
32 | + libwnck-3.0 |
33 | pangocairo |
34 | ) |
35 | if (GTK_WINDOW_DECORATOR_FOUND) |
36 | @@ -25,15 +25,7 @@ |
37 | set (CMAKE_REQUIRED_LIBRARIES "") |
38 | |
39 | if (USE_METACITY) |
40 | - pkg_check_modules (METACITY libmetacity-private) |
41 | - if (METACITY_FOUND) |
42 | - pkg_check_modules (METACITY_3_12_0 libmetacity-private>=3.12.0) |
43 | - if (METACITY_3_12_0_FOUND) |
44 | - compiz_set (USE_METACITY 0) |
45 | - endif (METACITY_3_12_0_FOUND) |
46 | - else (METACITY_FOUND) |
47 | compiz_set (USE_METACITY 0) |
48 | - endif (METACITY_FOUND) |
49 | endif (USE_METACITY) |
50 | |
51 | if (USE_GNOME) |
52 | |
53 | === modified file 'gtk/window-decorator/actionmenu.c' |
54 | --- gtk/window-decorator/actionmenu.c 2014-06-12 21:26:33 +0000 |
55 | +++ gtk/window-decorator/actionmenu.c 2014-09-10 12:50:41 +0000 |
56 | @@ -78,8 +78,10 @@ |
57 | { |
58 | GdkDisplay *gdkdisplay; |
59 | GdkScreen *screen; |
60 | + Display *display; |
61 | |
62 | gdkdisplay = gdk_display_get_default (); |
63 | + display = gdk_x11_display_get_xdisplay (gdkdisplay); |
64 | screen = gdk_display_get_default_screen (gdkdisplay); |
65 | |
66 | if (action_menu) |
67 | @@ -120,6 +122,9 @@ |
68 | |
69 | gtk_widget_show (action_menu); |
70 | |
71 | + XUngrabPointer (display, time); |
72 | + XUngrabKeyboard (display, time); |
73 | + |
74 | if (!button || button == 1) |
75 | { |
76 | gtk_menu_popup (GTK_MENU (action_menu), |
77 | |
78 | === modified file 'gtk/window-decorator/blurprops.c' |
79 | --- gtk/window-decorator/blurprops.c 2012-10-06 16:11:05 +0000 |
80 | +++ gtk/window-decorator/blurprops.c 2014-09-10 12:50:41 +0000 |
81 | @@ -79,7 +79,7 @@ |
82 | 32, PropModeReplace, (guchar *) data, |
83 | 2 + size * 6); |
84 | gdk_display_sync (gdk_display_get_default ()); |
85 | - gdk_error_trap_pop (); |
86 | + gdk_error_trap_pop_ignored (); |
87 | |
88 | free (data); |
89 | } |
90 | @@ -88,6 +88,6 @@ |
91 | gdk_error_trap_push (); |
92 | XDeleteProperty (xdisplay, d->prop_xid, win_blur_decor_atom); |
93 | gdk_display_sync (gdk_display_get_default ()); |
94 | - gdk_error_trap_pop (); |
95 | + gdk_error_trap_pop_ignored (); |
96 | } |
97 | } |
98 | |
99 | === modified file 'gtk/window-decorator/cairo.c' |
100 | --- gtk/window-decorator/cairo.c 2014-06-26 14:43:33 +0000 |
101 | +++ gtk/window-decorator/cairo.c 2014-09-10 12:50:41 +0000 |
102 | @@ -295,7 +295,7 @@ |
103 | { |
104 | cairo_t *cr; |
105 | GtkStyle *style; |
106 | - GdkDrawable *drawable; |
107 | + cairo_surface_t *surface; |
108 | decor_color_t color; |
109 | double alpha; |
110 | double x1, y1, x2, y2, x, y, h; |
111 | @@ -303,10 +303,9 @@ |
112 | int top; |
113 | int button_x; |
114 | |
115 | - if (!d->pixmap) |
116 | + if (!d->surface) |
117 | return; |
118 | |
119 | - |
120 | style = gtk_widget_get_style (d->frame->style_window_rgba); |
121 | |
122 | if (d->state & (WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY | |
123 | @@ -317,12 +316,12 @@ |
124 | color.g = style->bg[GTK_STATE_NORMAL].green / 65535.0; |
125 | color.b = style->bg[GTK_STATE_NORMAL].blue / 65535.0; |
126 | |
127 | - if (d->buffer_pixmap) |
128 | - drawable = d->buffer_pixmap; |
129 | + if (d->buffer_surface) |
130 | + surface = d->buffer_surface; |
131 | else |
132 | - drawable = d->pixmap; |
133 | + surface = d->surface; |
134 | |
135 | - cr = gdk_cairo_create (GDK_DRAWABLE (drawable)); |
136 | + cr = cairo_create (surface); |
137 | if (!cr) |
138 | return; |
139 | |
140 | @@ -691,8 +690,11 @@ |
141 | if (d->frame_window) |
142 | { |
143 | GdkWindow *gdk_frame_window = gtk_widget_get_window (d->decor_window); |
144 | - |
145 | - gtk_image_set_from_pixmap (GTK_IMAGE (d->decor_image), d->pixmap, NULL); |
146 | + GdkPixbuf *pixbuf = gdk_pixbuf_get_from_surface (d->surface, 0, 0, d->width, d->height); |
147 | + |
148 | + gtk_image_set_from_pixbuf (GTK_IMAGE (d->decor_image), pixbuf); |
149 | + g_object_unref (pixbuf); |
150 | + |
151 | gtk_window_resize (GTK_WINDOW (d->decor_window), d->width, d->height); |
152 | gdk_window_move (gdk_frame_window, 0, 0); |
153 | gdk_window_lower (gdk_frame_window); |
154 | |
155 | === modified file 'gtk/window-decorator/decorator.c' |
156 | --- gtk/window-decorator/decorator.c 2014-06-12 21:26:33 +0000 |
157 | +++ gtk/window-decorator/decorator.c 2014-09-10 12:50:41 +0000 |
158 | @@ -373,7 +373,7 @@ |
159 | } |
160 | |
161 | gdk_display_sync (gdk_display_get_default ()); |
162 | - gdk_error_trap_pop (); |
163 | + gdk_error_trap_pop_ignored (); |
164 | } |
165 | |
166 | /* |
167 | @@ -525,10 +525,10 @@ |
168 | d->icon = NULL; |
169 | } |
170 | |
171 | - if (d->icon_pixmap) |
172 | + if (d->icon_surface) |
173 | { |
174 | - g_object_unref (G_OBJECT (d->icon_pixmap)); |
175 | - d->icon_pixmap = NULL; |
176 | + cairo_surface_destroy (d->icon_surface); |
177 | + d->icon_surface = NULL; |
178 | } |
179 | |
180 | if (d->icon_pixbuf) |
181 | @@ -544,12 +544,12 @@ |
182 | |
183 | /* 32 bit pixmap on pixmap mode, 24 for reparenting */ |
184 | if (d->frame_window) |
185 | - d->icon_pixmap = pixmap_new_from_pixbuf (d->icon_pixbuf, |
186 | - d->frame->style_window_rgb); |
187 | + d->icon_surface = surface_new_from_pixbuf (d->icon_pixbuf, |
188 | + d->frame->style_window_rgb); |
189 | else |
190 | - d->icon_pixmap = pixmap_new_from_pixbuf (d->icon_pixbuf, |
191 | - d->frame->style_window_rgba); |
192 | - cr = gdk_cairo_create (GDK_DRAWABLE (d->icon_pixmap)); |
193 | + d->icon_surface = surface_new_from_pixbuf (d->icon_pixbuf, |
194 | + d->frame->style_window_rgba); |
195 | + cr = cairo_create (d->icon_surface); |
196 | d->icon = cairo_pattern_create_for_surface (cairo_get_target (cr)); |
197 | cairo_destroy (cr); |
198 | } |
199 | @@ -616,7 +616,7 @@ |
200 | update_window_decoration_size (WnckWindow *win) |
201 | { |
202 | decor_t *d; |
203 | - GdkPixmap *pixmap, *buffer_pixmap = NULL; |
204 | + cairo_surface_t *surface, *buffer_surface = NULL; |
205 | Picture picture; |
206 | Display *xdisplay; |
207 | XRenderPictFormat *format; |
208 | @@ -636,52 +636,54 @@ |
209 | /* Get the correct depth for the frame window in reparenting mode, otherwise |
210 | * enforce 32 */ |
211 | if (d->frame_window) |
212 | - pixmap = create_native_pixmap_and_wrap (d->width, d->height, d->frame->style_window_rgb); |
213 | + surface = create_native_surface_and_wrap (d->width, d->height, d->frame->style_window_rgb); |
214 | else |
215 | - pixmap = create_native_pixmap_and_wrap (d->width, d->height, d->frame->style_window_rgba); |
216 | + surface = create_native_surface_and_wrap (d->width, d->height, d->frame->style_window_rgba); |
217 | |
218 | gdk_flush (); |
219 | |
220 | /* Handle failure */ |
221 | - if (!pixmap || gdk_error_trap_pop ()) |
222 | + if (!surface || gdk_error_trap_pop ()) |
223 | { |
224 | - memset (pixmap, 0, sizeof (*pixmap)); |
225 | + if (surface) |
226 | + cairo_surface_destroy (surface); |
227 | return FALSE; |
228 | } |
229 | |
230 | gdk_error_trap_push (); |
231 | |
232 | if (d->frame_window) |
233 | - buffer_pixmap = create_pixmap (d->width, d->height, d->frame->style_window_rgb); |
234 | + buffer_surface = create_surface (d->width, d->height, d->frame->style_window_rgb); |
235 | else |
236 | - buffer_pixmap = create_pixmap (d->width, d->height, d->frame->style_window_rgba); |
237 | + buffer_surface = create_surface (d->width, d->height, d->frame->style_window_rgba); |
238 | |
239 | gdk_flush (); |
240 | |
241 | /* Handle failure */ |
242 | - if (!buffer_pixmap || gdk_error_trap_pop ()) |
243 | + if (!buffer_surface || gdk_error_trap_pop ()) |
244 | { |
245 | - memset (buffer_pixmap, 0, sizeof (*buffer_pixmap)); |
246 | - g_object_unref (G_OBJECT (pixmap)); |
247 | + if (buffer_surface) |
248 | + cairo_surface_destroy (buffer_surface); |
249 | + cairo_surface_destroy (surface); |
250 | return FALSE; |
251 | } |
252 | |
253 | /* Create XRender context */ |
254 | - format = get_format_for_drawable (d, GDK_DRAWABLE (buffer_pixmap)); |
255 | - picture = XRenderCreatePicture (xdisplay, GDK_PIXMAP_XID (buffer_pixmap), |
256 | + format = get_format_for_surface (d, buffer_surface); |
257 | + picture = XRenderCreatePicture (xdisplay, cairo_xlib_surface_get_drawable (buffer_surface), |
258 | format, 0, NULL); |
259 | |
260 | /* Destroy the old pixmaps and pictures */ |
261 | - if (d->pixmap) |
262 | - g_object_unref (d->pixmap); |
263 | + if (d->surface) |
264 | + cairo_surface_destroy (d->surface); |
265 | |
266 | if (d->x11Pixmap) |
267 | decor_post_delete_pixmap (xdisplay, |
268 | wnck_window_get_xid (d->win), |
269 | d->x11Pixmap); |
270 | |
271 | - if (d->buffer_pixmap) |
272 | - g_object_unref (G_OBJECT (d->buffer_pixmap)); |
273 | + if (d->buffer_surface) |
274 | + cairo_surface_destroy (d->buffer_surface); |
275 | |
276 | if (d->picture) |
277 | XRenderFreePicture (xdisplay, d->picture); |
278 | @@ -690,10 +692,10 @@ |
279 | cairo_destroy (d->cr); |
280 | |
281 | /* Assign new pixmaps and pictures */ |
282 | - d->pixmap = pixmap; |
283 | - d->x11Pixmap = GDK_PIXMAP_XID (d->pixmap); |
284 | - d->buffer_pixmap = buffer_pixmap; |
285 | - d->cr = gdk_cairo_create (pixmap); |
286 | + d->surface = surface; |
287 | + d->x11Pixmap = cairo_xlib_surface_get_drawable (d->surface); |
288 | + d->buffer_surface = buffer_surface; |
289 | + d->cr = cairo_create (surface); |
290 | |
291 | d->picture = picture; |
292 | |
293 | @@ -725,10 +727,10 @@ |
294 | void *closure) |
295 | { |
296 | static XRenderColor white = { 0xffff, 0xffff, 0xffff, 0xffff }; |
297 | - GdkColormap *colormap; |
298 | decor_t d; |
299 | decor_shadow_info_t *info = (decor_shadow_info_t *) closure; |
300 | double save_decoration_alpha; |
301 | + GdkScreen *screen; |
302 | |
303 | memset (&d, 0, sizeof (d)); |
304 | |
305 | @@ -747,8 +749,13 @@ |
306 | d.active = TRUE; |
307 | } |
308 | |
309 | - d.pixmap = gdk_pixmap_foreign_new_for_display (gdk_display_get_default (), |
310 | - pixmap); |
311 | + screen = gdk_screen_get_default (); |
312 | + |
313 | + d.surface = cairo_xlib_surface_create (GDK_SCREEN_XDISPLAY (screen), |
314 | + pixmap, |
315 | + GDK_VISUAL_XVISUAL (gdk_screen_get_rgba_visual (screen)), |
316 | + width, |
317 | + height); |
318 | d.width = width; |
319 | d.height = height; |
320 | d.active = TRUE; |
321 | @@ -764,9 +771,6 @@ |
322 | |
323 | decor_get_default_layout (c, 1, 1, &d.border_layout); |
324 | |
325 | - colormap = get_colormap_for_drawable (GDK_DRAWABLE (d.pixmap)); |
326 | - gdk_drawable_set_colormap (d.pixmap, colormap); |
327 | - |
328 | /* create shadow from opaque decoration |
329 | * FIXME: Should not modify settings value |
330 | * like this */ |
331 | @@ -786,7 +790,7 @@ |
332 | if (!info) |
333 | gwd_decor_frame_unref (d.frame); |
334 | |
335 | - g_object_unref (G_OBJECT (d.pixmap)); |
336 | + cairo_surface_destroy (d.surface); |
337 | } |
338 | |
339 | |
340 | @@ -1396,8 +1400,8 @@ |
341 | |
342 | if (default_frames[i].d) |
343 | { |
344 | - if (default_frames[i].d->pixmap) |
345 | - g_object_unref (G_OBJECT (default_frames[i].d->pixmap)); |
346 | + if (default_frames[i].d->surface) |
347 | + cairo_surface_destroy (default_frames[i].d->surface); |
348 | |
349 | free (default_frames[i].d); |
350 | } |
351 | @@ -1419,9 +1423,9 @@ |
352 | extents.top += frame->titlebar_height; |
353 | |
354 | default_frames[i].d->draw = theme_draw_window_decoration; |
355 | - default_frames[i].d->pixmap = create_native_pixmap_and_wrap (default_frames[i].d->width, |
356 | - default_frames[i].d->height, |
357 | - frame->style_window_rgba); |
358 | + default_frames[i].d->surface = create_native_surface_and_wrap (default_frames[i].d->width, |
359 | + default_frames[i].d->height, |
360 | + frame->style_window_rgba); |
361 | |
362 | unsigned int j, k; |
363 | |
364 | @@ -1439,7 +1443,7 @@ |
365 | default_frames[i].d->button_states[j] = 0; |
366 | } |
367 | |
368 | - if (default_frames[i].d->pixmap) |
369 | + if (default_frames[i].d->surface) |
370 | { |
371 | gint nQuad; |
372 | unsigned int frame_type = populate_frame_type (default_frames[i].d); |
373 | @@ -1451,12 +1455,12 @@ |
374 | &default_frames[i].d->border_layout); |
375 | |
376 | default_frames[i].d->picture = XRenderCreatePicture (xdisplay, |
377 | - GDK_PIXMAP_XID (default_frames[i].d->pixmap), |
378 | - xformat_rgba, 0, NULL); |
379 | + cairo_xlib_surface_get_drawable (default_frames[i].d->surface), |
380 | + xformat_rgba, 0, NULL); |
381 | |
382 | (*default_frames[i].d->draw) (default_frames[i].d); |
383 | |
384 | - decor_quads_to_property (data, i, GDK_PIXMAP_XID (default_frames[i].d->pixmap), |
385 | + decor_quads_to_property (data, i, cairo_xlib_surface_get_drawable (default_frames[i].d->surface), |
386 | &extents, &extents, |
387 | &extents, &extents, 0, 0, quads, nQuad, frame_type, frame_state, frame_actions); |
388 | } |
389 | @@ -1483,10 +1487,10 @@ |
390 | void |
391 | copy_to_front_buffer (decor_t *d) |
392 | { |
393 | - if (!d->buffer_pixmap) |
394 | + if (!d->buffer_surface) |
395 | return; |
396 | |
397 | cairo_set_operator (d->cr, CAIRO_OPERATOR_SOURCE); |
398 | - gdk_cairo_set_source_pixmap (d->cr, d->buffer_pixmap, 0, 0); |
399 | + cairo_set_source_surface (d->cr, d->buffer_surface, 0, 0); |
400 | cairo_paint (d->cr); |
401 | } |
402 | |
403 | === modified file 'gtk/window-decorator/decorprops.c' |
404 | --- gtk/window-decorator/decorprops.c 2011-10-13 09:53:38 +0000 |
405 | +++ gtk/window-decorator/decorprops.c 2014-09-10 12:50:41 +0000 |
406 | @@ -66,7 +66,7 @@ |
407 | else |
408 | { |
409 | data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_PIXMAP); |
410 | - decor_quads_to_property (data, nOffset - 1, GDK_PIXMAP_XID (d->pixmap), |
411 | + decor_quads_to_property (data, nOffset - 1, cairo_xlib_surface_get_drawable (d->surface), |
412 | &extents, &extents, |
413 | &extents, &extents, |
414 | ICON_SPACE + d->button_width, |
415 | @@ -81,7 +81,7 @@ |
416 | 32, PropModeReplace, (guchar *) data, |
417 | PROP_HEADER_SIZE + BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX); |
418 | gdk_display_sync (gdk_display_get_default ()); |
419 | - gdk_error_trap_pop (); |
420 | + gdk_error_trap_pop_ignored (); |
421 | |
422 | top.rects = &top.extents; |
423 | top.numRects = top.size = 1; |
424 | @@ -148,7 +148,7 @@ |
425 | 32); |
426 | |
427 | data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_PIXMAP); |
428 | - decor_quads_to_property (data, nOffset - 1, GDK_PIXMAP_XID (d->pixmap), |
429 | + decor_quads_to_property (data, nOffset - 1, cairo_xlib_surface_get_drawable (d->surface), |
430 | &d->frame->win_extents, &d->frame->win_extents, |
431 | &d->frame->win_extents, &d->frame->win_extents, |
432 | 0, 0, quads, nQuad, frame_type, frame_state, frame_actions); |
433 | @@ -169,7 +169,7 @@ |
434 | XChangeProperty (xdisplay, d->prop_xid, switcher_fg_atom, |
435 | XA_INTEGER, 32, PropModeReplace, (guchar *) fgColor, 4); |
436 | gdk_display_sync (gdk_display_get_default ()); |
437 | - gdk_error_trap_pop (); |
438 | + gdk_error_trap_pop_ignored (); |
439 | |
440 | free (data); |
441 | } |
442 | |
443 | === modified file 'gtk/window-decorator/events.c' |
444 | --- gtk/window-decorator/events.c 2014-06-12 21:26:33 +0000 |
445 | +++ gtk/window-decorator/events.c 2014-09-10 12:50:41 +0000 |
446 | @@ -920,7 +920,8 @@ |
447 | { |
448 | if (!wnck_window_get (xevent->xcreatewindow.window)) |
449 | { |
450 | - GdkWindow *toplevel = create_foreign_window (xevent->xcreatewindow.window); |
451 | + gdk_error_trap_push (); |
452 | + GdkWindow *toplevel = gdk_x11_window_foreign_new_for_display (gdkdisplay, xevent->xcreatewindow.window); |
453 | |
454 | if (toplevel) |
455 | { |
456 | @@ -933,6 +934,7 @@ |
457 | if (get_window_prop (xevent->xcreatewindow.window, select_window_atom, &select)) |
458 | update_switcher_window (xevent->xcreatewindow.window, select); |
459 | } |
460 | + gdk_error_trap_pop_ignored (); |
461 | } |
462 | } |
463 | break; |
464 | @@ -998,7 +1000,7 @@ |
465 | xevent->xproperty.atom == compiz_shadow_color_atom) |
466 | { |
467 | GdkScreen *g_screen = gdk_display_get_default_screen (gdkdisplay); |
468 | - Window root = GDK_WINDOW_XWINDOW (gdk_screen_get_root_window (g_screen)); |
469 | + Window root = GDK_WINDOW_XID (gdk_screen_get_root_window (g_screen)); |
470 | WnckScreen *screen; |
471 | |
472 | screen = wnck_screen_get_for_root (root); |
473 | |
474 | === modified file 'gtk/window-decorator/forcequit.c' |
475 | --- gtk/window-decorator/forcequit.c 2011-02-21 09:53:08 +0000 |
476 | +++ gtk/window-decorator/forcequit.c 2014-09-10 12:50:41 +0000 |
477 | @@ -44,7 +44,7 @@ |
478 | FALSE, XA_STRING, &type, &format, &nitems, |
479 | &bytes_after, &str); |
480 | |
481 | - gdk_error_trap_pop (); |
482 | + gdk_error_trap_pop_ignored (); |
483 | |
484 | if (result != Success) |
485 | return NULL; |
486 | @@ -92,7 +92,7 @@ |
487 | gdk_error_trap_push (); |
488 | XKillClient (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), wnck_window_get_xid (win)); |
489 | gdk_display_sync (gdk_display_get_default ()); |
490 | - gdk_error_trap_pop (); |
491 | + gdk_error_trap_pop_ignored (); |
492 | } |
493 | |
494 | static void |
495 | @@ -103,10 +103,10 @@ |
496 | |
497 | gdk_error_trap_push (); |
498 | XSetTransientForHint (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), |
499 | - GDK_WINDOW_XID (dialog->window), |
500 | + GDK_WINDOW_XID (gtk_widget_get_window (dialog)), |
501 | wnck_window_get_xid (win)); |
502 | gdk_display_sync (gdk_display_get_default ()); |
503 | - gdk_error_trap_pop (); |
504 | + gdk_error_trap_pop_ignored (); |
505 | } |
506 | |
507 | static void |
508 | @@ -134,6 +134,7 @@ |
509 | decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); |
510 | GtkWidget *dialog; |
511 | gchar *str, *tmp; |
512 | + const gchar *message; |
513 | |
514 | if (d->force_quit_dialog) |
515 | return; |
516 | @@ -143,23 +144,17 @@ |
517 | |
518 | g_free (tmp); |
519 | |
520 | - dialog = gtk_message_dialog_new (NULL, 0, |
521 | - GTK_MESSAGE_WARNING, |
522 | - GTK_BUTTONS_NONE, |
523 | - "<b>%s</b>\n\n%s", |
524 | - str, |
525 | - _("Forcing this application to " |
526 | - "quit will cause you to lose any " |
527 | - "unsaved changes.")); |
528 | + message = _("Forcing this application to quit will cause you to lose any unsaved changes."); |
529 | + dialog = gtk_message_dialog_new_with_markup (NULL, 0, |
530 | + GTK_MESSAGE_WARNING, |
531 | + GTK_BUTTONS_NONE, |
532 | + "<b>%s</b>\n\n%s", |
533 | + str, |
534 | + message); |
535 | g_free (str); |
536 | |
537 | gtk_window_set_icon_name (GTK_WINDOW (dialog), "force-quit"); |
538 | |
539 | - gtk_label_set_use_markup (GTK_LABEL (GTK_MESSAGE_DIALOG (dialog)->label), |
540 | - TRUE); |
541 | - gtk_label_set_line_wrap (GTK_LABEL (GTK_MESSAGE_DIALOG (dialog)->label), |
542 | - TRUE); |
543 | - |
544 | gtk_dialog_add_buttons (GTK_DIALOG (dialog), |
545 | GTK_STOCK_CANCEL, |
546 | GTK_RESPONSE_REJECT, |
547 | @@ -181,7 +176,7 @@ |
548 | |
549 | gtk_widget_realize (dialog); |
550 | |
551 | - gdk_x11_window_set_user_time (dialog->window, timestamp); |
552 | + gdk_x11_window_set_user_time (gtk_widget_get_window (dialog), timestamp); |
553 | |
554 | gtk_widget_show (dialog); |
555 | |
556 | |
557 | === modified file 'gtk/window-decorator/frames.c' |
558 | --- gtk/window-decorator/frames.c 2013-05-13 15:39:25 +0000 |
559 | +++ gtk/window-decorator/frames.c 2014-09-10 12:50:41 +0000 |
560 | @@ -201,7 +201,7 @@ |
561 | decor_frame_new (const gchar *type) |
562 | { |
563 | GdkScreen *gdkscreen = gdk_screen_get_default (); |
564 | - GdkColormap *colormap; |
565 | + GdkVisual *visual; |
566 | decor_frame_t *frame = malloc (sizeof (decor_frame_t)); |
567 | |
568 | if (!frame) |
569 | @@ -224,9 +224,9 @@ |
570 | |
571 | frame->style_window_rgba = gtk_window_new (GTK_WINDOW_POPUP); |
572 | |
573 | - colormap = gdk_screen_get_rgba_colormap (gdkscreen); |
574 | - if (colormap) |
575 | - gtk_widget_set_colormap (frame->style_window_rgba, colormap); |
576 | + visual = gdk_screen_get_rgba_visual (gdkscreen); |
577 | + if (visual) |
578 | + gtk_widget_set_visual (frame->style_window_rgba, visual); |
579 | |
580 | gtk_widget_realize (frame->style_window_rgba); |
581 | |
582 | @@ -241,9 +241,9 @@ |
583 | |
584 | frame->style_window_rgb = gtk_window_new (GTK_WINDOW_POPUP); |
585 | |
586 | - colormap = gdk_screen_get_rgb_colormap (gdkscreen); |
587 | - if (colormap) |
588 | - gtk_widget_set_colormap (frame->style_window_rgb, colormap); |
589 | + visual = gdk_screen_get_system_visual (gdkscreen); |
590 | + if (visual) |
591 | + gtk_widget_set_visual (frame->style_window_rgb, visual); |
592 | |
593 | gtk_widget_realize (frame->style_window_rgb); |
594 | |
595 | |
596 | === modified file 'gtk/window-decorator/gdk.c' |
597 | --- gtk/window-decorator/gdk.c 2013-02-20 03:11:17 +0000 |
598 | +++ gtk/window-decorator/gdk.c 2014-09-10 12:50:41 +0000 |
599 | @@ -21,30 +21,31 @@ |
600 | |
601 | #include "gtk-window-decorator.h" |
602 | |
603 | -GdkPixmap * |
604 | -pixmap_new_from_pixbuf (GdkPixbuf *pixbuf, GtkWidget *parent) |
605 | +cairo_surface_t * |
606 | +surface_new_from_pixbuf (GdkPixbuf *pixbuf, |
607 | + GtkWidget *parent) |
608 | { |
609 | - GdkPixmap *pixmap; |
610 | - guint width, height; |
611 | - cairo_t *cr; |
612 | + cairo_surface_t *surface; |
613 | + guint width; |
614 | + guint height; |
615 | + cairo_t *cr; |
616 | |
617 | width = gdk_pixbuf_get_width (pixbuf); |
618 | height = gdk_pixbuf_get_height (pixbuf); |
619 | |
620 | - pixmap = create_pixmap (width, height, parent); |
621 | - if (!pixmap) |
622 | + surface = create_surface (width, height, parent); |
623 | + if (!surface) |
624 | return NULL; |
625 | |
626 | - cr = (cairo_t *) gdk_cairo_create (GDK_DRAWABLE (pixmap)); |
627 | + cr = cairo_create (surface); |
628 | gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); |
629 | cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); |
630 | cairo_paint (cr); |
631 | cairo_destroy (cr); |
632 | |
633 | - return pixmap; |
634 | + return surface; |
635 | } |
636 | |
637 | - |
638 | void |
639 | gdk_cairo_set_source_color_alpha (cairo_t *cr, |
640 | GdkColor *color, |
641 | @@ -61,70 +62,57 @@ |
642 | create_gdk_window (Window xframe) |
643 | { |
644 | GdkDisplay *display = gdk_display_get_default (); |
645 | - GdkScreen *screen = gdk_display_get_default_screen (display); |
646 | - GdkWindow *window = create_foreign_window (xframe); |
647 | - GdkColormap *cmap = gdk_screen_get_rgb_colormap (screen); |
648 | - |
649 | - gdk_drawable_set_colormap (GDK_DRAWABLE (window), cmap); |
650 | + GdkWindow *window = gdk_x11_window_foreign_new_for_display (display, xframe); |
651 | |
652 | return window; |
653 | } |
654 | |
655 | -GdkColormap * |
656 | -get_colormap_for_drawable (GdkDrawable *d) |
657 | -{ |
658 | - GdkDisplay *display = gdk_display_get_default (); |
659 | - GdkScreen *screen = gdk_display_get_default_screen (display); |
660 | - |
661 | - if (gdk_drawable_get_depth (d) == 32) |
662 | - return gdk_screen_get_rgba_colormap (screen); |
663 | - |
664 | - return gdk_screen_get_rgb_colormap (screen); |
665 | -} |
666 | - |
667 | XRenderPictFormat * |
668 | -get_format_for_drawable (decor_t *d, GdkDrawable *drawable) |
669 | +get_format_for_surface (decor_t *d, |
670 | + cairo_surface_t *surface) |
671 | { |
672 | - if (!d->frame_window || gdk_drawable_get_depth (drawable) == 32) |
673 | + if (!d->frame_window || cairo_xlib_surface_get_depth (surface) == 32) |
674 | return xformat_rgba; |
675 | |
676 | return xformat_rgb; |
677 | } |
678 | |
679 | -GdkPixmap * |
680 | -create_native_pixmap_and_wrap (int w, |
681 | - int h, |
682 | - GtkWidget *parent_style_window) |
683 | +cairo_surface_t * |
684 | +create_native_surface_and_wrap (int w, |
685 | + int h, |
686 | + GtkWidget *parent_style_window) |
687 | { |
688 | - GdkWindow *window; |
689 | + GdkWindow *window; |
690 | + GdkVisual *visual; |
691 | + cairo_surface_t *surface; |
692 | + Display *display; |
693 | + Pixmap pixmap; |
694 | |
695 | if (w <= 0 || h <= 0) |
696 | abort (); |
697 | |
698 | + display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); |
699 | window = gtk_widget_get_window (parent_style_window); |
700 | - GdkPixmap *pixmap = |
701 | - gdk_pixmap_foreign_new (XCreatePixmap (gdk_x11_display_get_xdisplay (gdk_display_get_default ()), |
702 | - GDK_WINDOW_XID (window), w, h, |
703 | - gdk_drawable_get_depth (window))); |
704 | - GdkColormap *cmap = get_colormap_for_drawable (GDK_DRAWABLE (pixmap)); |
705 | - gdk_drawable_set_colormap (GDK_DRAWABLE (pixmap), cmap); |
706 | - return pixmap; |
707 | + visual = gdk_window_get_visual (window); |
708 | + pixmap = XCreatePixmap (display, GDK_WINDOW_XID (window), w, h, gdk_visual_get_depth (visual)); |
709 | + surface = cairo_xlib_surface_create (display, pixmap, GDK_VISUAL_XVISUAL (visual), w, h); |
710 | + |
711 | + return surface; |
712 | } |
713 | |
714 | -GdkPixmap * |
715 | -create_pixmap (int w, |
716 | - int h, |
717 | - GtkWidget *parent_style_window) |
718 | +cairo_surface_t * |
719 | +create_surface (int w, |
720 | + int h, |
721 | + GtkWidget *parent_style_window) |
722 | { |
723 | - GdkWindow *window; |
724 | + GdkWindow *window; |
725 | + cairo_surface_t *surface; |
726 | |
727 | if (w == 0 || h == 0) |
728 | abort (); |
729 | |
730 | window = gtk_widget_get_window (parent_style_window); |
731 | - GdkPixmap *pixmap = gdk_pixmap_new (GDK_DRAWABLE (window), w, h, -1 /* CopyFromParent */); |
732 | + surface = gdk_window_create_similar_surface (window, CAIRO_CONTENT_COLOR_ALPHA, w, h); |
733 | |
734 | - GdkColormap *cmap = get_colormap_for_drawable (GDK_DRAWABLE (pixmap)); |
735 | - gdk_drawable_set_colormap (GDK_DRAWABLE (pixmap), cmap); |
736 | - return pixmap; |
737 | + return surface; |
738 | } |
739 | |
740 | === modified file 'gtk/window-decorator/gtk-window-decorator.c' |
741 | --- gtk/window-decorator/gtk-window-decorator.c 2013-05-13 15:39:25 +0000 |
742 | +++ gtk/window-decorator/gtk-window-decorator.c 2014-09-10 12:50:41 +0000 |
743 | @@ -61,9 +61,6 @@ |
744 | |
745 | guint cmdline_options = 0; |
746 | |
747 | -GdkPixmap *decor_normal_pixmap = NULL; |
748 | -GdkPixmap *decor_active_pixmap = NULL; |
749 | - |
750 | Atom frame_input_window_atom; |
751 | Atom frame_output_window_atom; |
752 | Atom win_decor_atom; |
753 | @@ -360,7 +357,7 @@ |
754 | |
755 | if (!minimal) |
756 | { |
757 | - GdkWindow *root = create_foreign_window (gdk_x11_get_default_root_xwindow ()); |
758 | + GdkWindow *root = gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), gdk_x11_get_default_root_xwindow ()); |
759 | |
760 | gdk_window_add_filter (NULL, |
761 | event_filter_func, |
762 | @@ -371,7 +368,7 @@ |
763 | |
764 | for (i = 0; i < nchildren; ++i) |
765 | { |
766 | - GdkWindow *toplevel = create_foreign_window (children[i]); |
767 | + GdkWindow *toplevel = gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), children[i]); |
768 | |
769 | /* Need property notify on all windows */ |
770 | |
771 | |
772 | === modified file 'gtk/window-decorator/gtk-window-decorator.h' |
773 | --- gtk/window-decorator/gtk-window-decorator.h 2014-07-09 10:47:48 +0000 |
774 | +++ gtk/window-decorator/gtk-window-decorator.h 2014-09-10 12:50:41 +0000 |
775 | @@ -37,30 +37,6 @@ |
776 | #include <X11/extensions/Xrender.h> |
777 | #include <X11/Xregion.h> |
778 | |
779 | -#ifdef HAVE_GTK_2_24 |
780 | - |
781 | -#ifndef GDK_DISABLE_DEPRECATED |
782 | -#define GDK_DISABLE_DEPRECATED |
783 | -#endif |
784 | - |
785 | -#define create_foreign_window(xid) \ |
786 | - gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), \ |
787 | - xid) |
788 | -#else |
789 | - |
790 | -#define create_foreign_window(xid) \ |
791 | - gdk_window_foreign_new (xid) |
792 | - |
793 | -#ifdef GDK_DISABLE_DEPRECATED |
794 | -#undef GDK_DISABLE_DEPRECATED |
795 | -#endif |
796 | - |
797 | -#endif |
798 | - |
799 | -#ifndef GTK_DISABLE_DEPRECATED |
800 | -#define GTK_DISABLE_DEPRECATED |
801 | -#endif |
802 | - |
803 | #include <gtk/gtk.h> |
804 | #include <gdk/gdkx.h> |
805 | #include <gdk/gdk.h> |
806 | @@ -73,7 +49,6 @@ |
807 | |
808 | #define WNCK_I_KNOW_THIS_IS_UNSTABLE |
809 | #include <libwnck/libwnck.h> |
810 | -#include <libwnck/window-action-menu.h> |
811 | |
812 | #include <cairo.h> |
813 | #include <cairo-xlib.h> |
814 | @@ -329,8 +304,8 @@ |
815 | Box *last_pos_entered; |
816 | guint button_states[BUTTON_NUM]; |
817 | Pixmap x11Pixmap; |
818 | - GdkPixmap *pixmap; |
819 | - GdkPixmap *buffer_pixmap; |
820 | + cairo_surface_t *surface; |
821 | + cairo_surface_t *buffer_surface; |
822 | GdkWindow *frame_window; |
823 | GtkWidget *decor_window; |
824 | GtkWidget *decor_event_box; |
825 | @@ -350,7 +325,7 @@ |
826 | PangoLayout *layout; |
827 | gchar *name; |
828 | cairo_pattern_t *icon; |
829 | - GdkPixmap *icon_pixmap; |
830 | + cairo_surface_t *icon_surface; |
831 | GdkPixbuf *icon_pixbuf; |
832 | WnckWindowState state; |
833 | WnckWindowActions actions; |
834 | @@ -724,24 +699,21 @@ |
835 | GdkWindow * |
836 | create_gdk_window (Window xframe); |
837 | |
838 | -GdkColormap * |
839 | -get_colormap_for_drawable (GdkDrawable *d); |
840 | - |
841 | XRenderPictFormat * |
842 | -get_format_for_drawable (decor_t *d, GdkDrawable *drawable); |
843 | +get_format_for_surface (decor_t *d, cairo_surface_t *surface); |
844 | |
845 | -GdkPixmap * |
846 | -create_pixmap (int w, |
847 | +cairo_surface_t * |
848 | +create_surface (int w, |
849 | int h, |
850 | GtkWidget *parent_style_window); |
851 | |
852 | -GdkPixmap * |
853 | -create_native_pixmap_and_wrap (int w, |
854 | +cairo_surface_t * |
855 | +create_native_surface_and_wrap (int w, |
856 | int h, |
857 | GtkWidget *parent_style_window); |
858 | |
859 | -GdkPixmap * |
860 | -pixmap_new_from_pixbuf (GdkPixbuf *pixbuf, GtkWidget *parent); |
861 | +cairo_surface_t * |
862 | +surface_new_from_pixbuf (GdkPixbuf *pixbuf, GtkWidget *parent); |
863 | |
864 | /* metacity.c */ |
865 | #ifdef USE_METACITY |
866 | |
867 | === modified file 'gtk/window-decorator/gwd-settings-notified.h' |
868 | --- gtk/window-decorator/gwd-settings-notified.h 2012-10-06 16:11:05 +0000 |
869 | +++ gtk/window-decorator/gwd-settings-notified.h 2014-09-10 12:50:41 +0000 |
870 | @@ -21,7 +21,8 @@ |
871 | #define _COMPIZ_GWD_SETTINGS_NOTIFIED_H |
872 | |
873 | #include <glib-object.h> |
874 | -#include <libwnck/screen.h> |
875 | +#define WNCK_I_KNOW_THIS_IS_UNSTABLE |
876 | +#include <libwnck/libwnck.h> |
877 | #include <gwd-fwd.h> |
878 | |
879 | G_BEGIN_DECLS |
880 | |
881 | === modified file 'gtk/window-decorator/metacity.c' |
882 | --- gtk/window-decorator/metacity.c 2014-06-12 21:26:33 +0000 |
883 | +++ gtk/window-decorator/metacity.c 2014-09-10 12:50:41 +0000 |
884 | @@ -138,7 +138,7 @@ |
885 | 32, PropModeReplace, (guchar *) data, |
886 | PROP_HEADER_SIZE + BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX); |
887 | gdk_display_sync (gdk_display_get_default ()); |
888 | - gdk_error_trap_pop (); |
889 | + gdk_error_trap_pop_ignored (); |
890 | |
891 | free (data); |
892 | |
893 | @@ -773,11 +773,7 @@ |
894 | |
895 | if (d->frame_window) |
896 | { |
897 | - GdkColormap *cmap; |
898 | - |
899 | - cmap = get_colormap_for_drawable (GDK_DRAWABLE (d->pixmap)); |
900 | pixmap = create_pixmap (size, rect.height, d->frame->style_window_rgb); |
901 | - gdk_drawable_set_colormap (GDK_DRAWABLE (pixmap), cmap); |
902 | } |
903 | else |
904 | pixmap = create_pixmap (size, rect.height, d->frame->style_window_rgba); |
905 | |
906 | === modified file 'gtk/window-decorator/style.c' |
907 | --- gtk/window-decorator/style.c 2011-02-21 09:53:08 +0000 |
908 | +++ gtk/window-decorator/style.c 2014-09-10 12:50:41 +0000 |
909 | @@ -30,7 +30,7 @@ |
910 | style = gtk_widget_get_style (widget); |
911 | g_object_ref (G_OBJECT (style)); |
912 | |
913 | - style = gtk_style_attach (style, widget->window); |
914 | + style = gtk_style_attach (style, gtk_widget_get_window (widget)); |
915 | |
916 | spot_color.r = style->bg[GTK_STATE_SELECTED].red / 65535.0; |
917 | spot_color.g = style->bg[GTK_STATE_SELECTED].green / 65535.0; |
918 | |
919 | === modified file 'gtk/window-decorator/switcher.c' |
920 | --- gtk/window-decorator/switcher.c 2013-02-11 17:44:19 +0000 |
921 | +++ gtk/window-decorator/switcher.c 2014-09-10 12:50:41 +0000 |
922 | @@ -82,7 +82,7 @@ |
923 | unsigned long pixel; |
924 | ushort a = SWITCHER_ALPHA; |
925 | |
926 | - if (!d->buffer_pixmap) |
927 | + if (!d->buffer_surface) |
928 | return; |
929 | |
930 | style = gtk_widget_get_style (d->frame->style_window_rgba); |
931 | @@ -91,7 +91,7 @@ |
932 | color.g = style->bg[GTK_STATE_NORMAL].green / 65535.0; |
933 | color.b = style->bg[GTK_STATE_NORMAL].blue / 65535.0; |
934 | |
935 | - cr = gdk_cairo_create (GDK_DRAWABLE (d->buffer_pixmap)); |
936 | + cr = cairo_create (d->buffer_surface); |
937 | |
938 | cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); |
939 | |
940 | @@ -261,7 +261,7 @@ |
941 | XClearWindow (xdisplay, d->prop_xid); |
942 | |
943 | gdk_display_sync (gdk_display_get_default ()); |
944 | - gdk_error_trap_pop (); |
945 | + gdk_error_trap_pop_ignored (); |
946 | |
947 | d->prop_xid = 0; |
948 | } |
949 | @@ -273,12 +273,12 @@ |
950 | GtkStyle *style; |
951 | double alpha = SWITCHER_ALPHA / 65535.0; |
952 | |
953 | - if (!d->pixmap || !d->buffer_pixmap) |
954 | + if (!d->surface || !d->buffer_surface) |
955 | return; |
956 | |
957 | style = gtk_widget_get_style (d->frame->style_window_rgba); |
958 | |
959 | - cr = gdk_cairo_create (GDK_DRAWABLE (d->buffer_pixmap)); |
960 | + cr = cairo_create (d->buffer_surface); |
961 | |
962 | cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); |
963 | |
964 | @@ -338,11 +338,11 @@ |
965 | if (d->name) |
966 | g_free (d->name); |
967 | |
968 | - if (d->pixmap) |
969 | - g_object_unref (G_OBJECT (d->pixmap)); |
970 | + if (d->surface) |
971 | + cairo_surface_destroy (d->surface); |
972 | |
973 | - if (d->buffer_pixmap) |
974 | - g_object_unref (G_OBJECT (d->buffer_pixmap)); |
975 | + if (d->buffer_surface) |
976 | + cairo_surface_destroy (d->buffer_surface); |
977 | |
978 | if (d->cr) |
979 | cairo_destroy (d->cr); |
980 | @@ -375,7 +375,7 @@ |
981 | Window selected) |
982 | { |
983 | decor_t *d = switcher_window; |
984 | - GdkPixmap *pixmap, *buffer_pixmap = NULL; |
985 | + cairo_surface_t *surface, *buffer_surface = NULL; |
986 | unsigned int height, width = 0, border, depth; |
987 | int x, y; |
988 | Window root_return; |
989 | @@ -472,27 +472,27 @@ |
990 | switcher_selected_window = selected; |
991 | } |
992 | |
993 | - pixmap = create_native_pixmap_and_wrap (width, height, d->frame->style_window_rgba); |
994 | - if (!pixmap) |
995 | + surface = create_native_surface_and_wrap (width, height, d->frame->style_window_rgba); |
996 | + if (!surface) |
997 | return FALSE; |
998 | |
999 | - buffer_pixmap = create_pixmap (width, height, d->frame->style_window_rgba); |
1000 | - if (!buffer_pixmap) |
1001 | + buffer_surface = create_surface (width, height, d->frame->style_window_rgba); |
1002 | + if (!buffer_surface) |
1003 | { |
1004 | - g_object_unref (G_OBJECT (pixmap)); |
1005 | + cairo_surface_destroy (surface); |
1006 | return FALSE; |
1007 | } |
1008 | |
1009 | - if (d->pixmap) |
1010 | - g_object_unref (G_OBJECT (d->pixmap)); |
1011 | + if (d->surface) |
1012 | + cairo_surface_destroy (d->surface); |
1013 | |
1014 | if (d->x11Pixmap) |
1015 | decor_post_delete_pixmap (xdisplay, |
1016 | - wnck_window_get_xid (d->win), |
1017 | + 0, |
1018 | d->x11Pixmap); |
1019 | |
1020 | - if (d->buffer_pixmap) |
1021 | - g_object_unref (G_OBJECT (d->buffer_pixmap)); |
1022 | + if (d->buffer_surface) |
1023 | + cairo_surface_destroy (d->buffer_surface); |
1024 | |
1025 | if (d->cr) |
1026 | cairo_destroy (d->cr); |
1027 | @@ -500,13 +500,13 @@ |
1028 | if (d->picture) |
1029 | XRenderFreePicture (xdisplay, d->picture); |
1030 | |
1031 | - d->pixmap = pixmap; |
1032 | - d->x11Pixmap = GDK_PIXMAP_XID (d->pixmap); |
1033 | - d->buffer_pixmap = buffer_pixmap; |
1034 | - d->cr = gdk_cairo_create (pixmap); |
1035 | + d->surface = surface; |
1036 | + d->x11Pixmap = cairo_xlib_surface_get_drawable (d->surface); |
1037 | + d->buffer_surface = buffer_surface; |
1038 | + d->cr = cairo_create (surface); |
1039 | |
1040 | - format = get_format_for_drawable (d, GDK_DRAWABLE (d->buffer_pixmap)); |
1041 | - d->picture = XRenderCreatePicture (xdisplay, GDK_PIXMAP_XID (buffer_pixmap), |
1042 | + format = get_format_for_surface (d, d->buffer_surface); |
1043 | + d->picture = XRenderCreatePicture (xdisplay, cairo_xlib_surface_get_drawable (buffer_surface), |
1044 | format, 0, NULL); |
1045 | |
1046 | d->width = width; |
1047 | |
1048 | === modified file 'gtk/window-decorator/tests/CMakeLists.txt' |
1049 | --- gtk/window-decorator/tests/CMakeLists.txt 2013-05-14 07:07:45 +0000 |
1050 | +++ gtk/window-decorator/tests/CMakeLists.txt 2014-09-10 12:50:41 +0000 |
1051 | @@ -126,6 +126,7 @@ |
1052 | compiz_discover_tests (compiz_test_gwd_cairo_decorations COVERAGE |
1053 | gtk_window_decorator_cairo_window_decoration_util) |
1054 | |
1055 | + if (METACITY_FOUND) |
1056 | add_executable (compiz_test_gwd_metacity_decorations |
1057 | ${CMAKE_CURRENT_SOURCE_DIR}/test_gwd_metacity_decorations.cpp) |
1058 | |
1059 | @@ -139,5 +140,6 @@ |
1060 | |
1061 | compiz_discover_tests (compiz_test_gwd_metacity_decorations COVERAGE |
1062 | gtk_window_decorator_metacity_window_decoration_util) |
1063 | + endif (METACITY_FOUND) |
1064 | |
1065 | endif (COMPIZ_TEST_GTK_WINDOW_DECORATOR_FOUND) |
1066 | |
1067 | === modified file 'gtk/window-decorator/tooltip.c' |
1068 | --- gtk/window-decorator/tooltip.c 2011-02-21 09:53:08 +0000 |
1069 | +++ gtk/window-decorator/tooltip.c 2014-09-10 12:50:41 +0000 |
1070 | @@ -130,14 +130,15 @@ |
1071 | } |
1072 | |
1073 | static gint |
1074 | -tooltip_paint_window (GtkWidget *tooltip) |
1075 | +tooltip_paint_window (GtkWidget *tooltip, |
1076 | + cairo_t *cr) |
1077 | { |
1078 | GtkRequisition req; |
1079 | |
1080 | gtk_widget_size_request (tip_window, &req); |
1081 | - gtk_paint_flat_box (tip_window->style, tip_window->window, |
1082 | + gtk_paint_flat_box (gtk_widget_get_style (tip_window), cr, |
1083 | GTK_STATE_NORMAL, GTK_SHADOW_OUT, |
1084 | - NULL, GTK_WIDGET (tip_window), "tooltip", |
1085 | + GTK_WIDGET (tip_window), "tooltip", |
1086 | 0, 0, req.width, req.height); |
1087 | |
1088 | return FALSE; |
1089 | @@ -153,14 +154,11 @@ |
1090 | gtk_widget_set_name (tip_window, "gtk-tooltips"); |
1091 | gtk_container_set_border_width (GTK_CONTAINER (tip_window), 4); |
1092 | |
1093 | -#if GTK_CHECK_VERSION (2, 10, 0) |
1094 | - if (!gtk_check_version (2, 10, 0)) |
1095 | - gtk_window_set_type_hint (GTK_WINDOW (tip_window), |
1096 | - GDK_WINDOW_TYPE_HINT_TOOLTIP); |
1097 | -#endif |
1098 | + gtk_window_set_type_hint (GTK_WINDOW (tip_window), |
1099 | + GDK_WINDOW_TYPE_HINT_TOOLTIP); |
1100 | |
1101 | g_signal_connect_swapped (tip_window, |
1102 | - "expose_event", |
1103 | + "draw", |
1104 | G_CALLBACK (tooltip_paint_window), |
1105 | 0); |
1106 | |
1107 | |
1108 | === modified file 'gtk/window-decorator/wnck.c' |
1109 | --- gtk/window-decorator/wnck.c 2013-09-27 16:21:43 +0000 |
1110 | +++ gtk/window-decorator/wnck.c 2014-09-10 12:50:41 +0000 |
1111 | @@ -56,7 +56,7 @@ |
1112 | 0L, 1024L, FALSE, XA_ATOM, &actual, &format, |
1113 | &n, &left, &data); |
1114 | gdk_flush (); |
1115 | - gdk_error_trap_pop (); |
1116 | + gdk_error_trap_pop_ignored (); |
1117 | |
1118 | if (result == Success && data) |
1119 | { |
1120 | @@ -254,7 +254,7 @@ |
1121 | |
1122 | if (action_menu_mapped) |
1123 | { |
1124 | - gtk_object_destroy (GTK_OBJECT (action_menu)); |
1125 | + gtk_widget_destroy (action_menu); |
1126 | return; |
1127 | } |
1128 | |
1129 | @@ -321,19 +321,11 @@ |
1130 | |
1131 | if (mode) |
1132 | { |
1133 | - GdkColormap *colormap; |
1134 | - |
1135 | d->frame_window = create_gdk_window (frame); |
1136 | d->decor_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); |
1137 | - |
1138 | - colormap = get_colormap_for_drawable (GDK_DRAWABLE (d->frame_window)); |
1139 | - |
1140 | d->decor_image = gtk_image_new (); |
1141 | - |
1142 | - gtk_widget_set_colormap (d->decor_window, colormap); |
1143 | - gtk_widget_set_colormap (d->decor_image, colormap); |
1144 | - |
1145 | d->decor_event_box = gtk_event_box_new (); |
1146 | + |
1147 | gtk_event_box_set_visible_window (GTK_EVENT_BOX (d->decor_event_box), |
1148 | FALSE); |
1149 | gtk_widget_set_events (d->decor_event_box, GDK_BUTTON_PRESS_MASK | |
1150 | @@ -465,6 +457,8 @@ |
1151 | { |
1152 | int i, j; |
1153 | |
1154 | + gdk_error_trap_push (); |
1155 | + |
1156 | for (i = 0; i < 3; ++i) |
1157 | { |
1158 | for (j = 0; j < 3; ++j) |
1159 | @@ -481,18 +475,20 @@ |
1160 | |
1161 | d->button_states[i] = 0; |
1162 | } |
1163 | - } |
1164 | - |
1165 | - if (d->pixmap) |
1166 | - { |
1167 | - g_object_unref (G_OBJECT (d->pixmap)); |
1168 | - d->pixmap = NULL; |
1169 | - } |
1170 | - |
1171 | - if (d->buffer_pixmap) |
1172 | - { |
1173 | - g_object_unref (G_OBJECT (d->buffer_pixmap)); |
1174 | - d->buffer_pixmap = NULL; |
1175 | + |
1176 | + gdk_error_trap_pop_ignored (); |
1177 | + } |
1178 | + |
1179 | + if (d->surface) |
1180 | + { |
1181 | + cairo_surface_destroy (d->surface); |
1182 | + d->surface = NULL; |
1183 | + } |
1184 | + |
1185 | + if (d->buffer_surface) |
1186 | + { |
1187 | + cairo_surface_destroy (d->buffer_surface); |
1188 | + d->buffer_surface = NULL; |
1189 | } |
1190 | |
1191 | if (d->cr) |
1192 | @@ -525,10 +521,10 @@ |
1193 | d->icon = NULL; |
1194 | } |
1195 | |
1196 | - if (d->icon_pixmap) |
1197 | + if (d->icon_surface) |
1198 | { |
1199 | - g_object_unref (G_OBJECT (d->icon_pixmap)); |
1200 | - d->icon_pixmap = NULL; |
1201 | + cairo_surface_destroy (d->icon_surface); |
1202 | + d->icon_surface = NULL; |
1203 | } |
1204 | |
1205 | if (d->icon_pixbuf) |
1206 | @@ -578,7 +574,7 @@ |
1207 | gdk_error_trap_push (); |
1208 | XDeleteProperty (xdisplay, wnck_window_get_xid (win), win_decor_atom); |
1209 | gdk_display_sync (gdk_display_get_default ()); |
1210 | - gdk_error_trap_pop (); |
1211 | + gdk_error_trap_pop_ignored (); |
1212 | |
1213 | d->width = 0; |
1214 | d->height = 0; |
1215 | @@ -690,7 +686,7 @@ |
1216 | if (d->win != NULL && |
1217 | !request_update_window_decoration_size (d->win) && |
1218 | d->decorated && |
1219 | - d->pixmap) |
1220 | + d->surface) |
1221 | queue_decor_draw (d); |
1222 | |
1223 | } |
1224 | @@ -759,7 +755,7 @@ |
1225 | if (d->win != NULL && |
1226 | !request_update_window_decoration_size (d->win) && |
1227 | d->decorated && |
1228 | - d->pixmap) |
1229 | + d->surface) |
1230 | queue_decor_draw (d); |
1231 | |
1232 | } |
1233 | @@ -811,9 +807,9 @@ |
1234 | d->draw = theme_draw_window_decoration; |
1235 | |
1236 | d->created = FALSE; |
1237 | - d->pixmap = NULL; |
1238 | + d->surface = NULL; |
1239 | d->cr = NULL; |
1240 | - d->buffer_pixmap = NULL; |
1241 | + d->buffer_surface = NULL; |
1242 | d->picture = None; |
1243 | |
1244 | connect_window (win); |
I think this is more or less ready for review.
Currently it is crashing every time when minimizing window. I am not sure how to properly debug x errors, but seems error is caused by calling XDestroyWindow in remove_frame_window function in wnck.c.
Adding error trap makes decorator to not crash, but gdk_error_trap_pop is returning BadWindow error code (parameter not a Window).