[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[XForms] fdesign replace menu and formbrowser recompute max_width patche
From: |
SBP |
Subject: |
[XForms] fdesign replace menu and formbrowser recompute max_width patches |
Date: |
Mon, 10 Oct 2016 20:37:13 -0500 |
Hi there!
I include here two patches for your consideration.
The first one fixes a bug wherein replacing a menu item in fdesign
causes a segfault.
<<PATCH
--- sp_menu.c~ 2013-12-14 07:25:52.000000000 -0600
+++ sp_menu.c 2016-10-10 19:15:47.711711103 -0500
@@ -436,7 +436,7 @@
fl_replace_menu_item( curobj, k, s );
- fl_set_menu_item_shortcut( menu_attrib->vdata, k, sc );
+ fl_set_menu_item_shortcut( curobj, k, sc );
fl_set_menu_item_mode( curobj, k, get_pupmode_value( mode ) );
PATCH
The second one recomputes the formbrowser max_width after deletion of a
form. It is consistent to recompute max_width to the maximum of all
form widths, as adding a form sets it this way. I couldn't find another
way to reset max_width, and I need this because I'm resizing forms
inside a formbrowser and I want the scrollbars to match the size of the
form.
<<PATCH
--- formbrowser.c~ 2013-12-10 03:02:09.000000000 -0600
+++ formbrowser.c 2016-10-10 20:19:22.718870954 -0500
@@ -1000,10 +1000,16 @@
delete_form( FLI_FORMBROWSER_SPEC * sp,
int f )
{
+ int i;
+
fl_hide_form( sp->form[ f ] );
sp->form[ f ]->attached = 0;
sp->nforms--;
sp->max_height -= sp->form[ f ]->h;
+ sp->max_width = 0;
+ for ( i = 0; i < sp->nforms; i++ )
+ if( sp->form[ f ]->w > sp->max_width )
+ sp->max_width = sp->form[ f ]->w;
for ( ; f < sp->nforms; f++ )
sp->form[ f ] = sp->form[ f + 1 ];
sp->form = fl_realloc( sp->form, sizeof *sp->form * sp->nforms );
PATCH
Hope you find these useful and they get upstream!
Cheers!
Sirius
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [XForms] fdesign replace menu and formbrowser recompute max_width patches,
SBP <=