TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How Does One Create A Gtk+ Application?

157 pointsby xamlhackeralmost 11 years ago

19 comments

jbkalmost 11 years ago
This state of Gtk sad, but I&#x27;m really glad we (VLC) moved to Qt, a few years ago (2006), before many applications did the switch, and when it was an unpopular move.<p>Before that time, we were using WxWidgets and had many issues, notably with Unicode and Windows support. WxWidget APIs and behaviors were changing too much between releases (even minor ones).<p>When we moved, we were in the early Qt 4.1&#x2F;4.2 days, and most VLC developers were using Gnome and pushed a lot for Gtk. But one developer started the new UI in Qt, and I picked up the work. We had an important backlash from users, notably with some people in the community recoding an interface in Gtk...<p>Afterwards, QGtkStyle was introduced, and people could have a native look, even with Gtk environments.<p>Finally, Qt moved to a community project, to LGPL and Gtk went down the road with Gtk 3.x, breaking themes, Windows, OSX, and API&#x2F;behaviors at every release (and removing features).<p>Those days, every cross-platform application are moving to Qt (subsurface, LXDE, wireshark, audacity). It&#x27;s funny that we made this decision, at that time, without knowing all that. I think we just got very lucky... :D
评论 #7993455 未加载
评论 #7993469 未加载
评论 #7993407 未加载
评论 #7994025 未加载
scrollawayalmost 11 years ago
This post was written by Morten Welinder, the author of Gnumeric and a popular GNOME blogger.<p>I feel really bad for GTK developers. The GNOME guys have clearly taken the toolkit from a &quot;general purpose&quot; direction to a much more gnome-centric one.<p>At the same time though, I can&#x27;t help but be hopeful for the future. Qt is a wonderful project, with a bunch of wonderful licenses, developed in a wonderfully-open environment (It&#x27;s not like before!) and with wonderful improvements already available in Qt 5. With more and more applications switching to it, I see Qt as a central part of the Linux desktop ecosystem in the future - finally, not only will we have a beautiful desktop with common themes for all apps, but also the power of a truly cross-platform toolkit in most Linux apps. It will be nice.
评论 #7993249 未加载
评论 #7993208 未加载
评论 #7993212 未加载
pdkl95almost 11 years ago
There is a lot about GTK I like; it&#x27;s a C library making compatibility easier[1], it always seemed way faster (less memory bloat?) than QT, and while the widget-packing&#x2F;nesting style was somewhat ugly, I found it surprisingly easy to write.<p>I was even enjoying Vala. While it was obviously a young language, it had a lot of interesting ideas.<p>Then we got the new 3.x version of GTK with its &quot;lets rewrite everything for no other reason than to break compatibility&quot;[2] project goal that seems to have corrupted far too many projects recently. In addition to the problems already mentioned in this thread, it seemed so.. <i>unfinished</i>. Various components or features were gone or rewritten into something else. I guess they spent all their development time trying to tie Gnome and in as tightly as possible instead of finishing features.<p>The last straw was when they decided to join Pottering&#x27;s &quot;lets forget Unix and make Linux into Windows&quot; crusade. A terrible design decision on top of years of other questionable choices and bad attitude about actually listening to user needs.<p>I supported GTK and Gnome waaaaay back when they first started, when the fight was between a Free (GPL) library and the increasingly popular proprietary-license-only[3] Qt. Now, I&#x27;m not sure what to support in the GUI toolkit area.<p>While I figure that out, my current project&#x27;s GUI is being written in ruby-tk. The widgets in Tk have a terrible look and strange layout&#x2F;interaction quirks, but at least it isn&#x27;t a moving target and work more or less everywhere.<p>[1] e.g.: writing Ruby bindings C++ libraries can be problematic. While problems such as the name-mangled symbols are not as bad as they once were, it is still much easier to link a C library into a random environment.<p>[2] As Linus said, &quot;...thou shalt not break working code.&quot;<p>[3] Trolltech changed the license about a year (?) afterwords.
评论 #7994470 未加载
评论 #7993679 未加载
skriticos2almost 11 years ago
I just watched this [1] video from Dirk Hohndel describing the migration motives and process from Gtk+ to Qt for subsurface (started by Linus).<p>TLDR:<p>* Qt has a community of people developing applications, has good documentation (precise, good coverage) and people who care<p>* Gtk+ has a bunch of Gnome developers, if you want to develop an application, you&#x27;re out of luck<p>[1]: <a href="https://www.youtube.com/watch?v=ON0A1dsQOV0" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=ON0A1dsQOV0</a>
评论 #7993454 未加载
nawitusalmost 11 years ago
It&#x27;s unfortunate that Linux and&#x2F;or Linux distributions have not yet solved the problem of supporting parallel versions of dependencies. Even Node&#x27;s package manager supports that. The end result is that rolling release distros break stuff often, as applications can&#x27;t be tested and executed in isolation of each other. The &quot;solution&quot; to this is releasing everything every 6 months, when you can actually test everything together, then stop providing new versions for months.<p>If Linux&#x2F;Linux distributions did support it, rolling release would be a lot more common. One limitation that would remain is that if you have an application that requires a single instance (e.g. a Network Manager), you couldn&#x27;t have multiple instances of it running at the same time.
评论 #7993946 未加载
评论 #7993340 未加载
评论 #7993600 未加载
评论 #7994173 未加载
评论 #7993360 未加载
评论 #7994228 未加载
samdroidalmost 11 years ago
I really think this is exaggerated a lot. Maybe we don&#x27;t use a lot of complex features, but at sugarlabs we have written a whole desktop environment and app ecosystem based of gtk3. We use the python gtk3 wrapper and I think there was only 1 instance this year where gtk3 broke our ui (icon_size got removed or something like that). We also use a lot of other gnome things (eg: gsettings) and those don&#x27;t seem to be an issue.
bleh_almost 11 years ago
<p><pre><code> Parts of the gui that used to render correctly now stops updating at all. </code></pre> I suffer this problem with an image viewer (geeqie) on debian. I have to restore&#x2F;maximize the window to force a redraw and it has been like that for months.
matthiasvalmost 11 years ago
It would be nice, if the author would back his claims by specific references. Comparing the upstream tracker reports for GTK+ and Qt shed a different light on ABI compatibility between versions:<p><a href="http://www.upstream-tracker.org/versions/gtk+.html" rel="nofollow">http:&#x2F;&#x2F;www.upstream-tracker.org&#x2F;versions&#x2F;gtk+.html</a> <a href="http://www.upstream-tracker.org/versions/qt.html" rel="nofollow">http:&#x2F;&#x2F;www.upstream-tracker.org&#x2F;versions&#x2F;qt.html</a><p>(Yes, yes, Qt does more than just GUI, I know …)
Htsthbjigalmost 11 years ago
We loved GTK. It let us do great things for so many years... it was a necesary step while there were no other LGPL libraries.<p>But we got rid of it, changed all our code to Qt, which run circles around GTK Never looked back, best decision we could ever make. It works beautifully in all platforms, it integrates OpenGL, pdf output, printers support.<p>The only problem about Qt is that not all open source programs use it, so you use Inkscape(GTK) in Mac and works so badly, you can&#x27;t even copy vectors(it copies pixel images instead!!).<p>GTK should die.
raverbashingalmost 11 years ago
If you need GTK for something, really, don&#x27;t bother. It&#x27;s a bag of hurt.<p>Qt, WxWidgets, or even something else.<p>I&#x27;m so glad the Web and Modern Browsers reinvented &quot;desktop applications&quot;.
评论 #7993237 未加载
评论 #7993910 未加载
oliwarneralmost 11 years ago
There is a lot of truth in this but it does take a very lazy attitude to testing.<p>The simple truth is that if you need your application to support certain distributions, you need to be there on the development releases testing them and either submitting bug reports or improving <i>your</i> application.<p>And you can automate much of this with a pile of bootable ISOs and a scriptable virtual machine. Testing isn&#x27;t new.
评论 #7993859 未加载
评论 #7993338 未加载
评论 #7993276 未加载
achiangalmost 11 years ago
FYI, for those who want to write cross-platform GUI apps but prefer to avoid C++ (even the mildly nicer Qt flavor...), there are alpha-quality go bindings for QML.<p><a href="https://github.com/go-qml/qml" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;go-qml&#x2F;qml</a>
vfclistsalmost 11 years ago
Folk who want to develop cross platform software GUI software should use Lazarus. It works on Linux, Windows and OS&#x2F;X. Getting started can be dicey, what once you are up and running it simply works. The LCL doesn&#x27;t use the latest Qt5 or Gtk3, but it just works.<p>Linux guys should stuff faffing about with endless compile times in C++, buffer overruns and pointer exceptions. They should use FreePascal and Lazarus and retain their sanity.
bitwizealmost 11 years ago
I&#x27;m actually teaching myself Xt Intrinsics and Xaw, because &quot;lateral thinking with withered technology&quot;. It&#x27;s crazy, I know it&#x27;s crazy, but when I read about what a moving target the new hotness is, I wonder if there isn&#x27;t some kernel of wisdom in looking to the battle-tested technology of the past for inspiration.
aksxalmost 11 years ago
I&#x27;ve been using Gtk+ with Vala for almost 3 years now and i love it.<p>I tried Qt and liked the fact that it had good libraries built in (using the provided networking library v&#x2F;s using libsoup with Gtk+)<p>In my opinion Gtk+ with C is a big pain but Vala feels natural and should&#x27;ve been pushed instead of JavaScript by the gnome guys.
1risalmost 11 years ago
&gt;How does one shield oneself from this, i.e., how does one ensure that the binary compiled (say) three years (or months) ago continues to work reasonably?<p>Static linking should save you from from this hell. I don&#x27;t know if gtk even supports it, I know glibc does not, whitch is a shame.
stefantalpalarualmost 11 years ago
ABI compatibility should not be a huge problem for distributions. They can just recompile all the packages linking against GTK+ when they update it.<p>The crazy stuff is having your window decorations disappear when running a GTK application under openbox because somebody thought it would be funny to screw with gtk+-3.12 [1].<p>[1]: <a href="http://redmine.audacious-media-player.org/boards/1/topics/1135" rel="nofollow">http:&#x2F;&#x2F;redmine.audacious-media-player.org&#x2F;boards&#x2F;1&#x2F;topics&#x2F;11...</a>
评论 #7993453 未加载
评论 #7993989 未加载
pipelonealmost 11 years ago
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4028.pdf" rel="nofollow">http:&#x2F;&#x2F;www.open-std.org&#x2F;jtc1&#x2F;sc22&#x2F;wg21&#x2F;docs&#x2F;papers&#x2F;2014&#x2F;n402...</a>
评论 #7993154 未加载
评论 #7993164 未加载
rjzzleepalmost 11 years ago
even though Qt might and wxwidgets might be better(wxwidgets is really more a wrapper to different gui backends), IMHO linux lacks a proper gui toolkit.<p>creating gui applications is much better in both windows in osx. Cocoa was a fairly well designed base api that gradually got improved. (yeah, there is a lot of valid criticism here too, but we&#x27;re comparing it to gtk in this case)<p>We should build something that can gradually phase out GTK as was done with Carbon. If linux had a nice gui toolkit people would write more linux desktop applications.<p>Just my opinion. So feel free to completely disagree with it.
评论 #7993357 未加载
评论 #7993387 未加载