Some GTK Code part 2

Archives Forums/Linux Discussion/Some GTK Code part 2

skidracer(Posted 2007) [#1]
Thread continued from here.

Brucie, (bad design cheap and dirty filter) fix for maxide.bmx[5305] to work better under GTK:
		If activerequester
			Select eventid
				Case EVENT_MOUSEENTER,EVENT_MOUSELEAVE,EVENT_GADGETLOSTFOCUS
					Return
			End Select


also, any ideas what apt-get install i may need to do to get over the following link issues I have with gtkwebmozilla version

/usr/bin/ld: warning: libxpcom_core.so, needed by /usr/lib/mozilla-firefox/libgtkembedmoz.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libstdc++.so.6, needed by /usr/lib/mozilla-firefox/libgtkembedmoz.so, may conflict with libstdc++.so.5
/usr/lib/mozilla-firefox/libxpcom.so: undefined reference to `NS_GetTraceRefcnt_P'
/usr/lib/mozilla-firefox/libgtkembedmoz.so: undefined reference to `nsPromiseFlatCString::Init(nsACString_internal const&)'
/usr/lib/mozilla-firefox/libgtkembedmoz.so: undefined reference to `NS_Free_P'
etc. etc.




Brucey(Posted 2007) [#2]
Sounds a lot like a different installation of firefox.

If you look in the gtkwebmozilla source, you'll see
'Import "-lxpcom_core"   ' On some installations, this is required.

My FC3 install of firefox used this library, but FC4/5 and my 5.10 ubuntu Firefoxes all have a different set of libs.

Try uncommenting that line.

....

Funnily enough, I've just ran Software Update on my 5.10 Ubuntu, and it's installed a new version of Firefox, in /usr/lib/firefox (removing the installation from /usr/lib/mozilla-firefox !). This new dist has that libxpcom_core.so in it...

Looks like each release of Firefox is slightly different.

:-S


skidracer(Posted 2007) [#3]
Wow, firefox looks fantastic in the CE build, well done sir!


Brucey(Posted 2007) [#4]
Thanks ;-)

The only thing I haven't managed to get working with it are,
1) Context menus
2) Clipboard/copy access

The embedding docs don't go near things like that, unfortunately...


SebHoll(Posted 2007) [#5]
Hi - me again! ;-)

I was wondering if there was a way I could get the absolute screen position of a specified point within an interactive Panel?

I.e. say if the pixel specified was 20,50 then would I be able to call a GTK function that would return the same pixel but in relation to the top-left corner of the screen instead of the top left corner of the panel.

I've managed to get a Windows and Cocoa version working (with some help from Skid and Craig) and I just need a GTK one to complete the cross-platform set.

Any ideas?

Thanks

Seb

P.S. I tried to "fake" such a function by looping through the parent of the gadget adding the xpos to an accumulating variable every time, but discrepancies in Client XPos, and Gadget XPos, break it. (Sorry if what I've said is confusing).


skidracer(Posted 2007) [#6]
I tried to "fake" such a function by looping through the parent of the gadget adding the xpos to an accumulating variable every time, but discrepancies in Client XPos, and Gadget XPos, break it


I've used this method before and it should work on all platforms so IMHO it would be better any "discrepancies" be dealt with than a new function be required.


SebHoll(Posted 2007) [#7]
I've used this method before and it should work on all platforms so IMHO it would be better any "discrepancies" be dealt with than a new function be required.



I was originally using this method too, but when absolute values are calculated this way across things like tabbers or group panels, the distance between the gadget's reported xpos and the client's xpos is thought to be the same (when actually there is quite a big difference on pixel-perfect precision). As such, any drag operations I were doing jumped significantly when this happens. I couldn't think of a way to get around this as it's hard to get the height / width of tab/group panel margins etc.

Scratching my head, I looked for other ways, and Windows has an API command exactly for this job that was easy to implement and now it works perfecly. OS X (as you know) took a bit longer to implement but, again it provides perfect drag operations.

So all I need to do now is to get a Linux/GTK compatible one and drag operations will be flawless on all three platforms.

Hope I've made myself clearer...


Brucey(Posted 2007) [#8]
Hmm, actually, I have some code for all platforms that gets the mouse coords for the screen... been lying around for months - never got around to posting it anywhere.
Was thinking it would be one of those nice-to-haves built in to Max... but I'm still waiting for other things to appear in the Max trunk...

Actually, now I look at the code, there's a GetScreenPointerPos function included with the GTK module. (I've got win32/Mac functions of the same functionality too, if anyone cares?)


Anyhoo (which is why I'm here)... just thought I'd mention I've uploaded (to syncmods) updates to GTKMaxGUI and GTKWebMozilla.

GTKMaxGUI (1.18)
1.18 :
  * Fixed generation of GADGETSELECT on TreeView creation.
  * Fixed loss of next text change event after setting empty text field to empty.

1.17 :
  * Added FormatTextAreaBackground support.
    ( there's the whole cross-platform stuff in the Tweaks area somewhere for this one)


GTKWebMozilla (1.03)
* Fixed mem issue in GetText.



Brucey(Posted 2007) [#9]
Hallo...

Time for a new update.

This one fixes the nasty issues concerned with the splitter in the IDE.

GTKMaxGUI (1.19)
  * Fixed x,y coords returned by Panel MouseMove events. Now calculated relative to parent widget.


Hope that improves everyone's Linux IDE experience...

Pick it up from the usual places, either via syncmods, or from the website (link in my sig or in my profile)

:o)


Mark Tiffany(Posted 2007) [#10]
Ta Brucey!


SebHoll(Posted 2007) [#11]
Thanks Brucey! One thing I've been meaning to ask is concerning the Firefox web browser 'plug-in' module. I can only run apps compiled with this module when I call in the console (under root user):

ldconfig /usr/lib/firefox

I don't really know what this does, but my MaxIDE is currently using the Firefox HTML Gadget and if it won't run first time, executing the above line fixes it. However, when Ubuntu installs any updates or packages, it seems like ldconfig changes and I need to set it again in order for MaxIDE to work.

Is there a way I can get it to locate Firefox's shared libraries in a less fragile manner?

Best Regards


Seb


Brucey(Posted 2007) [#12]
Is there a way I can get it to locate Firefox's shared libraries in a less fragile manner?


Without implementing some kind of runtime library loading, I don't think so, however, there is a file :

/etc/ld.so.conf

which stores a list of folders that ldconfig checks.
Add the path in that file too. It should be more permanent then.
You might need to do something like :

sudo vi /etc/ld.so.conf

or be "root" user, to change it.

HTH :o)


Kernle 32DLL_2(Posted 2007) [#13]
hey

I'm scrolling through your gtkwebgtkhtml module and look for a possibility to display an internet page like blitzbasic.com. Is it possible without using other brl modules?


Brucey(Posted 2007) [#14]
Well, it's been wrapped specifically to be like a MaxGUI module, so to have it work otherwise would require a fair bit of effort.

As for generally displaying internet pages, it works as you'd expect since it's essentially Firefox underneath.


SebHoll(Posted 2007) [#15]
Heh Brucey,

Finally managed to get Ubuntu working again. Is there a way I can disable the "feature" in GTKMaxGUI whereby gadgets cannot be placed at negative coordinates. It breaks a lot of Max'd GUI's drag n' drop functionality, and I can't remember the reason why you added it (it was probably because of something important, but I've forgotten, :-) ).

Thanks

Seb


SebHoll(Posted 2007) [#16]
Found it in SetRect() :-), however removing the Max(x,0) lines doesn't really have much of an effect, so I assume GTK doesn't allow widgets to be drawn at negative locations. :-(

One other thing I've noticed is that when using event hooks, the gadget properties returned by MaxGUI functions aren't updated until after the hook.

E.g. a tabber gadget generates an EVENT_GADGETACTION. If you called SelectGadgetItem() on the tabber within the hook, then it would still return the old selected item index (as oppose to the one just clicked). In this case I could have used event.data, but as the other platforms allow for this, would it be possible for a fix to be implemented. I can't think how it would be done...

Thanks


Seb


Kernle 32DLL_2(Posted 2007) [#17]
hey

i've got a little question. I work with your gtk module and i'm very happy that something like this exists. But there is a problem, after changing the gtk theme the size of nearly all gtk-elements are different. So also the distance between the gui elements. Perhaps you could write an importer for glade....[Xmas ;)] or how can i fix the different sizes and distances by the different gtk themes. i hope you understand my problem....


Brucey(Posted 2007) [#18]
The problem with a MaxGUI-based UI is that all the coordinates are set exactly (x, y, w, h)... whereas Glade uses weightings to space the UI out, thereby avoiding the issues of different theme sizing.

The easiest way to avoid this would be to build a custom Max UI for GTK that worked with Glade files, using the standard layouts/resizing that normal GTK-based apps have.
If I were to do that, then the code would be incompatible with the other platforms, but it would look and work much better than it does now.
This way would also allow for better widget control, and the full implementation of things like Tables.


Kernle 32DLL_2(Posted 2007) [#19]
would be fantastic....to me who uses gtk in Windows? no one, only for the windows-port of gimp. Perhaps you think about it ;)


SebHoll(Posted 2007) [#20]
Found another tiny bug (although it's more of a warning, than a bug)...

If you call MenuChecked() on a menu before calling UncheckMenu() or CheckMenu() then GTK complains that the menu isn't a check menu. A work-around I found was to call UncheckMenu() after creating each menu. Could this be done internally within the GTK MaxGUI driver so that this error doesn't appear?

Thanks


Brucey(Posted 2007) [#21]
Sounds like a reasonable request, Seb :-)