After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 748615 - GtkWindow: Get the correct shadow width even before window is realized
GtkWindow: Get the correct shadow width even before window is realized
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Wayland
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2015-04-29 07:31 UTC by Jonas Ådahl
Modified: 2015-05-07 19:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GtkWindow: Get the correct shadow width even before window is realized (1.39 KB, patch)
2015-04-29 07:31 UTC, Jonas Ådahl
committed Details | Review
Stacktrace resulting in an invalid rectangle (5.08 KB, text/plain)
2015-04-30 00:57 UTC, Jonas Ådahl
  Details
GtkWindow: Manually set CSD should enable shadow width calculation (1.01 KB, patch)
2015-05-07 15:10 UTC, Jonas Ådahl
committed Details | Review

Description Jonas Ådahl 2015-04-29 07:31:12 UTC
This fixes issues I was seeing that could be noticed by the log messages

** BUG ***
In pixman_region32_init_rect: Invalid rectangle passed
Set a breakpoint on '_pixman_log_error' to debug

showing up in terminal.
Comment 1 Jonas Ådahl 2015-04-29 07:31:17 UTC
Created attachment 302543 [details] [review]
GtkWindow: Get the correct shadow width even before window is realized

The window state 'client_decorated' will only be set the window is being
realized. If anyone tries to get the shadow size before that it'd get
the with as if there always was no shadow.

This avoids negative sized opaque regions caused by the allocation being
smaller than shadow.
Comment 2 Matthias Clasen 2015-04-29 10:57:13 UTC
Why does a shadow width of 0 causes invalid rectangles ?
I'd like to see a stacktrace
Comment 3 Jonas Ådahl 2015-04-30 00:57:14 UTC
Created attachment 302623 [details]
Stacktrace resulting in an invalid rectangle

Attaching a stacktrace that happens without the attached patch.

I think the issue may also be caused by incorrect geometry calculation somewhere (resulting in the too small allocation), but that would still result in an incorrect opaque region as it assumes correct shadow width was used when calculating the allocation. It is only when rectangle happens to be small enough that its visible as errors printed to the console.

One could probably also fix by realizing the window earlier, before any geometry calculation is done.
Comment 4 Matthias Clasen 2015-05-06 02:45:17 UTC
Review of attachment 302543 [details] [review]:

after irc discussion: ok
Comment 5 Jonas Ådahl 2015-05-06 13:54:02 UTC
Attachment 302543 [details] pushed as b1e5ad4 - GtkWindow: Get the correct shadow width even before window is realized
Comment 6 Jonas Ådahl 2015-05-07 15:10:48 UTC
Created attachment 303037 [details] [review]
GtkWindow: Manually set CSD should enable shadow width calculation

If CSD is enabled with shadow even though it "shouldn't"*, the width
should still be calculated correctly. This fixes a regression caused by
b1e5ad469c753ea3eed967056ca814ecb0117c7b.

* gtk_window_should_use_csd () returns false
Comment 7 Matthias Clasen 2015-05-07 19:58:41 UTC
Attachment 303037 [details] pushed as 08e2f95 - GtkWindow: Manually set CSD should enable shadow width calculation