GUI library for Windows \ Linux (window9)

Headers, Bindings, Libraries for use with FreeBASIC, Please include example of use to help ensure they are tested and usable.
Post Reply
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: GUI library for Windows \ Linux (window9)

Post by VANYA »

SARG wrote:Yes for my last sentence I was thinking also about UboundIncBin
Of course, I did not just write in the help that the IncludeBinary and Catch_image functions are connected.
Mysoft wrote:because thats the only way to have an image buffer from pointer, since there isnt a function to get/set bitmap bits
No, not the only one. Do you not know how to get pixels in GDI? Or do you not know how to get pixels in GDI+?

I understand if you don't know how to get pixels in linux gtk , but even here it's enough just to look at the source code of the library under linux 2D_DRAW function Fillrectdraw and you will understand how to get a pointer to pixels. It is irrational to create a function in the library for every sneeze, something must be written by the users themselves.
Mysoft wrote:and yes i'm using in a hacky way
Well... I have neither time nor desire for your experiments. For experiments, please create a separate topic in section "Libraries Questions" and there you can write as much as you want about the fact that your examples crash or something does not work. In this thread, I want to receive a bugs report from users on normal use of the library. And I don't want every time you write about a problem to try to guess what you've done there again. Please don't be offended.
SARG
Posts: 1756
Joined: May 27, 2005 7:15
Location: FRANCE

Re: GUI library for Windows \ Linux (window9)

Post by SARG »

Mysoft wrote: Feb 19, 2022 13:08 i just set ulong to a value, no math at all
Joking ? :D
Extract from your code : biSizeImage is calculated using biHeight and the result is completely wrong for negative value.

Code: Select all

with tImage.tHdr 'maybe unecessary, but for completeness
  .biSizeImage = (.biWidth*abs(.biHeight)*.biBitCount\8)
  .bfSize = .biSizeImage+.bfOffBits
end with
marcov
Posts: 3455
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: GUI library for Windows \ Linux (window9)

Post by marcov »

(bitmaps with negative height (meaning top down instead of bottom up) have been allowed since Windows 98)
SARG
Posts: 1756
Joined: May 27, 2005 7:15
Location: FRANCE

Re: GUI library for Windows \ Linux (window9)

Post by SARG »

I know that height can be negative, the problem is not here but there :

Code: Select all

.biSizeImage = (.biWidth*abs(.biHeight)*.biBitCount\8)
biHeight is defined ulong so and filled with -16 so abs (.biHeight) -->4294967280 and not 16.......
So the final size is not 1024 but a huge value.
Mysoft
Posts: 836
Joined: Jul 28, 2005 13:56
Location: Brazil, Santa Catarina, Indaial (ouch!)
Contact:

Re: GUI library for Windows \ Linux (window9)

Post by Mysoft »

SARG wrote: Feb 19, 2022 18:32 I know that height can be negative, the problem is not here but there :

Code: Select all

.biSizeImage = (.biWidth*abs(.biHeight)*.biBitCount\8)
biHeight is defined ulong so and filled with -16 so abs (.biHeight) -->4294967280 and not 16.......
So the final size is not 1024 but a huge value.
hum... so its promoting to integer, then it works on 32bit but not on 64bit... ok, anyway it was not the actual problem, otherwise i would have noticed that on the gtk messages... and i tought it didnt worked at first because the bmp loader wouldnt support negative heights, and so i tested with 16... and it was the same crash...

so yeah indeed, i missed that until he pointed out on the 64bit code, but in the end those members are basically ignored by the loader (on both windows/linux), so it works anyway, but fixed nonetheless :D
Mysoft
Posts: 836
Joined: Jul 28, 2005 13:56
Location: Brazil, Santa Catarina, Indaial (ouch!)
Contact:

Re: GUI library for Windows \ Linux (window9)

Post by Mysoft »

