diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2018-03-19 19:56:15 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2018-03-19 19:56:15 +0100 |
commit | 1542c122b3672fe83e027411ad2445772e2d0ed3 (patch) | |
tree | e535bc621bd7ffa9d5ce89e0d495df5d1c4ab6fd /app/wlib/gtklib/control.c | |
parent | 773810e6583142d7d15263e6481c42aebed6d7f1 (diff) | |
parent | d1a8285f818eb7e5c3d6a05709ea21a808490b8c (diff) |
Update upstream source from tag 'upstream/5.1.0'
Update to upstream version '5.1.0'
with Debian dir 93ca74b8b4602fce4c9c7740e0cfdde25f086673
Diffstat (limited to 'app/wlib/gtklib/control.c')
-rw-r--r-- | app/wlib/gtklib/control.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/app/wlib/gtklib/control.c b/app/wlib/gtklib/control.c index e824c94..c891924 100644 --- a/app/wlib/gtklib/control.c +++ b/app/wlib/gtklib/control.c @@ -109,7 +109,9 @@ wPos_t wLabelWidth( GtkRequisition requisition; widget = gtk_label_new(wlibConvertInput(label)); gtk_widget_size_request(widget, &requisition); + g_object_ref_sink (widget); gtk_widget_destroy(widget); + g_object_unref(widget); return requisition.width+8; } @@ -162,7 +164,7 @@ wPos_t wControlGetPosX( wPos_t wControlGetPosY( wControl_p b) /* Control */ { - return b->realY - BORDERSIZE - ((b->parent->option&F_MENUBAR)?MENUH:0); + return b->realY - BORDERSIZE - ((b->parent->option&F_MENUBAR)?b->parent->menu_height:0); } /** @@ -179,15 +181,21 @@ void wControlSetPos( wPos_t y) { b->realX = x; - b->realY = y + BORDERSIZE + ((b->parent->option&F_MENUBAR)?MENUH:0); + b->realY = y + BORDERSIZE + ((b->parent->option&F_MENUBAR)?b->parent->menu_height:0); if (b->widget) { gtk_fixed_move(GTK_FIXED(b->parent->widget), b->widget, b->realX, b->realY); } if (b->label) { + GtkRequisition requisition, reqwidget; + gtk_widget_size_request(b->label, &requisition); + if (b->widget) + gtk_widget_size_request(b->widget, &reqwidget); + else + reqwidget.height = requisition.height; gtk_fixed_move(GTK_FIXED(b->parent->widget), b->label, b->realX-b->labelW, - b->realY+LABEL_OFFSET); + b->realY+(reqwidget.height/2 - requisition.height/2)); } } @@ -202,14 +210,18 @@ void wControlSetLabel( wControl_p b, const char * labelStr) { - GtkRequisition requisition; + GtkRequisition requisition,reqwidget; if (b->label) { gtk_label_set_text(GTK_LABEL(b->label), wlibConvertInput(labelStr)); gtk_widget_size_request(b->label, &requisition); + if (b->widget) + gtk_widget_size_request(b->widget, &reqwidget); + else + reqwidget.height = requisition.height; b->labelW = requisition.width+8; gtk_fixed_move(GTK_FIXED(b->parent->widget), b->label, b->realX-b->labelW, - b->realY+LABEL_OFFSET); + b->realY+(reqwidget.height/2 - requisition.height/2)); } else { b->labelW = wlibAddLabel(b, labelStr); } |