How to use GtkSocket in Windows OS? - gtk

New to Gtk. I tried to compile a GtkSocket example in c, but it gives error unknow type name 'GtkSocket'.
Is it supported in Windows OS?
If not, is there any way I can embed gvim in a gtk+3 applicaton?
Also is there any link where can I know which Gtk feature is supported on which OS?
Thanks

From reference manual:
The GtkPlug and GtkSocket widgets are now X11-specific, and you have
to include the gtk/gtkx.h header to use them.
Afaik, there is no list of features supported by which backend/os. For APIs difference, GtkSocket is pretty much the biggest difference. But there are several backend specific APIs, usually with a different namespace, such as x11/win32.. This is quite common with portable libraries.
I don't know a proper way to embed an application on win32. There are other stackoverflow questions about this, since this is not gtk specific. For example QT How to embed an application into QT widget that you could adapt to Gtk+ application.

Related

Use Qt4 widget in Qt5, without recompiling

I have written some code that relies on the Qt4 library and was using it in some projects. It deals with displaying PDFs, printing and so on and employs the poppler library
My new project is made using Qt5, and I need those functionalities in it.
My qt4 library is represented by DLL that simply returns an object of QWidget-derived class.
Is it possible to use this QWidget inside my new qt5 project? Maybe after some wrapping?
Also, while exploring this issue I came by to Qt plugins. I haven't researched this field yet, but may be it's possible to resolve the problem using them?
Thanks in advance.
Qt 4 and Qt 5 are not binary compatible, so no, you can't use the widget directly. Using both Qt 4 and Qt 5 inside the same application sounds like a dangerous idea...
The best bet is of course porting libpoppler to Qt 5 (have you evaluated how complex such a port would be? Probably not too much). The second best would've been using QX11Embed, but those classes are currently missing from Qt 5, awaiting for someone to port them to QPA / XCB.

GObject Gtk, Gnome, Gtk+, Gl, Gtk2, Gtk3...I don't understand?

all I need some window to host webkit or/and cairo drwaing, but i have to deal with all that first to understand what I'm doing.
now. I'm lost and no more understand what's all that about.
and things get worse when I try working with binding or trying to figure what are dependencies for something.
for example: in python, pyGtk deprecated and replaced by pyGObject(sometimes called pyGl!!)
there are many sites, many downloads and versions, mixed outdated and new references,but not one architectural view of the whole thing.
what I don't understand..is how all these things mixed with each other in too many sites,packages and versions?
The short story:
If you're programming for GTK 2, use pyGTK.
If you're programming for GTK 3, use pyGObject.
The long story:
From what I understood, pyGTK was based on pyGObject. GObject is the "object" API of GTK. GTK is developped in C, which is not an object-oriented language. GObject is a library that provides advanced object-oriented facilies. All GTK objects inherit from the GObject class provided by that library.
Then came the GObject-introspection work. Its goal was to make bindings maintenance easier, and use source code annotations to automatically generate most of the bindings code for each language (python, C++, etc.). This resulted in the python side in pyGI, the python bindings based on the GObject introspection work. That's when people were told to use it for GTK3 development.
Since then, the GObject-introspection work once provided by pyGI has been integrated into GObject. pyGObject eventually became what developers should use for python development in GTK3.
Please read:
https://wiki.gnome.org/Projects/PyGObject
About the GNOME/GTK relationship:
GTK is the toolkit used by the GNOME project. It has been extracted from the GIMP, hence its name (GTK stands for: GIMP Tool Kit). GTK is a core part of the GNOME project, and GTK developers often also are involved in the GNOME project.
My understanding of those components you mentioned:
Think of GI as an interface that the core GNOME libraries conform to.
PyGI doesn't exist any more; it's now part of PyGObject in the GNOME 3 setup.
What is the relation between GTK, GTK+ and GTK2?

pyjamas vs pyqt OR GWT