VANYA wrote: Feb 19, 2022 16:00
SARG wrote:Yes for my last sentence I was thinking also about UboundIncBin
Of course, I did not just write in the help that the IncludeBinary and Catch_image functions are connected.
Mysoft wrote:because thats the only way to have an image buffer from pointer, since there isnt a function to get/set bitmap bits
No, not the only one. Do you not know how to get pixels in GDI? Or do you not know how to get pixels in GDI+?

I understand if you don't know how to get pixels in linux gtk , but even here it's enough just to look at the source code of the library under linux 2D_DRAW function Fillrectdraw and you will understand how to get a pointer to pixels. It is irrational to create a function in the library for every sneeze, something must be written by the users themselves.
Mysoft wrote:and yes i'm using in a hacky way
Well... I have neither time nor desire for your experiments. For experiments, please create a separate topic in section "Libraries Questions" and there you can write as much as you want about the fact that your examples crash or something does not work. In this thread, I want to receive a bugs report from users on normal use of the library. And I don't want every time you write about a problem to try to guess what you've done there again. Please don't be offended.
oh come on, they are not just experiments, i'm doing REAL tests on the library, and while i push further sometimes on what is documented and what not, all that i reported actually worked on windows, and there was no documentation that they were not avaliable, so i use common sense for those, like having the catch that can ONLY work with that specific incbinary, is counterintuitive, maybe it used better words on the russian help hehe, and while i understand that i could pad with native functionality on either side, but i'm testing how much the library can do as crossplatform, because thats the only reason for that library to be actually useful hehe , and a top grade library, with little bloat.

because of this library i'm also learning how weak GTK is compared to WINAPI, and so on, so i'm pushing it to the limits, i may create a whole section of documentation, just exposing all differences that i could find, that ACTUALLY exist between the API... for example, on the SetTimer callback function, the sample prototype have it as "function" but it does not explain what the return value of that means... on linux you need to return TRUE for the timer to continue ticking, on windows, it does not matter, and the fact that on linux window and gadgets are different, but on windows they are the same thing, (so other than adding such warnings on documentation, i think a section for differences is crucial, because theres the dillema between allow the functionality, and negate the functionality (when using w9 functions at least).

and really thats how i test stuff, i can open another topic, but as you see its one of the few libraries that i see potential, so i want to help, and improve make this the best it can without being too bloaty, so you want to discuss those details in another place, because i'm learning from the library and just its documentations and possibilities, because this "works on windows, but on linux" is kinda a responsability of the library to pad eventually

so yeah most of the problems so far, is because things were hidden from me where they shouldnt be, or they didnt worked the same way on linux/gtk/64bit, so theres a lot for me to just "guess/learn/test", but that people would encounter sooner or later hehe, specially with the difference between integer and long on 64bit (because some handles were used as integers when they should be pointers hehe), that i'm double checking everytime with the documentation to avoid those... so imo everything that returns a pointer, but requires 64bit integer on 64bit, should be returned as handles like the hwnd... which have the benefit of the compiler catching those, when they are not "byref" parameters

if you use discord and want to talk there, thats fine by me, the forum isnt the most appropriate place, but just dont be too agressive on people that value your project (like you scared away that other guy that wanted to use it in C)

also on linux i want to try to get the gtk3 version working, that i couldnt so far due conflicts with gtk2, because ubuntu comes with gtk3 installed but not gtk2

and so i'm using all my free time, to advance one step ahead, next will be compile the source of this, before i can start peeking on its source, because that will require me to ignore the OOP parts, and see how much unified the code is for linux\windows (with only stuff that differs on system specific folders), but seeing how the .bi files greatly differ on windows\linux, i think it would be better to unify those more, so i will keep learning to be able to help with the linux part that i dont have experience hehe
Last edited by Mysoft on Feb 19, 2022 20:21, edited 1 time in total.
Mysoft
Posts: 836
Joined: Jul 28, 2005 13:56
Location: Brazil, Santa Catarina, Indaial (ouch!)
Contact:

Re: GUI library for Windows \ Linux (window9)

Post by Mysoft »

oh if you want an actual "bug" then i noticed that on linux, just openwindow+closewindow triggers a GTK assert, related to gadgets, so theres some detail to be fixed :)
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: GUI library for Windows \ Linux (window9)

