|
Post by barryk on Mar 31, 2011 10:10:30 GMT 1
The HUG WINDOW function is somewhat limited, the parameters are just title and x and y coords.
I would like to put in a request that the WINDOW function have more capability.
For example, when a window is created, requests can be sent to the window manager:
no decorations Without decorations, the titlebar and borders would not display.
position Request absolute coord, center, mouse-position.
minimized Request to startup minimized in tray.
I don't know how you would actually implement these in the WINDOW function.
Regards, Barry Kauler
|
|
|
Post by Pjot on Apr 1, 2011 16:28:48 GMT 1
Hi Barry, Yes, you are right. The downside of an abstraction layer is that the resulting API is somewhat limited. Of course one can always use regular GTK functions in addition to the default HUG calls but I can imagine this is a little bit ugly. Nevertheless there may be an interesting solution: we can add a HUG function like PROPERTY(widget, "name", "value") to set any property of a widget? Your request below can be set with the following properties: no decorations "decorated" property position "window-position"minimized in tray <not sure if this is possible> What do you think about this? Regards Peter
|
|
|
Post by Pjot on Apr 1, 2011 20:07:23 GMT 1
With the new HUG 0.40 you can use PROPERTY to set any property of any widget. INCLUDE "hug.bac", INIT, WINDOW, BUTTON, ATTACH, CALLBACK, DISPLAY, PROPERTY
GLOBAL flag
SUB Test_Properties
flag = 1 - flag
IF flag THEN PROPERTY(win, "decorated", FALSE) ELSE PROPERTY(win, "decorated", 1)
END SUB
INIT win = WINDOW("", 200, 200)
button = BUTTON("Click here", 70, 30) ATTACH(win, button, 10, 10) CALLBACK(button, Test_Properties)
' We can set some properties here PROPERTY(win, "title", "Goodbye") PROPERTY(win, "tooltip-text", "Testing the properties")
DISPLAY
Regards Peter
|
|
|
Post by vovchik on Apr 1, 2011 22:24:09 GMT 1
Dear Peter, What a nice and elegant solution.... With kind regards, vovchik PS. I will try it out now.
|
|
|
Post by barryk on Apr 3, 2011 13:25:35 GMT 1
Wow, I was away for a couple of days, and I come back to read this forum and there is a very nice and elegant implementation for window properties.
Yes, a window can be started minimised.
There is also a property that the window can send a hint to the window manager or tray manager not to register in the tray. I just noticed yesterday that gtkdialog implements that property:
export DIALOG=' <window title="Example Window" skip_taskbar_hint="true"> <vbox> <frame Description> <text> <label>skip_taskbar_hint=true</label> </text> </frame> <hbox> <button ok></button> <button cancel></button> </hbox> </vbox> </window> ' gtkdialog3 --program=DIALOG
...this is very handy if you want a popup window that you don't want to appear in the tray. Sometimes secondary windows that are not the main window would benefit from this.
Anyway, great development, I will download latest HUG and play with it!
|
|
|
Post by Pjot on Apr 6, 2011 16:29:01 GMT 1
Thanks Barry! I also have added the PROPERTY function to the syntax files. Regards Peter
|
|
|
Post by barryk on Apr 7, 2011 11:00:53 GMT 1
Peter, Would you mind also putting the definition for PROPERTY into hug_imports.bac?
I tried to do it myself, but was unsure of correct syntax.
Regards, Barry
|
|
|
Post by Pjot on Apr 7, 2011 12:25:57 GMT 1
Hi Barry, The IMPORT definition would be this: IMPORT "PROPERTY(long,char*,...)" FROM HUG_lib$ TYPE void
However, currently PROPERTY is defined as a macro and cannot be IMPORT'ed from a shared object You may wonder why it is done like that. Thing is that PROPERTY accepts variable types for the property, like a char or long or anything else. This cannot be wrapped in a regular function as the C 'varargs' API to obtain a variable list of arguments must cast the incoming values using a type. And we don't know the type of the value in advance. Best regards Peter PS I forgot to mention that you do not need to import PROPERTY. It is defined in the INIT function. So as soon as INIT is imported also PROPERTY will be available.
|
|
|
Post by barryk on Apr 8, 2011 13:34:50 GMT 1
The problem I have is this will not compile:
INCLUDE "hug_imports.bac" INIT
mainwin = WINDOW("", 425, 285)
PROPERTY(mainwin,"decorated",FALSE) PROPERTY(mainwin,"title","title here")
DISPLAY
...what do I have to do to make it compile? It can't parse the PROPERTY lines.
|
|
|
Post by Pjot on Apr 8, 2011 14:37:39 GMT 1
Hi Barry,
Well you are right and I must apologize - I have mixed up the way you import functions from a Shared Object on the one hand with the selective INCLUDE method on the other hand.
So what I was saying works in case one uses this:
INCLUDE "hug.bac", INIT, WINDOW, DISPLAY INIT
mainwin = WINDOW("", 425, 285)
PROPERTY(mainwin,"decorated",FALSE) PROPERTY(mainwin,"title","title here")
DISPLAY
However, you are importing from HUG as a shared object. Then this doesn't work because the PROPERTY directive is defined as a macro which needs a preprocessor.
I am looking for a solution and will come back to this.
Best regards Peter
|
|
|
Post by barryk on Apr 10, 2011 12:00:34 GMT 1
Here is another problem. See this program:
INCLUDE "hug.bac" INIT
mainwin = WINDOW("", 425, 285)
PROPERTY(mainwin,"title","title here") PROPERTY(mainwin,"skip-taskbar-hint",TRUE) PROPERTY(mainwin,"decorated",FALSE)
DISPLAY
...the strange thing about this program is that the window displays with decorations, however the other two properties do work.
I am puzzled by this, as Vovchik wrote an application named 'psplash' that can set the 'decorated' property to FALSE and psplash does work. I looked at Vovchik's code and can't see anything significantly different.
I am using Puppy Linux Quirky 141 with JWM 500 window manager.
|
|
|
Post by Pjot on Apr 10, 2011 14:38:15 GMT 1
Hi Barry,
Strange indeed! On my Ubu 10.10 this program works fine, the window appears without decorations.
Regards Peter
|
|
|
Post by Pjot on Apr 10, 2011 17:03:42 GMT 1
Can you try to compile the following plain C program:
#include <stdio.h> #include <unistd.h> #include <gtk/gtk.h> #include <stdlib.h>
int main( int argc, char *argv[] ) { GtkWidget *window;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW (window), 425, 285);
g_object_set(window, "title", "title here", NULL); g_object_set(window, "skip-taskbar-hint", 1, NULL); g_object_set(window, "decorated", 0, NULL);
gtk_widget_show_all(window);
gtk_main (); }
Compile as follows:
If you run it and there is still the same problem, then we know it is an issue with your Window Manager (and not BaCon).
Thanks, Peter
|
|
mave
New Member
Posts: 5
|
Post by mave on Apr 10, 2011 18:59:42 GMT 1
Hi Peter, Hi Barry, this is not your solution, but my "uuups". Tried this code snip in Wary5(q) and got this gcc demo.c -o demo `pkg-config --libs --cflags gtk+-2.0` /usr/X11R7/lib/libxcb-xlib.so.0: undefined reference to `_xcb_unlock_io' /usr/X11R7/lib/libxcb-xlib.so.0: undefined reference to `_xcb_lock_io' collect2: ld returned 1 exit status Had this before while the try to compile seamonkey in Puppy. Is this a C-issue or puppy special? mave
|
|
|
Post by Pjot on Apr 10, 2011 19:09:22 GMT 1
@barry: can you try HUG v0.41 and import the PROPERTY method from HUG as a shared object? I have added its definition also to hug_imports now. mave: seems that you are missing some Xlibraries on your system, probably your GTK installation is broken...? Regards Peter
|
|