GitLab Commit is coming up on August 3-4. Learn how to innovate together using GitLab, the DevOps platform. Register for free: gitlabcommitvirtual2021.com

Commit 526919c9 authored by Benoît Minisini's avatar Benoît Minisini
Browse files

Workaround GTK+ layouting errors on TabStrip.

[GB.GTK3]
* BUG: Workaround GTK+ layouting errors on TabStrip.
parent 7c560505
Pipeline #212985207 passed with stage
in 23 minutes and 11 seconds
......@@ -512,11 +512,10 @@ int gContainer::clientWidth()
if ((width() != a.width || height() != a.height)
&& a.width > 0 && a.height > 0)
{
//g_debug("clientWidth: %s: %d", name(), width());
a.x = x(); a.y = y(); a.width = width(); a.height = height();
gt_disable_warnings(true);
//gt_disable_warnings(true);
gtk_widget_size_allocate(widget, &a);
gt_disable_warnings(false);
//gt_disable_warnings(false);
}
//g_debug("ClientWidth: %s -> %d", this->name(), cont->allocation.width);
......
......@@ -1710,7 +1710,7 @@ static bool must_patch(GtkWidget *widget)
GtkWidget *parent;
gControl *parent_control;
if (GTK_IS_ENTRY(widget))
if (GTK_IS_ENTRY(widget) || GTK_IS_FIXED(widget))
return true;
if (gt_get_control(widget))
......@@ -1950,6 +1950,35 @@ PATCH_DECLARE_BASELINE(GTK_TYPE_BUTTON)
return size;
}*/
void gt_patch_control(GtkWidget *border, GtkWidget *widget)
{
PATCH_CLASS(border, GTK_TYPE_WINDOW)
else PATCH_CLASS_BASELINE(border, GTK_TYPE_ENTRY)
else PATCH_CLASS_BASELINE(border, GTK_TYPE_SPIN_BUTTON)
else PATCH_CLASS_BASELINE(border, GTK_TYPE_BUTTON)
else PATCH_CLASS(border, GTK_TYPE_FIXED)
else PATCH_CLASS(border, GTK_TYPE_EVENT_BOX)
//else PATCH_CLASS(border, GTK_TYPE_ALIGNMENT)
else PATCH_CLASS(border, GTK_TYPE_BOX)
else PATCH_CLASS(border, GTK_TYPE_TOGGLE_BUTTON)
else PATCH_CLASS(border, GTK_TYPE_SCROLLED_WINDOW)
else PATCH_CLASS(border, GTK_TYPE_CHECK_BUTTON)
else PATCH_CLASS(border, GTK_TYPE_RADIO_BUTTON)
else PATCH_CLASS(border, GTK_TYPE_NOTEBOOK)
else PATCH_CLASS(border, GTK_TYPE_SOCKET)
else PATCH_CLASS(border, GTK_TYPE_TEXT_VIEW)
else PATCH_CLASS(border, GTK_TYPE_SCROLLBAR)
else PATCH_CLASS(border, GTK_TYPE_SCALE)
else
fprintf(stderr, "gb.gtk3: warning: class %s was not patched\n", G_OBJECT_TYPE_NAME(border));
if (!widget)
return;
PATCH_CLASS_BASELINE(widget, GTK_TYPE_COMBO_BOX)
else PATCH_CLASS(widget, GTK_TYPE_TEXT_VIEW)
}
#endif
void gControl::realize(bool make_frame)
......@@ -1994,32 +2023,7 @@ void gControl::realize(bool make_frame)
//fprintf(stderr, "realize: %p %p\n", border, widget);
#ifdef GTK3
PATCH_CLASS(border, GTK_TYPE_WINDOW)
else PATCH_CLASS_BASELINE(border, GTK_TYPE_ENTRY)
else PATCH_CLASS_BASELINE(border, GTK_TYPE_SPIN_BUTTON)
else PATCH_CLASS_BASELINE(border, GTK_TYPE_BUTTON)
else PATCH_CLASS(border, GTK_TYPE_FIXED)
else PATCH_CLASS(border, GTK_TYPE_EVENT_BOX)
//else PATCH_CLASS(border, GTK_TYPE_ALIGNMENT)
else PATCH_CLASS(border, GTK_TYPE_BOX)
else PATCH_CLASS(border, GTK_TYPE_TOGGLE_BUTTON)
else PATCH_CLASS(border, GTK_TYPE_SCROLLED_WINDOW)
else PATCH_CLASS(border, GTK_TYPE_CHECK_BUTTON)
else PATCH_CLASS(border, GTK_TYPE_RADIO_BUTTON)
else PATCH_CLASS(border, GTK_TYPE_NOTEBOOK)
else PATCH_CLASS(border, GTK_TYPE_SOCKET)
else PATCH_CLASS(border, GTK_TYPE_TEXT_VIEW)
else PATCH_CLASS(border, GTK_TYPE_SCROLLBAR)
else PATCH_CLASS(border, GTK_TYPE_SCALE)
else
{
fprintf(stderr, "gb.gtk3: warning: class %s was not patched\n", G_OBJECT_TYPE_NAME(border));
}
PATCH_CLASS_BASELINE(widget, GTK_TYPE_COMBO_BOX)
else PATCH_CLASS(widget, GTK_TYPE_TEXT_VIEW)
gt_patch_control(border, widget);
#endif
connectParent();
......
......@@ -30,6 +30,8 @@
class gContainer;
class gMainWindow;
void gt_patch_control(GtkWidget *border, GtkWidget *widget);
class gControl
{
public:
......
......@@ -805,6 +805,8 @@ void gMenu::doPopup(bool move, int x, int y)
GdkWindow *window;
GdkRectangle rect;
gt_disable_warnings(true);
if (move)
{
window = gdk_get_default_root_window(); //gdk_event_get_window(gApplication::lastEvent());
......@@ -821,6 +823,8 @@ void gMenu::doPopup(bool move, int x, int y)
else
gtk_menu_popup_at_pointer(_popup, gApplication::lastEvent());
gt_disable_warnings(false);
#else
MenuPosition *pos = NULL;
......
......@@ -154,7 +154,6 @@ void gSlider::updateMark()
void gSlider::setMark(bool vl)
{
if (vl == _mark) return;
_mark = vl;
......@@ -184,6 +183,9 @@ void gSlider::setPageStep(int vl)
void gSlider::setMax(int vl)
{
if (vl == _max)
return;
_max = vl;
if (_min > _max)
_min = _max;
......@@ -193,6 +195,9 @@ void gSlider::setMax(int vl)
void gSlider::setMin(int vl)
{
if (vl == _min)
return;
_min = vl;
if (_min > _max)
_max = _min;
......
......@@ -254,7 +254,7 @@ gTabStripPage::gTabStripPage(gTabStrip *tab)
//fix = gtk_event_box_new();
hbox = gtk_hbox_new(false, 4);
hbox = gtk_hbox_new(false, gDesktop::scale() * 3 / 4);
fix = hbox;
//gtk_box_set_spacing(GTK_BOX(hbox), 4);
//gtk_container_add(GTK_CONTAINER(fix), hbox);
......@@ -275,6 +275,8 @@ gTabStripPage::gTabStripPage(gTabStrip *tab)
g_object_ref(widget);
g_object_ref(fix);
gt_patch_control(widget, NULL);
_visible = false;
_picture = NULL;
......
......@@ -1590,8 +1590,8 @@ void gt_pixbuf_make_gray(GdkPixbuf *pixbuf)
static void disabled_handler(const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer data)
{
// Print only debugging messages
if (log_level & G_LOG_LEVEL_DEBUG)
g_log_default_handler(log_domain, log_level, message, data);
//if (log_level & G_LOG_LEVEL_DEBUG)
// g_log_default_handler(log_domain, log_level, message, data);
}
static GLogFunc old_handler = NULL;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment