Merge lp:~smspillaz/compiz-core/compiz-core.fix_930071 into lp:compiz-core

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 2996
Proposed branch: lp:~smspillaz/compiz-core/compiz-core.fix_930071
Merge into: lp:compiz-core
Diff against target: 180 lines (+36/-33)
2 files modified
gtk/window-decorator/events.c (+1/-9)
gtk/window-decorator/wnck.c (+35/-24)
To merge this branch: bzr merge lp:~smspillaz/compiz-core/compiz-core.fix_930071
Reviewer Review Type Date Requested Status
Alan Griffiths Approve
Review via email: mp+92434@code.launchpad.net

Description of the change

Fixes LP #930071

There's a race condition in gtk-window-decorator that would cause some windows to be updated before the decoration was fully realized

To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

LGTM (Although most of the diff is unrelated tidy-up)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'gtk/window-decorator/events.c'
--- gtk/window-decorator/events.c 2011-10-13 12:22:14 +0000
+++ gtk/window-decorator/events.c 2012-02-10 10:30:27 +0000
@@ -885,14 +885,12 @@
885 GdkEvent *event,885 GdkEvent *event,
886 gpointer data)886 gpointer data)
887{887{
888 Display *xdisplay;
889 GdkDisplay *gdkdisplay;888 GdkDisplay *gdkdisplay;
890 XEvent *xevent = gdkxevent;889 XEvent *xevent = gdkxevent;
891 gulong xid = 0;890 gulong xid = 0;
892 Window select = 0;891 Window select = 0;
893892
894 gdkdisplay = gdk_display_get_default ();893 gdkdisplay = gdk_display_get_default ();
895 xdisplay = GDK_DISPLAY_XDISPLAY (gdkdisplay);
896894
897 switch (xevent->type) {895 switch (xevent->type) {
898 case CreateNotify:896 case CreateNotify:
@@ -1018,13 +1016,7 @@
1018 }1016 }
1019 else1017 else
1020 {1018 {
1021 gwd_decor_frame_unref (d->frame);1019 remove_frame_window (win);
1022 d->frame = NULL;
1023
1024 gdk_error_trap_push ();
1025 XDeleteProperty (xdisplay, xid, win_decor_atom);
1026 gdk_display_sync (gdk_display_get_default ());
1027 gdk_error_trap_pop ();
1028 }1020 }
1029 }1021 }
1030 }1022 }
10311023
=== modified file 'gtk/window-decorator/wnck.c'
--- gtk/window-decorator/wnck.c 2011-10-13 09:53:38 +0000
+++ gtk/window-decorator/wnck.c 2012-02-10 10:30:27 +0000
@@ -588,25 +588,28 @@
588 if (d && d->pixmap)588 if (d && d->pixmap)
589 {589 {
590 d->active = wnck_window_is_active (win);590 d->active = wnck_window_is_active (win);
591
592 decor_frame_t *frame = d->decorated ? d->frame : gwd_get_decor_frame (get_frame_type (win));
593
591 if ((d->state & META_MAXIMIZED) == META_MAXIMIZED)594 if ((d->state & META_MAXIMIZED) == META_MAXIMIZED)
592 {595 {
593 if (!d->frame_window)596 if (!d->frame_window)
594 {597 {
595 if (d->active)598 if (d->active)
596 {599 {
597 d->context = &d->frame->max_window_context_active;600 d->context = &frame->max_window_context_active;
598 d->shadow = d->frame->max_border_shadow_active;601 d->shadow = frame->max_border_shadow_active;
599 }602 }
600 else603 else
601 {604 {
602 d->context = &d->frame->max_window_context_inactive;605 d->context = &frame->max_window_context_inactive;
603 d->shadow = d->frame->max_border_shadow_inactive;606 d->shadow = frame->max_border_shadow_inactive;
604 }607 }
605 }608 }
606 else609 else
607 {610 {
608 d->shadow = d->frame->max_border_no_shadow;611 d->shadow = d->frame->max_border_no_shadow;
609 }612 }
610 }613 }
611 else614 else
612 {615 {
@@ -614,13 +617,13 @@
614 {617 {
615 if (d->active)618 if (d->active)
616 {619 {
617 d->context = &d->frame->window_context_active;620 d->context = &frame->window_context_active;
618 d->shadow = d->frame->border_shadow_active;621 d->shadow = frame->border_shadow_active;
619 }622 }
620 else623 else
621 {624 {
622 d->context = &d->frame->window_context_inactive;625 d->context = &frame->window_context_inactive;
623 d->shadow = d->frame->border_shadow_inactive;626 d->shadow = frame->border_shadow_inactive;
624 }627 }
625 }628 }
626 else629 else
@@ -629,13 +632,16 @@
629 }632 }
630 }633 }
631634
635 if (!d->decorated)
636 gwd_decor_frame_unref (frame);
637
632 /* We need to update the decoration size here638 /* We need to update the decoration size here
633 * since the shadow size might have changed and639 * since the shadow size might have changed and
634 * in that case the decoration will be redrawn,640 * in that case the decoration will be redrawn,
635 * however if the shadow size doesn't change641 * however if the shadow size doesn't change
636 * then we need to redraw the decoration anyways642 * then we need to redraw the decoration anyways
637 * since the image would have changed */643 * since the image would have changed */
638 if (!update_window_decoration_size (d->win))644 if (!update_window_decoration_size (d->win) && d->decorated)
639 queue_decor_draw (d);645 queue_decor_draw (d);
640646
641 }647 }
@@ -649,24 +655,26 @@
649 {655 {
650 d->active = wnck_window_is_active (win);656 d->active = wnck_window_is_active (win);
651657
658 decor_frame_t *frame = d->decorated ? d->frame : gwd_get_decor_frame (get_frame_type (win));
659
652 if ((d->state & META_MAXIMIZED) == META_MAXIMIZED)660 if ((d->state & META_MAXIMIZED) == META_MAXIMIZED)
653 {661 {
654 if (!d->frame_window)662 if (!d->frame_window)
655 {663 {
656 if (d->active)664 if (d->active)
657 {665 {
658 d->context = &d->frame->max_window_context_active;666 d->context = &frame->max_window_context_active;
659 d->shadow = d->frame->max_border_shadow_active;667 d->shadow = frame->max_border_shadow_active;
660 }668 }
661 else669 else
662 {670 {
663 d->context = &d->frame->max_window_context_inactive;671 d->context = &frame->max_window_context_inactive;
664 d->shadow = d->frame->max_border_shadow_inactive;672 d->shadow = frame->max_border_shadow_inactive;
665 }673 }
666 }674 }
667 else675 else
668 {676 {
669 d->shadow = d->frame->max_border_no_shadow;677 d->shadow = frame->max_border_no_shadow;
670 }678 }
671 }679 }
672 else680 else
@@ -675,28 +683,31 @@
675 {683 {
676 if (d->active)684 if (d->active)
677 {685 {
678 d->context = &d->frame->window_context_active;686 d->context = &frame->window_context_active;
679 d->shadow = d->frame->border_shadow_active;687 d->shadow = frame->border_shadow_active;
680 }688 }
681 else689 else
682 {690 {
683 d->context = &d->frame->window_context_inactive;691 d->context = &frame->window_context_inactive;
684 d->shadow = d->frame->border_shadow_inactive;692 d->shadow = frame->border_shadow_inactive;
685 }693 }
686 }694 }
687 else695 else
688 {696 {
689 d->shadow = d->frame->border_no_shadow;697 d->shadow = frame->border_no_shadow;
690 }698 }
691 }699 }
692700
701 if (!d->decorated)
702 gwd_decor_frame_unref (frame);
703
693 /* We need to update the decoration size here704 /* We need to update the decoration size here
694 * since the shadow size might have changed and705 * since the shadow size might have changed and
695 * in that case the decoration will be redrawn,706 * in that case the decoration will be redrawn,
696 * however if the shadow size doesn't change707 * however if the shadow size doesn't change
697 * then we need to redraw the decoration anyways708 * then we need to redraw the decoration anyways
698 * since the image would have changed */709 * since the image would have changed */
699 if (!update_window_decoration_size (d->win))710 if (!update_window_decoration_size (d->win) && d->decorated)
700 queue_decor_draw (d);711 queue_decor_draw (d);
701712
702 }713 }

Subscribers

People subscribed via source and target branches