Post by VANYA »

but just dont be too agressive on people that value your project (like you scared away that other guy that wanted to use it in C)
Where did you see aggression? I just made my position clear.
1) Did you see an error? Please show an example where this error is present. If there are just voiceless designations of an error, then most likely I will simply ignore such messages and assume that these are the errors of the user himself and its misuse.
2) Do you want to improve something in the library? I am ready to listen and even look at your ready-made solutions, but do not expect that this will be implemented in official library. If I like it, it will be added. If I don't like it, then there should be no offense. I warned you!
3) Syntax changes in existing functions will be 99% rejected because I value backwards compatibility
4) I am not interested in any desires to remake the library into other languages. Therefore, if you want to do it yourself or if that guy wants to do it, no one is stopping you from doing it. Just don't expect me to be part of it.
5) I almost always, to the best of my ability, help those who use my library and experience difficulties. But for this, the question must be posed in such a way that it is understandable, preferably with an example of what does not work.
SARG
Posts: 1756
Joined: May 27, 2005 7:15
Location: FRANCE

Re: GUI library for Windows \ Linux (window9)

Post by SARG »

Mysoft wrote: Feb 19, 2022 20:17 oh if you want an actual "bug" then i noticed that on linux, just openwindow+closewindow triggers a GTK assert, related to gadgets, so theres some detail to be fixed :)
I tried on Linux :

Code: Select all

include "window9.bi"
var hmain=openwindw("",10,10,500,500)
closewindow(hmain)
without any problem.
Mysoft
Posts: 836
Joined: Jul 28, 2005 13:56
Location: Brazil, Santa Catarina, Indaial (ouch!)
Contact:

Re: GUI library for Windows \ Linux (window9)

Post by Mysoft »

VANYA wrote: Feb 20, 2022 5:09 Where did you see aggression? I just made my position clear.
hehe well "not agression", but in a harsh way... maybe you didnt even noticed :)
but all that he wanted as to be able to USE the library in C, so yes all you had to do is expose the complications on that ... convert the headers, and he would either need to make some inlined functons or macros or C99 stuff if he wanted to handle the strings and optional parameters, and ofcourse he would need to also include the freebasic rtlib dependencies or remake them, so it was a matter of just expressing the problems with that, since the library was designed for freebasic :)

yes i understand backward compatibility, as i value that as a lot as well!! , but thats the good thiing with the optional parameters :), otherwise new function names would be needed.
Mysoft
Posts: 836
Joined: Jul 28, 2005 13:56
Location: Brazil, Santa Catarina, Indaial (ouch!)
Contact:

Re: GUI library for Windows \ Linux (window9)

Post by Mysoft »

SARG wrote: Feb 20, 2022 8:51
Mysoft wrote: Feb 19, 2022 20:17 oh if you want an actual "bug" then i noticed that on linux, just openwindow+closewindow triggers a GTK assert, related to gadgets, so theres some detail to be fixed :)
I tried on Linux :

Code: Select all

include "window9.bi"
var hmain=openwindw("",10,10,500,500)
closewindow(hmain)
without any problem.
ok it didnt made sense at first but i found the detail that causes the problem...

Code: Select all

#include "window9.bi"
var hmain=openwindow("",10,10,500,500)
  AddSysTrayIcon(999, hmain ,  Load_Icon("999.ico") , "Tray!")  
  var hmain2=openwindow("Test",10,10,128,128)
  print "-------------------"
  close_window(hmain2)
  print "-------------------"
  DeleteSysTrayIcon(999)
close_window(hmain)
-------------------
(window:84256): Gtk-CRITICAL **: 10:37:27.556: IA__gtk_widget_get_toplevel: assertion 'GTK_IS_WIDGET (widget)' failed
-------------------


