Re: [Iup-users] Problems with layout (sometimes too small, then too big)

2018-04-10 Thread Eric Wing
On 4/9/18, Antonio Scuri  wrote:
>  Hi,
>
>  I may have solve the problem. At least at the system I was testing were
> the problem is reproduced using that sample it was solved.
>
>  It is on SVN. But it is actually very simple in iupgtk_dialog.c:
>
> #define iupABS(_x) ((_x)<0? -(_x): (_x))
>
> static void gtkDialogGetWindowDecor(Ihandle* ih, int *win_border, int
> *win_caption)
> {
>   int x, y, frame_x, frame_y;
>   gdk_window_get_origin(iupgtkGetWindow(ih->handle), , );
>   gdk_window_get_root_origin(iupgtkGetWindow(ih->handle), _x,
> _y);
>   *win_border = iupABS(x - frame_x);   /* For unknown reason GTK sometimes
> give negative results */
>   *win_caption = iupABS(y - frame_y) - *win_border;
> }
>
>   Let me know if it improves your situation.
>
> Best,
> Scuri
>


I think that might have solved the problem. So far, I have not
experienced the sizing problem. It's wonderful!

I'll continue testing this week, but I'm starting to feel confident
that this fixed this issue.

I really appreciate your efforts in fixing this.

Thanks,
Eric

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Problems with layout (sometimes too small, then too big)

2018-04-09 Thread sur-behoffski

On 04/10/18 02:40, Antonio Scuri wrote:

  Hi,

  I may have solve the problem. At least at the system I was testing were
the problem is reproduced using that sample it was solved.

  It is on SVN. But it is actually very simple in iupgtk_dialog.c:

#define iupABS(_x) ((_x)<0? -(_x): (_x))
[...]


G'day,

Note that this macro evaluates its argument twice, which may be a
problem if its parameter has side effects (e.g. calls a
third-party function, or perhaps is something like iupABS(c++).
Modern compilers are quite capable of inlining short functions,
(I believe that gcc now virtually ignores the "inline" keyword,
and simply uses its own heuristics), and so there would be no loss
of efficiency in coding it as a short function, where it is
guaranteed to only be evaluated once.

Also, there's no need to have an underscore on a argument name
within a macro parameter list, and, while it is valid ISO
C/POSIX.1, my personal preference is to see the underscore-prefix
namespace strictly reserved for external toolchain/OS use, even
in cases such as this where it conforms -- my eyes still do a
double-take.  (See gcc's Info manual, Section 1.3.3, "Reserved
Names", for a detailed discussion of this... there's quite a bit
of stuff there that surprised me, mainly in possible future name
formats that may be claimed by future standards revisions.)

cheers,

s-b etc.

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Problems with layout (sometimes too small, then too big)

2018-04-09 Thread John Spikowski
Great!
I have been chasing that 'chost' for ages.
Thanks Antonio for your amazing efforts with IUP and the community it
has built.
On Mon, 2018-04-09 at 14:10 -0300, Antonio Scuri wrote:
>  Hi,
> 
>  I may have solve the problem. At least at the system I was testing
> were the problem is reproduced using that sample it was solved. 
> 
>  It is on SVN. But it is actually very simple in iupgtk_dialog.c:
> 
> #define iupABS(_x) ((_x)<0? -(_x): (_x))
> 
> static void gtkDialogGetWindowDecor(Ihandle* ih, int *win_border, int
> *win_caption)
> {
>   int x, y, frame_x, frame_y;
>   gdk_window_get_origin(iupgtkGetWindow(ih->handle), , );
>   gdk_window_get_root_origin(iupgtkGetWindow(ih->handle), _x,
> _y);
>   *win_border = iupABS(x - frame_x);   /* For unknown reason GTK
> sometimes give negative results */
>   *win_caption = iupABS(y - frame_y) - *win_border;
> }
> 
>   Let me know if it improves your situation.
> 
> Best,
> Scuri
> 
> 
> 2018-04-04 15:02 GMT-03:00 Antonio Scuri :
> >   At least, for a small difference at the bottom of the dialog I
> > could reproduce it here. It is not always, but much easier to
> > reproduce. I'll let you know the results.
> > 
> > Best,
> > Scuri
> > 
> > 
> > Em qua, 4 de abr de 2018 00:43, Eric Wing 
> > escreveu:
> > > Here's a different sample program that can trigger the bug
> > > (simplified
> > > from a real program that is having problems.) No images this
> > > time, but
> > > only labels. Though there is a IupFill() and MINSIZE that seems
> > > to be
> > > needed to trigger the problem.
> > > 
> > > 
> > >         Ihandle* label_description = IupLabel("Hello World");
> > >         Ihandle* label_identifier = IupLabel("Label: ");
> > > 
> > >         Ihandle* vbox_for_all = IupVbox(
> > >                 label_description,
> > >                 IupFill(),
> > >                 label_identifier,
> > >                 NULL
> > >         );
> > > 
> > >         Ihandle* a_dialog = IupDialog(vbox_for_all);
> > >         IupSetAttribute(a_dialog, "MINSIZE", "400x300");
> > > 
> > >         IupShow(a_dialog);
> > > 
> > > 
> > > 
> > > In the good image, both labels are visible, at the top and bottom
> > > of
> > > the window. In the bad image, the bottom label is not visible.
> > > 
> > > The first set is what the window looks like at launch.
> > > https://blurrrsdk.com/tempdownload/images/IupSizeBugTest2_gooda.p
> > > ng
> > > https://blurrrsdk.com/tempdownload/images/IupSizeBugTest2_bada.pn
> > > g
> > > 
> > > The second set is with the window maximized.
> > > https://blurrrsdk.com/tempdownload/images/IupSizeBugTest2_goodb.p
> > > ng
> > > https://blurrrsdk.com/tempdownload/images/IupSizeBugTest2_badb.pn
> > > g
> > > 
> > > 
> > > 
> > > Thanks,
> > > Eric
> > > 
> > > ---
> > > ---
> > > Check out the vibrant tech community on one of the world's most
> > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > > ___
> > > Iup-users mailing list
> > > Iup-users@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/iup-users
> > > 
> ---
> ---
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Iup-users mailing list
> Iup-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/iup-users--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Problems with layout (sometimes too small, then too big)

2018-04-09 Thread Antonio Scuri
 Hi,

 I may have solve the problem. At least at the system I was testing were
the problem is reproduced using that sample it was solved.

 It is on SVN. But it is actually very simple in iupgtk_dialog.c:

#define iupABS(_x) ((_x)<0? -(_x): (_x))

static void gtkDialogGetWindowDecor(Ihandle* ih, int *win_border, int
*win_caption)
{
  int x, y, frame_x, frame_y;
  gdk_window_get_origin(iupgtkGetWindow(ih->handle), , );
  gdk_window_get_root_origin(iupgtkGetWindow(ih->handle), _x,
_y);
  *win_border = iupABS(x - frame_x);   /* For unknown reason GTK sometimes
give negative results */
  *win_caption = iupABS(y - frame_y) - *win_border;
}

  Let me know if it improves your situation.

Best,
Scuri


2018-04-04 15:02 GMT-03:00 Antonio Scuri :

>   At least, for a small difference at the bottom of the dialog I could
> reproduce it here. It is not always, but much easier to reproduce. I'll let
> you know the results.
>
> Best,
> Scuri
>
>
> Em qua, 4 de abr de 2018 00:43, Eric Wing  escreveu:
>
>> Here's a different sample program that can trigger the bug (simplified
>> from a real program that is having problems.) No images this time, but
>> only labels. Though there is a IupFill() and MINSIZE that seems to be
>> needed to trigger the problem.
>>
>>
>> Ihandle* label_description = IupLabel("Hello World");
>> Ihandle* label_identifier = IupLabel("Label: ");
>>
>> Ihandle* vbox_for_all = IupVbox(
>> label_description,
>> IupFill(),
>> label_identifier,
>> NULL
>> );
>>
>> Ihandle* a_dialog = IupDialog(vbox_for_all);
>> IupSetAttribute(a_dialog, "MINSIZE", "400x300");
>>
>> IupShow(a_dialog);
>>
>>
>>
>> In the good image, both labels are visible, at the top and bottom of
>> the window. In the bad image, the bottom label is not visible.
>>
>> The first set is what the window looks like at launch.
>> https://blurrrsdk.com/tempdownload/images/IupSizeBugTest2_gooda.png
>> https://blurrrsdk.com/tempdownload/images/IupSizeBugTest2_bada.png
>>
>> The second set is with the window maximized.
>> https://blurrrsdk.com/tempdownload/images/IupSizeBugTest2_goodb.png
>> https://blurrrsdk.com/tempdownload/images/IupSizeBugTest2_badb.png
>>
>>
>>
>> Thanks,
>> Eric
>>
>> 
>> --
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> ___
>> Iup-users mailing list
>> Iup-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/iup-users
>>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Problems with layout (sometimes too small, then too big)