I am not a web application pro but need to start working on a project so I need to know if pyjamas ( or shall I say the javascript generated o/p of pyjamas ) is as good as pyqt in terms of 2d graphics and widget features. I have a desktop python application which has some rich 2d graphics (with animations / collision detection etc..) implemented using pyqt.
Now I am specifically looking for equivalent web client with similar graphics and widget features . Does pyjamas support all the pyqt UI features with same look and feel??
I am also exploring GWT for this since I believe GWT has a good set of UIs and also supports decent 3rd party tools like vaadin,smartgwt but my preference is for pyjamas because its python and I am writing a equivalent pyqt based desktop app so am more comfortable with python then java. Also am not sure if GWTs look and feel would match with that of pyqt based UI on windows.
Any insights would be very helpful
Thanks in advance
Regards
Shyam
Probably too late, but if anyone else would need an answer,
Pyjamas' widgets are mostly same as GWT's (most are direct translation from GWT, but we have some own widgets too), and do not target Qt, GTK or any other toolkit.
If you are looking into using webkit, you could get best of the two worlds, and use Pyjamas with PyJD. This way your very same application could be compiled into html/css/javascript and run in web browsers and at the same time you could run it in pyqt-webkit, xulrunner or mshtml with original python code.

Is Perl a good option for writing platform independent desktop applications?

Is Perl a good option for writing (possibly and partially) platform independent desktop applications? I know there are interesting widget libraries like GTK2 Perl and wxWidgets but I'm not familiar with development on Windows.
Is it possible to write a good application with Perl and those tools, maybe embedding everything needed to avoid asking the user to install external (and probably non conventional for many) libraries? Are there examples of this kind of apps around?
Sort of. You can certainly write Perl scripts that provide a Tk GUI that will work on any platform, and you can even package the libraries they need to work with PAR to put together an application that will run anywhere with an appropriate version of perl installed without requiring the end use to install a bunch of stuff from CPAN to get it to work.
However, an application that will run anywhere without requiring an existing perl installation (and it's probably not safe to assume the average Windows user will have perl) isn't really viable. One solution would be to distribute an "everywhere but Windows" version that simply uses PAR to include the necessary libraries, and a PAR::Packer-built version for Windows, which would be a fully-functional .exe including the perl interpreter and the libraries.
EDIT: following daotoad's response, it does appear that ActiveState's PerlApp can build cross-platform binaries for for Windows, Mac OS X, Linux, Solaris, and AIX; I haven't tried this but if it works as advertised it would seem to meet your requirements.
My employer uses ActiveState's PerlApp to produce executable versions of our apps with great success.
We tested PAR and PerlApp before selecting our packaging method. At that time, PerlApp had faster load times. Several versions of each tool have come and gone since then, so I would recommend testing with each before selecting a tool.
Executable packaging has been very effective for us.
There are a few portability issues issues with Perl, but if you pay attention to perlport, it's easy to avoid most issues. Our biggest problems are always with Win32. From time to time, some simple thing will require stupid, bizarre work-arounds or digging into Win32 API for a platform specific hack.
We have used both Wx and Tk guis.
Frozen Bubble is a well known and widely available app you can look at.
Check out PAR (available via CPAN) with respect to your bundling requirement.
Consider having a look at Padre for an example of a complex application written in perl using Wx.
So yes. All of your requirements are achievable, including portability.
I am working on the module XUL::Gui on CPAN, which uses Firefox to display cross platform gui apps from Perl. It is under development, but stable, and may be complete enough for your needs. You can build your gui in HTML and/or XUL (the Mozilla gui language that Firefox itself is written in), and then style everything with CSS. Let me know if you have any feature requests.

In Gtk, when is it better to use Glade/GtkBuilder than native code?

Glade helped me get started on a project quickly, but I've found it harder to maintain in the long run, and I'm thinking about switching it all to native code. In what circumstances would you choose glade, and when would you use native code?
I would personally only use native code for performance reasons. I find it much easier to work with gtkbuilder. Have you used glade or gtkbuilder? With Glade 3, gtkbuilder format is easy to use and easy to layout and design. Also, gtkbuilder is easier to load widgets from than glade was.
if by native code you mean "direct GTK calls to build ui", then i'd switch to it for several reasons:
if widgets are built dynamically depending on user preferences, etc
if i use a lot of custom widgets, esp. contained within each other (for example GDL docking panels)
to maintain backwards compatibility with older version of GTK
upd: also i'm still using glade2.x which has code generation (patched it to compile against latest gtk2). it really helps to get quickstart on "gui build from code", and works with both ancient and newer GTK versions. though i'm afraid i will have some troubles porting to gtk3 :)
and i never choose gtkbuilder over other alternatives, 'cause it is not available in (still widespread) older GTK versions.. dunno if i'll ever switch to it.. maybe when gtk3 comes out.