Re: OT comprehending large application (was What, in detail, the GDK do)
On Tue, Dec 29, 2009 at 08:44:05AM -0500, Patrick wrote: > Does any one person actually understand 18K pages of this code or is it > just a case of sticking to a small section? Could any pros out there > explain how you tackle this monumental task? By combination of two means: 1) Understanding of the concepts. On this level all widgets are the same. They are GObjects, their source code is similarly organized, they can be created, destroyed, mapped, unmapped, realized, unrealized, resized, they can receive events and draw themselves and do a few other things. Many do not do all. Some are containers and organize other widgets inside. And that's just it. 2) Following the specific code I'm interested in. In a good IDE (such as vim ;-) this is usally easy. Since people often expect the widgets to do something reasonable even in non-reasonable situations this may involve reading code carefuly working about some obscure problem unclear to you. But keeping the big picture in mind the general purpose of the code should be still clear. I don't think anyone understands all the Gtk+ code, but it is not necessary. Figuring out how something in Gtk+ works has never been a big problem for me. The hard part is always to figure out how something *should* work. Yeti ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: What, in detail, the GDK do?
> a hint to 60MB of sourcecode (18.000+ pages > if printed out) is no good answer to such a > question from someone new to gtk. Especially > with all that hurdles like GSEAL to understand > it. Well, I not so new in gtk+. I'm here more than a year. This thread is just to clarify a question that's not clarify for me, because I've never been behind the low level of a window system... And yes, I agree that search on 60 MB of sourcecode is a good way to clarify this, so I came here and created this thread. Thanks for all that respond my question, it's now clear to me. 2009/12/29 David Nečas : > On Tue, Dec 29, 2009 at 02:19:38PM +0100, Joost wrote: >> a hint to 60MB of sourcecode (18.000+ pages >> if printed out) is no good answer to such a >> question from someone new to gtk. Especially >> with all that hurdles like GSEAL to understand >> it. > > Someone new to Gtk+ but knowing X or GDI+the windowing bits of Win32 or > something similar just looks at the Gdk docs table of contents and says > `I see' as he notices the familiar topics: windows, rectangles, bitmaps, > drawing primitives, font/text handling, devices, etc. (Of course, *how* > Gdk handles them still involves ugly technical code, but that's > expected.) > > Someone new to both Gtk+ and the fundamentals does not need to know that > Gdk *exists*. There are many more important things to learn first if > you want to develop Gtk+ apps. > > But if he's curious and wishes to study the low-level stuff then, by all > means, he should look at the source code. But first look at some > overview of X because the influence of X concepts on Gdk is strong and > evident (and due to X's importance and age much more have been written > about it than about Gdk). Actually, going to MSDN and reading about > Win32 might do too. > >> A clue to understanding gtk is certainly to >> understand the difference between gtk.Window and >> gtk.gdk.Window (here in the spelling of pygtk). >> Thus to read and thoroughly understand >> >> http://library.gnome.org/devel/gtk/stable/GtkWindow.html >> >> and >> >> http://library.gnome.org/devel/gdk/stable/gdk-Windows.html > > Aside from the first short paragraph, the GtkWindow documentation is > utter gibberish if you don't already know *what* it's talking about. > > For instance, the first paragraph is immediately followed by a > complicated 100+ lines example showing how to do composited windows. > What the hell are composited windows? (I know, but this is the likely > reaction.) > > So, no, don't read this to figure out what Gdk does. > > Yeti > > ___ > gtk-list mailing list > gtk-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-list > -- Thanks, Frederico Schardong, SOLIS - Open source solutions www.solis.coop.br Linux registered user #500582 ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: OT comprehending large application (was What, in detail, the GDK do)
Hi Patrick, 2009/12/29 Patrick : > Does any one person actually understand 18K pages of this code or is it just > a case of sticking to a small section? Could any pros out there explain how > you tackle this monumental task? People vary in how much code they can hold in their head in any detail, but I doubt if anyone could manage 60MB of source. A lot of software design is about how to structure a large project so that you only need to understand a smallish bit at any one time. The general principle is always "divide and conquer". For GTK, you need to understand GObject (the object model) and GtkWidget (the GTK base class) and once you have that down pat, you can write your own widget subclasses. It's not so much code to understand. John ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: OT comprehending large application (was What, in detail, the GDK do)
One way might be to write a "real" application (even if it's just a "Hello World" display) and "drill down" through the source code to see how this seemingly small amount of code works at lower and lower levels. While this sounds easy, it's quite a learning experience, and IMHO is well worth the time spent. Ed James On Tue, Dec 29, 2009 at 8:44 AM, Patrick wrote: ... > a case of sticking to a small section? Could any pros out there explain how > you tackle this monumental task? ... ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: What, in detail, the GDK do?
On Tue, Dec 29, 2009 at 02:19:38PM +0100, Joost wrote: > a hint to 60MB of sourcecode (18.000+ pages > if printed out) is no good answer to such a > question from someone new to gtk. Especially > with all that hurdles like GSEAL to understand > it. Someone new to Gtk+ but knowing X or GDI+the windowing bits of Win32 or something similar just looks at the Gdk docs table of contents and says `I see' as he notices the familiar topics: windows, rectangles, bitmaps, drawing primitives, font/text handling, devices, etc. (Of course, *how* Gdk handles them still involves ugly technical code, but that's expected.) Someone new to both Gtk+ and the fundamentals does not need to know that Gdk *exists*. There are many more important things to learn first if you want to develop Gtk+ apps. But if he's curious and wishes to study the low-level stuff then, by all means, he should look at the source code. But first look at some overview of X because the influence of X concepts on Gdk is strong and evident (and due to X's importance and age much more have been written about it than about Gdk). Actually, going to MSDN and reading about Win32 might do too. > A clue to understanding gtk is certainly to > understand the difference between gtk.Window and > gtk.gdk.Window (here in the spelling of pygtk). > Thus to read and thoroughly understand > > http://library.gnome.org/devel/gtk/stable/GtkWindow.html > > and > > http://library.gnome.org/devel/gdk/stable/gdk-Windows.html Aside from the first short paragraph, the GtkWindow documentation is utter gibberish if you don't already know *what* it's talking about. For instance, the first paragraph is immediately followed by a complicated 100+ lines example showing how to do composited windows. What the hell are composited windows? (I know, but this is the likely reaction.) So, no, don't read this to figure out what Gdk does. Yeti ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
OT comprehending large application (was What, in detail, the GDK do)
"a hint to 60MB of sourcecode (18.000+ pages if printed out) " I am sorry for the quite off topic post, but I can't help myself. I am just a part time programmer, I can understand the GTK API but there is no way I could contribute anything to the code base. I have been trying to learn more about how professionals study the projects they contribute to. I have been buying books on UML and software system designs but honestly this is all a mystery to me. It does not seem that many projects bother to construct UML diagrams and surely low-level one of GTK would fill a football field. Does any one person actually understand 18K pages of this code or is it just a case of sticking to a small section? Could any pros out there explain how you tackle this monumental task? Sorry again for going off topic-Patrick ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: What, in detail, the GDK do?
Hello, a hint to 60MB of sourcecode (18.000+ pages if printed out) is no good answer to such a question from someone new to gtk. Especially with all that hurdles like GSEAL to understand it. A clue to understanding gtk is certainly to understand the difference between gtk.Window and gtk.gdk.Window (here in the spelling of pygtk). Thus to read and thoroughly understand http://library.gnome.org/devel/gtk/stable/GtkWindow.html and http://library.gnome.org/devel/gdk/stable/gdk-Windows.html Good luck, Joost ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Widgets not windows, but how to get information about active widget on X layer? (was: What, in detail, the GDK do?)
On Tue, 2009-12-29 at 13:40 +0300, Peter Volkov wrote: > > as of gtk+ 2.18: > > > > s/Many/Some/ > > > > non-top level widgets (where "top level" here mostly means: GtkWindow > > and sub-classes, even though GtkMenu has to have a real X11 window > > associated with it for stacking purposes) that used X11 windows through > > GDK for event handling and drawing purposes now do not have those X11 > > windows any more - though they maintain the GdkWindow object for > > internal state handling and for ABI compatibility. > > > > usually, a GdkWindow is not associated to an X11 Window unless you > > explicitly require a XID out of it - at which point GDK will create a > > native Window and hand over to you its XID. > > But is it possible to find out at X layer what widget is receives input > at the moment? no, because a Widget is not a construct that X understands or has any knowledge about. > I'm asking because after widgets started to avoid > X-windows it became hard-to-impossible to write Punto Switcher killer > for linux (if interested in code take a look on xneur). This program > basically follows X input and in case it was written in wrong layout it > kills the text and rewrites it in correct layout. this is mostly wrong to do at X level. you should use the input method mechanisms offered by the various toolkits - both Qt and GTK+ have them. > But switching between > widgets should be handled somehow and now program follows mouse events > or listens for common accel keys to find out that widget changed. This > is not a best solution, so is it possible to expose this information > somehow? Could you share any ideas how this could be implemented? And > yes, qt has a same problem. this can only be implemented from within the frameworks of the toolkits, not from the outside. ciao, Emmanuele. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Widgets not windows, but how to get information about active widget on X layer? (was: What, in detail, the GDK do?)
В Втр, 29/12/2009 в 10:02 +, Emmanuele Bassi пишет: > On Mon, 2009-12-28 at 16:21 +0100, David Nečas wrote: > > On Mon, Dec 28, 2009 at 12:46:36PM -0200, frederico schardong wrote: > > > >gdk wraps the business of creating a window and getting events > > > > > > only a window or all the widgets? > > > > X (or Gdk) Window is a thing that can receive events and/or can be > > drawn on. Many widgets have their own windows, for instance, text > > entries or menus. > > as of gtk+ 2.18: > > s/Many/Some/ > > non-top level widgets (where "top level" here mostly means: GtkWindow > and sub-classes, even though GtkMenu has to have a real X11 window > associated with it for stacking purposes) that used X11 windows through > GDK for event handling and drawing purposes now do not have those X11 > windows any more - though they maintain the GdkWindow object for > internal state handling and for ABI compatibility. > > usually, a GdkWindow is not associated to an X11 Window unless you > explicitly require a XID out of it - at which point GDK will create a > native Window and hand over to you its XID. But is it possible to find out at X layer what widget is receives input at the moment? I'm asking because after widgets started to avoid X-windows it became hard-to-impossible to write Punto Switcher killer for linux (if interested in code take a look on xneur). This program basically follows X input and in case it was written in wrong layout it kills the text and rewrites it in correct layout. But switching between widgets should be handled somehow and now program follows mouse events or listens for common accel keys to find out that widget changed. This is not a best solution, so is it possible to expose this information somehow? Could you share any ideas how this could be implemented? And yes, qt has a same problem. -- Peter. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: What, in detail, the GDK do?
On Mon, 2009-12-28 at 16:21 +0100, David Nečas wrote: > On Mon, Dec 28, 2009 at 12:46:36PM -0200, frederico schardong wrote: > > >gdk wraps the business of creating a window and getting events > > > > only a window or all the widgets? > > X (or Gdk) Window is a thing that can receive events and/or can be > drawn on. Many widgets have their own windows, for instance, text > entries or menus. as of gtk+ 2.18: s/Many/Some/ non-top level widgets (where "top level" here mostly means: GtkWindow and sub-classes, even though GtkMenu has to have a real X11 window associated with it for stacking purposes) that used X11 windows through GDK for event handling and drawing purposes now do not have those X11 windows any more - though they maintain the GdkWindow object for internal state handling and for ABI compatibility. usually, a GdkWindow is not associated to an X11 Window unless you explicitly require a XID out of it - at which point GDK will create a native Window and hand over to you its XID. ciao, Emmanuele. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: What, in detail, the GDK do?
28.12.09, 12:46, "frederico schardong" : > >gdk wraps the business of creating a window and getting events > only a window or all the widgets? Everything below GTK+ is just to make things cross-platform. GTK+ widgets do use GDK windows and other primitives. GDK is a thin layer that provides same interface to windowing system (X11, GDI, Quartz, etc.) on all platforms supported. Its interface is very close to Xlib, and wraps some functionality described at freedesktop.org on platforms that do not conform freedesktop.org standards. GDK primitives are: real windows and events, off-screen pixel buffers, selections (low-level clipboard), drag-n-drop (again, low-level), keyboard, pointer, other input devices. [1] Shortly, GTK+ widgets use GDK for interaction, cairo for (custom) painting, pango for painting text. GLib [2] is extended cross- platform version of clib, plus ADT, OO, utf-8, io, etc. GTK+ and GDK do use GLib, pango and cairo do not. Moreover, GDK, pango and cairo do not form strict hierarchy -- they all have many backends and may cooperate in different ways on different platforms or applications. (i'm not sure whether this is true for GTK+ implementation, however) [1] http://library.gnome.org/devel/gdk/stable/ [2] http://library.gnome.org/devel/glib/stable/ -- Artur ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: What, in detail, the GDK do?
A good book on programming for the X Window System is "Xlib Programming Manual" by Adrian Nye (O'Reilly & Associates, Inc"). I've been using it to try building my own object-oriented "toolkit" using C++. My stuff will never be "production quality", but it really helps understand what is happening at low levels. Ed James 2009/12/28 David Nečas : ... > I'm afraid to understand what Gdk does cannot be understood without > understading the basic X window system concepts. Because essentially ... ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: What, in detail, the GDK do?
On Mon, Dec 28, 2009 at 12:46:36PM -0200, frederico schardong wrote: > >gdk wraps the business of creating a window and getting events > > only a window or all the widgets? X (or Gdk) Window is a thing that can receive events and/or can be drawn on. Many widgets have their own windows, for instance, text entries or menus. I'm afraid to understand what Gdk does cannot be understood without understading the basic X window system concepts. Because essentially all Gdk does is providing platform-independent abstraction of these concepts (plus some other low-level utilities). Yeti ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: What, in detail, the GDK do?
>gdk wraps the business of creating a window and getting events only a window or all the widgets? 2009/12/28 : > 2009/12/28 frederico schardong : >> So how low level GDK goes? It renders the widgets according the OS? >> Where GTK+ ends and GDK starts? Where GDK ends and GLib starts? > > You can read about it here: > > http://www.gtk.org/documentation.html > > gdk wraps the business of creating a window and getting events, cairo > does low-level drawing, glib does data structures, utility functions > and event loops, gobject is the object model, pango renders text, > gdkpixbuf loads and transforms images, gtk issues all the drawing > commands to display widgets, your application does everything else. > > John > -- Thanks, Frederico Schardong, SOLIS - Open source solutions www.solis.coop.br Linux registered user #500582 ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: What, in detail, the GDK do?
2009/12/28 frederico schardong : > So how low level GDK goes? It renders the widgets according the OS? > Where GTK+ ends and GDK starts? Where GDK ends and GLib starts? You can read about it here: http://www.gtk.org/documentation.html gdk wraps the business of creating a window and getting events, cairo does low-level drawing, glib does data structures, utility functions and event loops, gobject is the object model, pango renders text, gdkpixbuf loads and transforms images, gtk issues all the drawing commands to display widgets, your application does everything else. John ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: What, in detail, the GDK do?
> Frederico Schardong, > SOLIS - Open source solutions Presumably you know what "open source" means, then, do you? Hint: you have access to the source code. --tml ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
What, in detail, the GDK do?
Hi, I have looked at wikipedia the explication about GDK and would like to know more about this sentence: "GDK (GIMP Drawing Kit) is a computer graphics library that acts as a wrapper around the low-level drawing and windowing functions provided by the underlying graphics system." So how low level GDK goes? It renders the widgets according the OS? Where GTK+ ends and GDK starts? Where GDK ends and GLib starts? -- Thanks, Frederico Schardong, SOLIS - Open source solutions www.solis.coop.br Linux registered user #500582 ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list