2018-04-04 Thread Antonio Scuri
  At least, for a small difference at the bottom of the dialog I could
reproduce it here. It is not always, but much easier to reproduce. I'll let
you know the results.

Best,
Scuri


Em qua, 4 de abr de 2018 00:43, Eric Wing  escreveu:

> Here's a different sample program that can trigger the bug (simplified
> from a real program that is having problems.) No images this time, but
> only labels. Though there is a IupFill() and MINSIZE that seems to be
> needed to trigger the problem.
>
>
> Ihandle* label_description = IupLabel("Hello World");
> Ihandle* label_identifier = IupLabel("Label: ");
>
> Ihandle* vbox_for_all = IupVbox(
> label_description,
> IupFill(),
> label_identifier,
> NULL
> );
>
> Ihandle* a_dialog = IupDialog(vbox_for_all);
> IupSetAttribute(a_dialog, "MINSIZE", "400x300");
>
> IupShow(a_dialog);
>
>
>
> In the good image, both labels are visible, at the top and bottom of
> the window. In the bad image, the bottom label is not visible.
>
> The first set is what the window looks like at launch.
> https://blurrrsdk.com/tempdownload/images/IupSizeBugTest2_gooda.png
> https://blurrrsdk.com/tempdownload/images/IupSizeBugTest2_bada.png
>
> The second set is with the window maximized.
> https://blurrrsdk.com/tempdownload/images/IupSizeBugTest2_goodb.png
> https://blurrrsdk.com/tempdownload/images/IupSizeBugTest2_badb.png
>
>
>
> Thanks,
> Eric
>
>
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Iup-users mailing list
> Iup-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Problems with layout (sometimes too small, then too big)

2018-04-03 Thread Eric Wing
Here's a different sample program that can trigger the bug (simplified
from a real program that is having problems.) No images this time, but
only labels. Though there is a IupFill() and MINSIZE that seems to be
needed to trigger the problem.


Ihandle* label_description = IupLabel("Hello World");
Ihandle* label_identifier = IupLabel("Label: ");

Ihandle* vbox_for_all = IupVbox(
label_description,
IupFill(),
label_identifier,
NULL
);

Ihandle* a_dialog = IupDialog(vbox_for_all);
IupSetAttribute(a_dialog, "MINSIZE", "400x300");

IupShow(a_dialog);



In the good image, both labels are visible, at the top and bottom of
the window. In the bad image, the bottom label is not visible.

The first set is what the window looks like at launch.
https://blurrrsdk.com/tempdownload/images/IupSizeBugTest2_gooda.png
https://blurrrsdk.com/tempdownload/images/IupSizeBugTest2_bada.png

The second set is with the window maximized.
https://blurrrsdk.com/tempdownload/images/IupSizeBugTest2_goodb.png
https://blurrrsdk.com/tempdownload/images/IupSizeBugTest2_badb.png



Thanks,
Eric

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Problems with layout (sometimes too small, then too big)

2018-04-02 Thread Chris Matzenbach via Iup-users
Hi,

For what it is worth, I have installed Arch linux on three separate
machines in the past month, and on each one I have encountered this error.
On some setups I had just gtk2 installed prior to this error, and on others
I had both gtk2 and 3 installed.  Testing it on my laptop running Arch
right now, I opened the program 10 times, the first 9 times were fine but
the 10th time resulted in the error being discussed.  Point being, it seems
easier to trigger this issue on Arch than other distros, and maybe it's
worth trying in a VM (though it can be a pain to install, maybe an
third-party automatic installer could be used).  I don't know why this is.

Let me know if there's anything I can do to help.

Best,
Chris Matzenbach

2018-03-27 17:35 GMT-05:00 Eric Wing :

