Branch: refs/heads/master
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: Colomban Wendling <ban(a)herbesfolles.org>
Date: Mon, 02 May 2016 13:19:26 UTC
Commit: ead0e9ee5fb6d0242a729f86991c16979ff90fae
https://github.com/geany/geany/commit/ead0e9ee5fb6d0242a729f86991c16979ff90…
Log Message:
-----------
GTK: Fix fetching the frame border width on GTK 3.20
GTK 3.20 introduced a sub-node named "border" to the frame, requiring
to lookup the border on that sub-node rather than on the frame itself.
Unfortunately supporting this requires to be built against GTK 3.20, as
it requires API this version introduced. This means that a build
against an older version won't be able to get the popup sizing right if
running on 3.20. To mitigate this, add reasonable fallback defaults
when running 3.20 but built on an earlier version, to try and avoid
X-Scintilla-Bug-URL: https://sourceforge.net/p/scintilla/bugs/1825/
X-Scintilla-Commit-ID: 83d56b1fc63a206e4c1b776f5991b3b17ccb3473
2px-scrolling on GTK 3.20's default theme.
Modified Paths:
--------------
scintilla/gtk/PlatGTK.cxx
Modified: scintilla/gtk/PlatGTK.cxx
25 lines changed, 24 insertions(+), 1 deletions(-)
===================================================================
@@ -1534,12 +1534,34 @@ PRectangle ListBoxX::GetDesiredRect() {
int row_height = GetRowHeight();
#if GTK_CHECK_VERSION(3,0,0)
GtkStyleContext *styleContextFrame = gtk_widget_get_style_context(PWidget(frame));
- GtkBorder padding, border;
+ GtkBorder padding, border, border_border = { 0, 0, 0, 0 };
gtk_style_context_get_padding(styleContextFrame, GTK_STATE_FLAG_NORMAL, &padding);
gtk_style_context_get_border(styleContextFrame, GTK_STATE_FLAG_NORMAL, &border);
+
+# if GTK_CHECK_VERSION(3,20,0)
+ // on GTK 3.20 the frame border is in a sub-node "border".
+ // Unfortunately we need to be built against 3.20 to be able to support this, as it requires
+ // new API.
+ GtkStyleContext *styleContextFrameBorder = gtk_style_context_new();
+ GtkWidgetPath *widget_path = gtk_widget_path_copy(gtk_style_context_get_path(styleContextFrame));
+ gtk_widget_path_append_type(widget_path, GTK_TYPE_BORDER); // dummy type
+ gtk_widget_path_iter_set_object_name(widget_path, -1, "border");
+ gtk_style_context_set_path(styleContextFrameBorder, widget_path);
+ gtk_widget_path_free(widget_path);
+ gtk_style_context_get_border(styleContextFrameBorder, GTK_STATE_FLAG_NORMAL, &border_border);
+ g_object_unref(styleContextFrameBorder);
+# else // < 3.20
+ if (gtk_check_version(3, 20, 0) == NULL) {
+ // default to 1px all around as it's likely what it is, and so we don't miss 2px height
+ // on GTK 3.20 when built against an earlier version.
+ border_border.top = border_border.bottom = border_border.left = border_border.right = 1;
+ }
+# endif
+
height = (rows * row_height
+ padding.top + padding.bottom
+ border.top + border.bottom
+ + border_border.top + border_border.bottom
+ 2 * gtk_container_get_border_width(GTK_CONTAINER(PWidget(list))));
#else
height = (rows * row_height
@@ -1560,6 +1582,7 @@ PRectangle ListBoxX::GetDesiredRect() {
#if GTK_CHECK_VERSION(3,0,0)
rc.right += (padding.left + padding.right
+ border.left + border.right
+ + border_border.left + border_border.right
+ 2 * gtk_container_get_border_width(GTK_CONTAINER(PWidget(list))));
#else
rc.right += 2 * (PWidget(frame)->style->xthickness
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: Colomban Wendling <ban(a)herbesfolles.org>
Date: Mon, 02 May 2016 13:19:26 UTC
Commit: ba58a391c73024a9b40c638757352e171dd53333
https://github.com/geany/geany/commit/ba58a391c73024a9b40c638757352e171dd53…
Log Message:
-----------
GTK: Get border for the exact current style's state on GTK 3
GTK 3.20 doesn't seem to like it so much when looking up details of a
non-exact current style context state, so use the current one.
This is GTK being really picky as in this case we are just missing the
`DIR_LTR` flag, which we definitely don't care about, but let's make it
happy.
X-Scintilla-Bug-URL: https://sourceforge.net/p/scintilla/bugs/1825/
X-Scintilla-Commit-ID: 9fc624da4a3d935633c45fb56d0e9a77ef9b5af1
Modified Paths:
--------------
scintilla/gtk/PlatGTK.cxx
Modified: scintilla/gtk/PlatGTK.cxx
7 lines changed, 4 insertions(+), 3 deletions(-)
===================================================================
@@ -1550,9 +1550,10 @@ PRectangle ListBoxX::GetDesiredRect() {
int row_height = GetRowHeight();
#if GTK_CHECK_VERSION(3,0,0)
GtkStyleContext *styleContextFrame = gtk_widget_get_style_context(PWidget(frame));
+ GtkStateFlags stateFlagsFrame = gtk_style_context_get_state(styleContextFrame);
GtkBorder padding, border, border_border = { 0, 0, 0, 0 };
- gtk_style_context_get_padding(styleContextFrame, GTK_STATE_FLAG_NORMAL, &padding);
- gtk_style_context_get_border(styleContextFrame, GTK_STATE_FLAG_NORMAL, &border);
+ gtk_style_context_get_padding(styleContextFrame, stateFlagsFrame, &padding);
+ gtk_style_context_get_border(styleContextFrame, stateFlagsFrame, &border);
# if GTK_CHECK_VERSION(3,20,0)
// on GTK 3.20 the frame border is in a sub-node "border".
@@ -1564,7 +1565,7 @@ PRectangle ListBoxX::GetDesiredRect() {
gtk_widget_path_iter_set_object_name(widget_path, -1, "border");
gtk_style_context_set_path(styleContextFrameBorder, widget_path);
gtk_widget_path_free(widget_path);
- gtk_style_context_get_border(styleContextFrameBorder, GTK_STATE_FLAG_NORMAL, &border_border);
+ gtk_style_context_get_border(styleContextFrameBorder, stateFlagsFrame, &border_border);
g_object_unref(styleContextFrameBorder);
# else // < 3.20
if (gtk_check_version(3, 20, 0) == NULL) {
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).