xforms-development
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XForms] Some requests


From: Jens Thoms Toerring
Subject: Re: [XForms] Some requests
Date: Mon, 28 Dec 2009 20:50:08 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

Hi LukenShiro,

On Mon, Dec 28, 2009 at 07:33:10PM +0100, LukenShiro wrote:
> Sorry to be somehow annoying ;-) but I've found some other cases of
> X11 functions in demos files, from current git:
> 
> demos/canvas2.c:170:
>    XSetForeground( fl_get_display( ), canvasGC,
> fl_get_flcolor( FL_BLACK ) );
> 
> demos/canvas.c:158:
>   XSetForeground( fl_get_display( ), canvasGC,
> fl_get_flcolor( FL_BLACK ) );
> 
> demos/freedraw.c:113:
>   XSetForeground( dpy, gc, fl_get_pixel( col ) );
> 
> demos/freedraw_leak.c:90:
>   XSetForeground(dpy, gc, fl_get_flcolor(col));
> 
> demos/demo27.c:295:
>   XClearWindow( fl_display, main_win );
> 
> demos/canvas2.c:70:
>   XFillRectangle( fl_get_display( ), win, canvasGC, 0,
> 0, w, h );
> 
> demos/canvas.c:76:
>   XFillRectangle( fl_get_display( ), win, canvasGC, 0, 0, w, h );
> 
> demos/canvas2.c:91:
>   XKeycodeToKeysym( fl_display, ev->xkey.keycode, 0 ) );
> 
> demos/canvas.c:97:
>   XKeycodeToKeysym( fl_display, ev->xkey.keycode, 0 ) );
> 
> demos/canvas2.c:168:  
>   canvasGC =
>   XCreateGC( fl_get_display( ),fl_state[ fl_vmode ].trailblazer, 0, 0 );
> 
> demos/canvas.c:156:
>   canvasGC = XCreateGC( fl_get_display() ,
> fl_state[ fl_vmode ].trailblazer, 0, 0 );
> 
> demos/freedraw.c:116:
>   XFillPolygon( dpy, win, gc, xpoint, 3, Nonconvex, Unsorted );
> 
> demos/freedraw_leak.c:92:
>    XFillPolygon (dpy, win, gc, xpoint, 3, Nonconvex, Unsorted);
> 
> demos/freedraw.c:121:
>   XDrawLines( dpy, win, gc, xpoint, 4, CoordModeOrigin );
> 
> demos/freedraw_leak.c:96:
>   XDrawLines(dpy, win, gc, xpoint, 4, CoordModeOrigin);
> 
> demos/gl.c:143:
>   glXSwapBuffers( fl_display, fl_get_canvas_id( ui->canvas ) );
> 
> demos/glwin.c:179:
>   glXSwapBuffers( fl_display, glwin );
> 
> demos/ibrowser.c:566:
>   XInstallColormap( fl_display, map );

Well, as I wrote some days ago: you can use X11 functions at
the same time as using XForms. XForms doesn't have wrappers
for all X11 functions, so for some purposes you need to call
the X11 functions directly. And the demo programs exist to
also show this aspect of XForms. So I wouldn't see it as an
advantage to remove everything X11 related from the demo
programs (if that would be possible at all) when, on the
other hand, they are partially intended to show how that can
be done.

The best example of this is the canvas object. It's basically
not much more than a simple X11 window that you can freely
draw into, using X11 functions. You can even take over nearly
all of the event handling for a canvas (and to get certain
effects you even need to).

Of course, in principle XForms could go the way GTK went,
having all kinds of functions for drawing etc., but then
XForms would become a huge, heavy-weight library like GTK
is. (There are actually a few functions for drawing, which
are also used internally for drawing and also appearing in
some of the demo programs, but which never where really do-
cumentated...) Instead the idea has been to just offer a
framework for the more tedious tasks (like drawing and
handling of relatively simple widgets) and leaving the
"interesting bits" to the user.

So I guess you will either have to leave out some of the
demo programs or find ways to achieve what they do now
using X11 calls with something similar in Python.

On a different note, I just added another bunch of getter
functions for object attributes:

FL_COLOR fl_get_object_lcol(FL_OBJECT *obj);
int fl_get_object_lsize(FL_OBJECT *obj);
int fl_get_object_lstyle(FL_OBJECT *obj);
int fl_get_object_lalign(FL_OBJECT *obj);
const char * fl_get_object_label(FL_OBJECT *obj);
void gl_get_object_color(FL_OBJECT *obj, FL_COLOR *col1, FL_COLOR *col2);
int fl_object_is_automatic(FL_OBJECT *obj);

and a few others will follow. I hope that chears you up a
bit despite the bad news from above;-)

                             Best regards, Jens
-- 
  \   Jens Thoms Toerring  ________      address@hidden
   \_______________________________      http://toerring.de




reply via email to

[Prev in Thread] Current Thread [Next in Thread]