so somehow adding a systray icon (that does not appear on ubuntu top/right tray area), causes that when i closing the 2nd opened window, so probabily theres a connection, but i dont see why it would trigger on that close_window() except if theres some "checkup" made whenever a window is closed.

so yeah as for further details, it would also happen when closing the first window without deleting the systray, and if more windows are closed it does happen each time until the systray icon is deleted, so gotta be something with the systray, bt the close_window() is that doing the check that causes the GTK assert :)
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: GUI library for Windows \ Linux (window9)

Post by VANYA »

(window:84256): Gtk-CRITICAL **: 10:37:27.556: IA__gtk_widget_get_toplevel: assertion 'GTK_IS_WIDGET (widget)' failed
Yes, there is such an error. I'll fix it, thanks for posting!
Coolman
Posts: 294
Joined: Nov 05, 2010 15:09

Re: GUI library for Windows \ Linux (window9)

Post by Coolman »

I tried to test but this library requires libwebkitgtk-1.0-0 which is obsolete under ubuntu 20.04 the new package is libwebkit2gtk-4.0-37. it would be possible to force the installation of version 1.0.0 but it could destabilize the distribution. it's not worth it.
Mysoft
Posts: 836
Joined: Jul 28, 2005 13:56
Location: Brazil, Santa Catarina, Indaial (ouch!)
Contact:

Re: GUI library for Windows \ Linux (window9)

Post by Mysoft »

Coolman wrote: Feb 20, 2022 17:46 I tried to test but this library requires libwebkitgtk-1.0-0 which is obsolete under ubuntu 20.04 the new package is libwebkit2gtk-4.0-37. it would be possible to force the installation of version 1.0.0 but it could destabilize the distribution. it's not worth it.
yeah well it does not actually REQUIRE that to work, except for the webgadget, so as long that gadget is not used you can just comment the #inclib "webkitgtk-1.0" or create a softlink from libwebkit2gtk-4.0-37 to libwebkitgtk-1.0-0.a or even create a dummy empty library from webkitgtk-1.0-0.bas (compiled with -lib), without further linker errors, as theres no static dependencies to it unless you use the gadget.

or use the gtk3 version somehow :) (couldnt figure out that one yet either hehe)

but yes i agree, the library on linux should be optionally updated to use the new version :P
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: GUI library for Windows \ Linux (window9)

Post by VANYA »

Mysoft wrote: Feb 20, 2022 21:53
Coolman wrote: Feb 20, 2022 17:46 I tried to test but this library requires libwebkitgtk-1.0-0 which is obsolete under ubuntu 20.04 the new package is libwebkit2gtk-4.0-37. it would be possible to force the installation of version 1.0.0 but it could destabilize the distribution. it's not worth it.
yeah well it does not actually REQUIRE that to work, except for the webgadget, so as long that gadget is not used you can just comment the #inclib "webkitgtk-1.0" or create a softlink from libwebkit2gtk-4.0-37 to libwebkitgtk-1.0-0.a or even create a dummy empty library from webkitgtk-1.0-0.bas (compiled with -lib), without further linker errors, as theres no static dependencies to it unless you use the gadget.

or use the gtk3 version somehow :) (couldnt figure out that one yet either hehe)

but yes i agree, the library on linux should be optionally updated to use the new version :P
@Mysoft

No need to try to prove the obvious to those who do not need it. Coolman was pretty clear: "He doesn't need it." For any linux user/programmer, installing the library is a matter of minutes. I installed versions for GTK2 (with libwebkit-1.0), GTK3 on modern distributions: DEBIAN-compatible , FEDORA , OPENSUSE and some little-known ones. This does not require any special skills, you just need to be able to install dependencies, which all linux users can do. Here I wrote the recipe for installing the GTK3 version: https://sourceforge.net/p/guiwindow9/di ... it=25#a452. As you can see, I did not write to the person obvious things, such as install gtk3-devel...rpm and others dependency.
Post Reply