-
-
Notifications
You must be signed in to change notification settings - Fork 331
Description
Hi,
I looked at peek because of awesomeWM/awesome#1827. Two things caught my eye:
The following code draws recording view:
peek/src/ui/application-window.vala
Lines 198 to 214 in 6dbf715
[GtkCallback] | |
private bool on_recording_view_draw (Widget widget, Context ctx) { | |
if (screen_supports_alpha) { | |
ctx.set_source_rgba (0.0, 0.0, 0.0, 0.0); | |
} else { | |
ctx.set_source_rgb (0.0, 0.0, 0.0); | |
} | |
// Stance out the transparent inner part | |
ctx.set_operator (Operator.CLEAR); | |
ctx.paint (); | |
ctx.fill (); | |
update_input_shape (); | |
return false; | |
} |
This is equivalent to the following:
ctx.set_operator (Operator.CLEAR);
ctx.paint ();
update_input_shape ();
return false;
If you take the time to understand https://cairographics.org/operators/#clear, you will see that the CLEAR operator does not use the current source, so it makes no difference if the source is completely transparent or is black. This also makes the screen_supports_alpha
variable redundant!
The second change is that I dropped the call to ctx.fill()
. You do not have a current path (no call to e.g. ctx.rectangle
) and thus you are filling the empty path. Filling the empty path has no effect. Also, what effect should it have? paint()
just cleared everything already.
The second thing concerns the use of shapes. You already use the input shape. Why don't you use the clip/bounding shape? https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-input-shape-combine-region
What I mean is basically the following patch:
--- application-window.vala.orig 2017-06-13 09:14:11.374492099 +0200
+++ application-window.vala 2017-06-13 09:14:32.210933971 +0200
@@ -382,6 +382,7 @@ namespace Peek.Ui {
}
this.input_shape_combine_region (window_region);
+ this.shape_combine_region (window_region);
}
private Widget? get_fallback_app_menu () {
Shaped windows also work without a compositing manager and an ARGB visual. I have never used Peek and I am not sure how it works, but the above (when no countdown is running...) could help.
Cheers,
Uli