Latest revision |
Your text |
Line 5: |
Line 5: |
| | | |
| | | |
- |
| |
- |
| |
- | ===IRC with Timeless concerning GTK stuff with the sound applet:===
| |
- |
| |
- | rm_you: open the official sound statusbar applet code
| |
- |
| |
- | rm_you: search for hildon_hvolumebar_new
| |
- |
| |
- | timeless: Searching...
| |
- |
| |
- | timeless: ok
| |
- |
| |
- | timeless: Found one matching line
| |
- |
| |
- | rm_you: and then once you know what the name of that object is, find what container they add it to
| |
- |
| |
- | rm_you: then all I need to know is what type of container it is
| |
- |
| |
- | timeless: it gets munged by gtk_box_pack_start
| |
- |
| |
- | rm_you: gtk_box_pack_start... ok
| |
- |
| |
- | rm_you: into what kind of box
| |
- |
| |
- | rm_you: and what does that box get added to
| |
- |
| |
- | timeless: gtk_vbox_new (false, 5)
| |
- |
| |
- | timeless: and into the soundwindow, whatever that is
| |
- |
| |
- | rm_you: ok, so they put the "hildon_hvolumebar_new" object into a "gtk_vbox_new" object
| |
- |
| |
- | rm_you: and that gets added to... a "soundwindow"?
| |
- |
| |
- | timeless: g_object_new (... "statusbar-item" ...)
| |
- |
| |
- | rm_you: ... what?
| |
- |
| |
- | timeless: yeah a SOUND_TYPE_WINDOW
| |
- |
| |
- | rm_you: can you do a search for "gtk_menu"
| |
- |
| |
- | timeless: oh. yeah, essentially this re-implements and delegates to things :)
| |
- |
| |
- | rm_you: ?
| |
- |
| |
- | timeless: basically the sound_window thing acts almost like a gtkmenu container
| |
- |
| |
- | timeless: and special handles things to make it all work :)
| |
- |
| |
- | rm_you: ....
| |
- |
| |
- | timeless: e.g. it has a set_focus method which will call gtk_menu_item_(de)select on things
| |
- |
| |
- | rm_you: so
| |
- |
| |
- | rm_you: but
| |
- |
| |
- | rm_you: but
| |
- |
| |
- | rm_you: but
| |
- |
| |
- | rm_you: WHAT!?
| |
- |
| |
- | timeless: sorry, I'm definitely not copying the rest of the code
| |
- |
| |
- | timeless: but yeah, pretty much, that's it :)
| |
- |
| |
- | timeless: oh yeah... the window calls gtk_window_set_type_hint(...., GDK_WINDOW_TYPE_HINT_MENU)
| |
- |
| |
- | rm_you: yeah but... there must be something special... I *tried* putting the hildon_hvolumebar_new object into a vbox into a GtkMenu/GtkMenuItem
| |
- |
| |
- | rm_you: it doesn't work
| |
- |
| |
- | rm_you: so they have a custom implementation of GtkMenu?
| |
- |
| |
- | timeless: yep
| |
- |
| |
- | rm_you: that's... ridiculous
| |
- |
| |
- | rm_you: is it in the statusbar code? or is it in a library?
| |
- |
| |
- | timeless: it's in the same file as far as I can tell
| |
- |
| |
- | rm_you: <_<
| |
- |
| |
- | timeless: but there's no way I can justify sharing it
| |
- |
| |
- | rm_you: how long is it
| |
- |
| |
- | rm_you: <_<
| |
- |
| |
- | timeless: you should just instrument gtk
| |
- |
| |
- | rm_you: just tell me as much as you can ABOUT it
| |
- |
| |
- | timeless: it's not that hard
| |
- |
| |
- | rm_you: I tried asking people in #gtk+
| |
- |
| |
- | rm_you: multiple people told me either that what I wanted to do wasn't possible without some serious hackage, or that I would have to rewrite my own gtkmenu system
| |
- |
| |
- | timeless: I mean, this should be fairly easy... you either use a perl script to rewrite the library entry points
| |
- |
| |
- | timeless: or use a debugger to dynamically do it
| |
- |
| |
- | timeless: either way, it's fairly trivial
| |
- |
| |
- | timeless: all you need is for each gtk method to spit out at entry all strings and all pointers, and at exit to spit out any returned pointers
| |
- |
| |
- | timeless: from there since everything is a gtk call, you can find out which methods are called in order for each object
| |
- |
| |
- | rm_you: htm
| |
- |
| |
- | timeless: it is "serious" hackage, but it's fairly automatable
| |
- |
| |
- | timeless: so it's not "hard" hackage
| |
- |
| |
- | timeless: more like "thorough"
| |
- |
| |
- | rm_you: hrm. I don't think I know enough about GTK to do that though. :(
| |
- |
| |
- | rm_you: I'll have to find help
| |
- |
| |
- | rm_you: though duplicating that is ridiculous
| |
- |
| |
- | rm_you: Nokia has no reason to keep that closed
| |
- |
| |
- | rm_you: in fact, it should probably be a separate library, eg HildonMenu
| |
- |
| |
- | * timeless nods
| |
- |
| |
- | rm_you: and be put into libhildon
| |
- |
| |
- | timeless: I might give you perl that would hack gtk_ for this...
| |
- |
| |
- | timeless: it really shouldn't be that bad
| |
- |
| |
- | rm_you: I tried rewriting GtkMenu / GtkMenuItem last week
| |
- |
| |
- | rm_you: it turned into a nightmare
| |
- |
| |
- | rm_you: I don't know nearly enough about the inner workings of GTK to mess with that stuff <_<
| |
- |
| |
- | timeless: well... you'd want something like:
| |
- |
| |
- |
| |
- | #!/usr/bin/perl
| |
- |
| |
- | unless (/^gtk_.*_set_/) { print; next; }
| |
- |
| |
- | if (/\((.*)\)/) {
| |
- |
| |
- | # one line case - not implemented because afaict, gtk doesn't use it
| |
- |
| |
- | } elseif (/\((.*)/) {
| |
- |
| |
- | #multi line case
| |
- |
| |
- | my @args = ();
| |
- |
| |
- | some_looping_here:
| |
- |
| |
- | /\((?:const\s+|)(\S+)\s+(\*|)(\S+)([.)])/;
| |
- |
| |
- | my ($type, $pointer, $name, $more) = ($1, $2, $3, $4);
| |
- |
| |
- | push @args, $name;
| |
- |
| |
- | $types{$name} = $type;
| |
- |
| |
- | $pointers{$name} = $pointer;
| |
- |
| |
- | goto some_looping_here if ($more eq ',');
| |
- |
| |
- | #oops, probably would have been a good idea to read another line from input before doing that goto :)
| |
- |
| |
- | #some perl assembly required ;-)
| |
- |
| |
- | #at this point we've reached a line that ends in )
| |
- |
| |
- | #we probably should have been printing the lines somewhere too... oh well, more assembly required
| |
- |
| |
- | #eat the next line
| |
- |
| |
- | <>;
| |
- |
| |
- | die "i was really hoping to see an open brace ..." unless /^[{]/;
| |
- |
| |
- | foreach my $arg (@args) {
| |
- |
| |
- | if ($pointers{$arg}) { print qq#fprintf(stderr, "$arg %p ", $arg);\n#; }
| |
- |
| |
- | elseif ($types{$arg} =~ /int$/i) { print qq#fprintf(stderr, "$arg %d, ", $arg);\n#; }
| |
- |
| |
- | else {
| |
- |
| |
- | #hrm, better work could be used here, you'll have to figure out what other creatures there are... you probably wanted to special case char before pointer :)
| |
- |
| |
- | print qq#fprintf(stderr, "$arg %p, ", & $arg);\n#; }
| |
- |
| |
- | }
| |
- |
| |
- | print qq#fprintf(stderr, "\n");\n#;
| |
- |
| |
- | #ok... thats a draft for the head
| |
- |
| |
- | #in theory you'd want to deal w/ gtk_new and anything else that creates a pointer, but in practice, you won't really need it
| |
- |
| |
- | #the goal is basically perl myscript.pl < gtkmenu.c > gtkmenu-evil.c
| |
| | | |
| ===Emails from Timeless concerning GTK stuff with applets:=== | | ===Emails from Timeless concerning GTK stuff with applets:=== |