> On 3/16/18, Antonio Scuri  wrote:
> >   Hi,
> >
> >   Don't worry I'll not give up on this. But I need a more concrete
> > situation. My tests are in an already slow virtual machine.
> >
>
> Thank you for not giving up on me. I appreciate it!
> Sorry for the delay. I've been sidetracked on other problems.
>
> FYI, that video recording was of an Ubuntu inside Virtual Box. (But
> I've had the problem on native machines too.)
>
> >   I was thinking, would be interesting to analyze the dialog when the
> > problem occur.
> >
> >   Does it happens for which elements? Only a set of elements have
> problems?
> >
>
> I will do more tests with other elements. My original app actually was
> a z-box with 4 different screens. The button demo I sent was a
> reduction of that app. The other 3 layers contained mostly buttons,
> drop-down lists, text fields, and labels.
>
> I will try to make some new tests that have just those elements and
> see what happens.
>
> >   The dialog of the sample contains text with expand, and the initial
> > display seems to be correct for the dialog contents, if the dialog was
> > shown with that size. I mean the problem could be at the IupDialog only.
> >
> >   But I don't know what can cause the internal size to be different that
> > the initial size. Maybe it is some control initial size that is expanding
> > the dialog, that's why I would like to know if it is some class of
> controls
> > that is causing the wrong initial size.
> >
>
> So as a new data point, I accidentally stumbled on this bug again in a
> different test. This test is just a single label and webview. I
> captured this on my Raspberry Pi 2 which is using the GTK3 backend.
> I've linked the good picture and bad. (The Pi seems good at triggering
> this bug.)
>
> https://blurrrsdk.com/tempdownload/images/IupWebGoodSize.png
> https://blurrrsdk.com/tempdownload/images/IupWebBadSize.png
>
> This is the program:
>
> Ihandle* the_label = IupLabel("Hello World!");
> Ihandle* web_view = IupWebBrowser();
> IupSetAttribute(web_view, "VALUE", "https://www.google.com;);
> Ihandle* v_box = IupVbox(the_label, web_view, NULL);
> Ihandle* the_dialog = IupDialog(v_box);
> IupSetAttribute(the_dialog, "TITLE", "Blurrr Iup C");
> IupSetAttribute(the_dialog, "SIZE", "HALFxHALF");
> // For Microsoft Windows: This will set the title bar icon to the
> application icon.
> IupSetAttribute(the_dialog, "ICON", "IDI_ICON1");
> IupShow(the_dialog);
>
>
>
> >   Another thing to be considered is that the only wrong situation is the
> > initial size, once the dialog is shown, the layout is actually correct.
> > When the dialog is resized by the user, all the elements are correctly
> > positioned, right?
>
> If the dialog launches correctly, then the resizing seems to work as
> one would expect.
>
> If the dialog launches with an incorrect size, then the resizing is
> really hard to understand because it is usually drawn offscreen. It
> seems like it is trying to resize in this case, but the underlying
> size is so messed up that it's hard to tell.
>
> Thanks,
> Eric
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Iup-users mailing list
> Iup-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Problems with layout (sometimes too small, then too big)

2018-04-01 Thread Chris Matzenbach via Iup-users
Hi,

For what it is worth, I have installed Arch linux on three separate
machines in the past month, and on each one I have encountered this error.
On some setups I had just gtk2 installed prior to this error, and on others
I had both gtk2 and 3 installed.  Testing it on my laptop running Arch
right now, I opened the program 10 times, the first 9 times were fine but
the 10th time resulted in the error being discussed.  Point being, it seems
easier to trigger this issue on Arch than other distros, and maybe it's
worth trying in a VM (though it can be a pain to install, maybe an
third-party automatic installer could be used).  I don't know why this is.

Let me know if there's anything I can do to help.

Best,
Chris Matzenbach

2018-03-16 14:00 GMT-05:00 Antonio Scuri :

>   Hi,
>
>   Don't worry I'll not give up on this. But I need a more concrete
> situation. My tests are in an already slow virtual machine.
>
>   I was thinking, would be interesting to analyze the dialog when the
> problem occur.
>
>   Does it happens for which elements? Only a set of elements have problems?
>
>   The dialog of the sample contains text with expand, and the initial
> display seems to be correct for the dialog contents, if the dialog was
> shown with that size. I mean the problem could be at the IupDialog only.
>
>   But I don't know what can cause the internal size to be different that
> the initial size. Maybe it is some control initial size that is expanding
> the dialog, that's why I would like to know if it is some class of controls
> that is causing the wrong initial size.
>
>   Another thing to be considered is that the only wrong situation is the
> initial size, once the dialog is shown, the layout is actually correct.
> When the dialog is resized by the user, all the elements are correctly
> positioned, right?
>
> Best,
> Scuri
>
>
>
>
>
>
> 2018-03-14 17:43 GMT-03:00 Eric Wing :
>
>> I just wanted to clarify 2 points in my last message:
>>
>> > I've seen it on the following using the standard packages that come
>> with each OS:
>>
>> I was referring to GTK2 and GTK3 as the standard packages. I always
>> have to build IUP since nobody has a package for it.
>>
>>
>> > ccmake -DCMAKE_BUILD_TYPE=Debug -DIUP_BUILD_TESTS=1 -D /path/to/iup/root
>>
>> I meant cmake, not ccmake.
>>
>> 
>> --
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> ___
>> Iup-users mailing list
>> Iup-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/iup-users
>>
>
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Iup-users mailing list
> Iup-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Problems with layout (sometimes too small, then too big)

2018-03-29 Thread Antonio Scuri
  Notice that by setting

IupSetAttribute(the_dialog, "SIZE", "HALFxHALF");

 You will not be able to reduce the dialog content size from its initial
size. This could be confusing you too. After SHOW set

IupSetAttribute(the_dialog, "SIZE", NULL);

To clear that limitation.

Best,
Scuri



2018-03-27 19:35 GMT-03:00 Eric Wing :

> On 3/16/18, Antonio Scuri  wrote:
> >   Hi,
> >
> >   Don't worry I'll not give up on this. But I need a more concrete
> > situation. My tests are in an already slow virtual machine.
> >
>
> Thank you for not giving up on me. I appreciate it!
> Sorry for the delay. I've been sidetracked on other problems.
>
> FYI, that video recording was of an Ubuntu inside Virtual Box. (But
> I've had the problem on native machines too.)
>
> >   I was thinking, would be interesting to analyze the dialog when the
> > problem occur.
> >
> >   Does it happens for which elements? Only a set of elements have
> problems?
> >
>
> I will do more tests with other elements. My original app actually was
> a z-box with 4 different screens. The button demo I sent was a
> reduction of that app. The other 3 layers contained mostly buttons,
> drop-down lists, text fields, and labels.
>
> I will try to make some new tests that have just those elements and
> see what happens.
>
> >   The dialog of the sample contains text with expand, and the initial
> > display seems to be correct for the dialog contents, if the dialog was
> > shown with that size. I mean the problem could be at the IupDialog only.
> >
> >   But I don't know what can cause the internal size to be different that
> > the initial size. Maybe it is some control initial size that is expanding
> > the dialog, that's why I would like to know if it is some class of
> controls
> > that is causing the wrong initial size.
> >
>
> So as a new data point, I accidentally stumbled on this bug again in a
> different test. This test is just a single label and webview. I
> captured this on my Raspberry Pi 2 which is using the GTK3 backend.
> I've linked the good picture and bad. (The Pi seems good at triggering
> this bug.)
>
> https://blurrrsdk.com/tempdownload/images/IupWebGoodSize.png
> https://blurrrsdk.com/tempdownload/images/IupWebBadSize.png
>
> This is the program:
>
> Ihandle* the_label = IupLabel("Hello World!");
> Ihandle* web_view = IupWebBrowser();
> IupSetAttribute(web_view, "VALUE", "https://www.google.com;);
> Ihandle* v_box = IupVbox(the_label, web_view, NULL);
> Ihandle* the_dialog = IupDialog(v_box);
> IupSetAttribute(the_dialog, "TITLE", "Blurrr Iup C");
> IupSetAttribute(the_dialog, "SIZE", "HALFxHALF");
> // For Microsoft Windows: This will set the title bar icon to the
> application icon.
> IupSetAttribute(the_dialog, "ICON", "IDI_ICON1");
> IupShow(the_dialog);
>
>
>
> >   Another thing to be considered is that the only wrong situation is the
> > initial size, once the dialog is shown, the layout is actually correct.
> > When the dialog is resized by the user, all the elements are correctly
> > positioned, right?
>
> If the dialog launches correctly, then the resizing seems to work as
> one would expect.
>
> If the dialog launches with an incorrect size, then the resizing is
> really hard to understand because it is usually drawn offscreen. It
> seems like it is trying to resize in this case, but the underlying
> size is so messed up that it's hard to tell.
>
> Thanks,
> Eric
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Iup-users mailing list
> Iup-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Problems with layout (sometimes too small, then too big)

2018-03-14 Thread Eric Wing
On 3/14/18, Antonio Scuri  wrote:
>   Tested on the following configurations:
>
> CentOS 6.8 (x86) Linux26g4c6 (GTK 2.24)
> Debian 8.3 (x86) Linux316 (GTK 3.14)
> Oracle Solaris 11 (x86) SunOS511x86 (GK 2.20)
> Ubuntu 10.10 (x86) Linux26g4 (GK 2.22)
> Ubuntu 12.04 (x86) Linux32 (GTK 2.24)
> Ubuntu 14.04 (x64) Linux313_64 (GTK 3.10)
> Ubuntu 15.04 (x64) Linux319_64 (GTK 3.14)
> Ubuntu 16.04 (x64) Linux44_64 (GK 3.18)
>
>   I run the test around 50 times. I added a small callback so I can do it
> using only the keyboard.
>
>   Using the IUP from SVN.
>
>   The result was the same, every time...
>
> Best,
> Scuri
>
> BTW: the SHRINK attribute you used along the code is a IupDialog attribute.
> Other controls simply ignore it. Although I didn't change that code for the
> tests.
>

This is a very frustrating bug because sometimes I go very long times
(days) without seeing it, and other times it always comes up. For the
video recording, I probably had to run it 30+ times (and I edited out
the other runs). It seems that whenever I want to see it, it never
comes, but when I need it to work without problems (like a production
app), it doesn't and I get long streaks of broken runs. Murphy's Law.

I've seen it on the following using the standard packages that come
with each OS:
Ubuntu 12.04 LTS (x64), both GTK2 and GTK3
Ubuntu 14.04 (x64) (only tried GTK2)
Ubuntu 16.04 (x64) (only tried GTK2)
Ubuntu 16.10 (x64) (both GTK2, GTK3)
Debian Jessie (x64) (GTK2)
Debian Stretch (x64) (GTK2)
SteamOS (x64) (GTK2)
Arch this past month (x64) (only GTK2)
Raspbian Jessie (armv7) (both GTK2, GTK3)
Raspbian Stretch (armv7) (both GTK2, GTK3)

I think I also got a report of the issue on Fedora Core x64 GTK2, but
I don't have the specifics of which version.


I originally was using the standard IUP SVN, tested the most on Ubuntu
12.04 and Raspbian Jessie. And I first reported this bug 2 years ago,
and I've seen it over the entire duration of time. So I am almost
certain this bug is in there. However, in recent days, I've been using
a branch I made (called "Linux") from my IupCocoa repo. The branch
doesn't actually contain the Cocoa stuff, but does include the CMake
build system we've developed for all the platforms because I found the
Makefile difficult to get going and use with IDEs. The branch also
contains the event loop modification I described in the Lua Workshop
video, but I did not activate it for the test runs and video
recording, and I originally encountered this bug before I implemented
that change.


Anecdotally, I feel like I've seen the bug the most on Raspberry Pi
(Raspbian). I don't know if it is scientifically true, but it feels
like it. If it is true, I wonder if the slower speed of the Pi makes
it more vulnerable since it feels like some kind of race condition
bug.




But if you want to try my branch, you can find it here. (Make sure to
switch to the Linux branch.) But as I said, I don't believe my branch
is affecting things since I did see it originally with the official
SVN. I resync'd my branch with the SVN like a week and a half ago.
https://github.com/ewmailing/IupCocoa/tree/Linux

mkdir -p /path/to/some/build/dir
cd /path/to/some/build/dir
ccmake -DCMAKE_BUILD_TYPE=Debug -DIUP_BUILD_TESTS=1 -D /path/to/iup/root
make

There are menu options like for building tests (off by default which
is the reason for the switch) which is off by default. I turn it on,
and then hijack one of the tests (like button.c) to run the test code
I submitted here. It attempts to auto-detect for GTK2 or GTK3, picking
GTK2 first. Menu options can set to change that. (You can use ccmake
or cmake-gui to bring up the menu.)

Valid options for build type are Debug, MinSizeRel, Release,
RelWithDebInfo. I usually use Debug and MinSizeRel, but I have seen
this bug with all of them.

The video recording was on Ubuntu 16.10 (x64) using GTK2. I built that
using Debug settings. However, I originally encountered this bug with
Release or MinSizeRel settings in a production app, so anecdotally, I
wonder if the optimized variant is more easily able to hit the race
condition.


Anyway, I implore you to keep trying. I know the bug is there. Maybe
building Release, trying a slower machine, or running a large and
heavy background process to slow down the machine and eat resources
could help trigger it.

Thanks,
Eric

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Problems with layout (sometimes too small, then too big)

2018-03-13 Thread Antonio Scuri
  I just saw your video. I have no idea. I will try to reproduce the
problem here.

Best,
Scuri


2018-03-12 20:29 GMT-03:00 Eric Wing :

> Hello, I'm bumping this old thread because it is still a problem.
>
> To refresh your memory, there is some bug with IUP GTK backends where
> *sometimes* the sizing for a layout in a dialog is incorrect. It
> happens *sometimes*, so while I can reproduce it, it is hard to
> reproduce at will. When I launch the program, it is sometimes broken,
> or not. It feels a little like it is a race condition between IUP and
> GTK itself.
>
> I have seen this problem with both the GTK2 and GTK3 backends, on many
> different Linux distros and versions, including many versions of
> Ubuntu, Debian, Raspbian, and Arch.
>
> I have written a simplified test program that can reproduce the
> problem (sometimes). I am attaching that program to this message. I
> have uploaded a video showing the program working correctly and not
> working correctly.
>
> https://youtu.be/1ta8AK3jM2U
> (The broken run version is at 7 seconds.)
>
> I'm hoping you can help me trackdown what is causing this, or at least
> narrow down what to look for. I tried stepping through a debugger, but
> I can't seem to reproduce it when I do that, which is another reason I
> think there is some kind of initialization race condition.
>
> Thanks,
> Eric
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Iup-users mailing list
> Iup-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Problems with layout (sometimes too small, then too big)

2018-03-12 Thread Eric Wing
Hello, I'm bumping this old thread because it is still a problem.

To refresh your memory, there is some bug with IUP GTK backends where
*sometimes* the sizing for a layout in a dialog is incorrect. It
happens *sometimes*, so while I can reproduce it, it is hard to
reproduce at will. When I launch the program, it is sometimes broken,
or not. It feels a little like it is a race condition between IUP and
GTK itself.

I have seen this problem with both the GTK2 and GTK3 backends, on many
different Linux distros and versions, including many versions of
Ubuntu, Debian, Raspbian, and Arch.

I have written a simplified test program that can reproduce the
problem (sometimes). I am attaching that program to this message. I
have uploaded a video showing the program working correctly and not
working correctly.

https://youtu.be/1ta8AK3jM2U
(The broken run version is at 7 seconds.)

I'm hoping you can help me trackdown what is causing this, or at least
narrow down what to look for. I tried stepping through a debugger, but
I can't seem to reproduce it when I do that, which is another reason I
think there is some kind of initialization race condition.

Thanks,
Eric
#include "iup.h"
#include 

const char* GenProj_GetLocalizedString(const char* key, const char* comment)
{
return IupGetLanguageString(key);
}


Ihandle* NewOrOpenView_Create(
	Ihandle* image_new,
	Ihandle* image_open,
	Icallback on_new_project_callback,
	Icallback on_open_project_callback,
	void* user_data
)
{
	Ihandle* main_dialog = NULL;
	Ihandle* image_button_new = NULL;
	Ihandle* image_button_open = NULL;
	Ihandle* label_new = NULL;
	Ihandle* label_open = NULL;
	Ihandle* hbox_for_centered_ui = NULL;
	Ihandle* vbox_for_centered_ui = NULL;
	Ihandle* hbox_for_buttons = NULL;
	Ihandle* hbox_for_labels = NULL;
	Ihandle* vbox_for_new_button_and_label = NULL;
	Ihandle* vbox_for_open_button_and_label = NULL;


	image_button_new = IupButton(NULL, "newProjectButtonAction");
	image_button_open = IupButton(NULL, "openProjectButtonAction");

//	IupSetAttributeHandle(image_button_new, "IMAGE", image_new);
//	IupSetAttributeHandle(image_button_open, "IMAGE", image_open);

	label_new = IupLabel(GenProj_GetLocalizedString("New Project", "New Project"));
	label_open = IupLabel(GenProj_GetLocalizedString("Open Project", "Open Project"));

	IupSetAttribute(label_new, "EXPAND", "HORIZONTAL");
	IupSetAttribute(label_open, "EXPAND", "HORIZONTAL");
	IupSetAttribute(label_new, "SHRINK", "HORIZONTAL");
	IupSetAttribute(label_open, "SHRINK", "HORIZONTAL");
	IupSetAttribute(image_button_new, "EXPAND", "YES");
	IupSetAttribute(image_button_open, "EXPAND", "YES");
	IupSetAttribute(image_button_new, "SHRINK", "YES");
	IupSetAttribute(image_button_open, "SHRINK", "YES");

	IupSetAttribute(image_button_new, "ALIGNMENT", "ACENTER:ACENTER");
	IupSetAttribute(image_button_open, "ALIGNMENT", "ACENTER:ACENTER");
	IupSetAttribute(label_new, "ALIGNMENT", "ACENTER:ACENTER");
	IupSetAttribute(label_open, "ALIGNMENT", "ACENTER:ACENTER");
	IupSetAttribute(label_new, "FONTSIZE", "24");
	IupSetAttribute(label_open, "FONTSIZE", "24");

	
	vbox_for_new_button_and_label = IupVbox(
		image_button_new, 
		label_new,
		NULL
	);

	vbox_for_open_button_and_label = IupVbox(
		image_button_open, 
		label_open,
		NULL
	);

	IupSetAttribute(vbox_for_new_button_and_label, "ALIGNMENT", "ACENTER:ACENTER");
	IupSetAttribute(vbox_for_open_button_and_label, "ALIGNMENT", "ACENTER:ACENTER");
	IupSetAttribute(vbox_for_new_button_and_label, "SHRINK", "YES");
	IupSetAttribute(vbox_for_open_button_and_label, "SHRINK", "YES");

	hbox_for_buttons = IupHbox(
		vbox_for_new_button_and_label,
		vbox_for_open_button_and_label,
		NULL
	);
	IupSetAttribute(hbox_for_buttons, "ALIGNMENT", "ACENTER:ACENTER");

	IupSetAttribute(hbox_for_buttons, "MARGIN", "10x10");


//	IupSetCallback(image_button_new, "ACTION", on_new_project_callback);
//	IupSetCallback(image_button_open, "ACTION", on_open_project_callback);

//	IupSetAttribute(image_button_new, "MY_USER_DATA", (const char*)user_data);
//	IupSetAttribute(image_button_open, "MY_USER_DATA", (const char*)user_data);
	
	return hbox_for_buttons;
}

static void IupExitPoint()
{
	IupClose();
}


/**
 * Main function  *
 **/
void IupEntryPoint()
{

	// IupSetFunction("EXIT_CB", (Icallback)IupExitPoint);


	Ihandle* box =  NewOrOpenView_Create(
		NULL,
		NULL,
		NULL,
		NULL,
		NULL
	);

	Ihandle* dialog = IupDialog(box);
	IupShow(dialog);
}

int main(int argc, char* argv[])
{
	IupOpen(, );

#if 0 // new ENTRY_POINT callback
	IupSetFunction("ENTRY_POINT", (Icallback)IupEntryPoint);
	IupMainLoop();
	
#else // legacy
	IupEntryPoint();
	IupMainLoop();
	// legacy: New way should assume IupMainLoop may return immediately or this code is never reached.
	IupClose();
#endif
	

Re: [Iup-users] Problems with layout (sometimes too small, then too big)

2015-07-22 Thread Eric Wing
On 7/16/15, Antonio Scuri sc...@tecgraf.puc-rio.br wrote:
   Hi,

   That GLib warning output could be a mix of library versions, don't know
 for sure. In IUP I don't set any of those properties. I use GtkSettings in
 a 3 places only. Never seen those warnings in Linux.

I found that gvim also triggers these same warnings, so I guess it is
a library/system problem.

   About the first problem, the gridbox define its width based on
 the SIZELIN attribute, that default is 0 (the first line). So if the 4th
 line is larger than the first, then it could produce results like
 initial_new.png. But I don't know about initial_gen.png. It is hard to
 say without investigating the layout. To help on that the IupLayoutDlg is
 very usefull. I added a global hot key that activates the IupLayoutDlg for
 the current dialog Ctrl+Alt+Shit+L. But I think this problem is just a
 matter of fing why the natural size of the dialog is smaller than
 necessary.

   The second problem I have no idea. You are using IupConfigDialogShow
 right? Maybe as testing you should use just IupShow without trying to
 restore the previous windows size.


I don't know if this helps, but I turned on the LayoutDialog when the
second problem occurred and stepped through the elements. I made
screenshots of every one here:
http://playcontrol.net/tempdownload/iup_screens_pi/TooBig.tar.gz

I was looking for a natural size that looked really wrong, but I
didn't notice anything myself.

Also, I just tried changing to IupShow from IupConfigDialogShow and I
managed to trigger the second problem/bug with it once so far. So I'm
guessing it is not specific to IupConfigDialogShow.

Thanks,
Eric

--
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Problems with layout (sometimes too small, then too big)

2015-07-22 Thread Eric Wing
On 7/22/15, Antonio Scuri sc...@tecgraf.puc-rio.br wrote:
   I see that the natural size of the dialog is quite normal. The controls
 are not pushing the dialog size. It is the dialog that is sized in a weird
 way. Could be some computation that I done to estimate the decorations size
 in iupgtk_dialog.c. But being not deterministic is complicated locate the
 real problem. Maybe some warning when compiling iupgtk_dialog.c?

To me, it looks like the dialog size is correct, but the contents are
too big. When I use IupConfigDialogShow, it seems to be restoring the
user preference size correctly. It is the contents that are too big.
(I think when I used IupShow that one time, the dialog size looked to
be the natural size.)

I recompiled iupgtk_dialog.c and didn't see any warnings.

Thanks,
Eric

--
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users