comp.lang.ada
 help / color / mirror / Atom feed
* Xlib Binding or Re-implementation?
@ 2004-03-16 21:20 Ben Atkin
  2004-03-17  9:46 ` Preben Randhol
  2004-03-17 10:34 ` Ludovic Brenta
  0 siblings, 2 replies; 11+ messages in thread
From: Ben Atkin @ 2004-03-16 21:20 UTC (permalink / raw)


I beginning work on creating a text-editor in Xlib using Ada. The
reason I choose to use Xlib, rather than a toolkit, is because I want
to learn to build GUI toolkits because I don't like any of the current
options available in *nix. I also think that Ada has a lot of features
that would come in handy such as having both tagged and untagged
types, polymorphism, and type safety. Most importantly, Ada has
features that support good software engineering practices, which I
plan to use in the development of this program. A guiding principle
behind my project is that when software tries to be clever by doing
something that is what the user wanted 95% of the time, the other 5%
of the time, it only serves to frustrate the user, and makes it not
worth the benefit other 95% of the time. This means, that when you are
programming, the indentation behavior by default, with autoindenting
turned on is as such:

1. When you press enter, unless you are inside a function call, the
indentation is the same as the preceding line. Example (keys in angle
brackets, cursor is '.'):

    procedure Add_N  (X : in out Integer, N : in Integer)<ENTER>
    .

2. When you press enter inside a function call, the indentation is
aligned with the first non-whitespace character beyond the last
opening parenthesis in the previous line. Example:

    procedure Add_N  (  X : in out Integer,<ENTER>
                        .

This stops the maddening behavior of automatically jumping to the next
space when you want to write "begin" with the 'b' aligned with the 'p'
in procedure. Another thing I hate about other advanced text editors
is when it re-indents on the LINE YOU'RE TYPING ON. This is the way it
is in ObjectAda.

Well, anyway, now that I've introduced myself and my project to the
Ada community, on to the question:

First, do any of you know of any good, free Xlib bindings? I have run
into a lot of dead links.

Second, if I create my own, do you think it would be better to:

A. Write a thin binding to the C Xlib, using pragmas.

B. Write a thick binding to the C Xlib (don't know how I would go
about this).

C. Port Xlib.c, Xlib.h, etc. to Ada, using sockets. Then I could make
some changes that would make it more robust (the same things that the
freedesktop.org people are trying to do with
http://www.freedesktop.org/Software/xcb, but using Ada, which goes
really well with all of their suggestions).

I am thinking about doing it the part C way, but starting with it
working for my text editor. I don't fully understand the security
risks of it, so it may behoove me and the rest of the 'nix community
to keep work to myself and a private group of testers before releasing
it, unless the X server implementation is robust enough to handle
slightly garbled output.

I realize this could be a long project, but I am so dissatisfied with
GTK's approach that I think a new approach is needed. Besides, more
experimental projects are needed on the 'nix desktop. Copying is a
terrible way to develop software.

Thanks for any advice!



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Xlib Binding or Re-implementation?
  2004-03-16 21:20 Xlib Binding or Re-implementation? Ben Atkin
@ 2004-03-17  9:46 ` Preben Randhol
  2004-03-17 23:11   ` Ben Atkin
  2004-03-17 10:34 ` Ludovic Brenta
  1 sibling, 1 reply; 11+ messages in thread
From: Preben Randhol @ 2004-03-17  9:46 UTC (permalink / raw)


On 2004-03-16, Ben Atkin <bma3@dana.ucc.nau.edu> wrote:

X11 binding:

   http://www.adapower.com/lab/adax.html

What is it that you don't like about Gtk?

But what you want to do is to think how to make this library work
regardless of OS. You should design it so that there is a lower layer
which is OS dependant, but that everything on top isn't. I think trying
that to make a new GUI that isn't OS independant is perhaps not such a
good idea unless there is a niche for it.


-- 
Preben Randhol -------- http://www.pvv.org/~randhol/

()  "Violence is the last refuge of the incompetent"
/\                                   - Isaac Asimov



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Xlib Binding or Re-implementation?
  2004-03-16 21:20 Xlib Binding or Re-implementation? Ben Atkin
  2004-03-17  9:46 ` Preben Randhol
@ 2004-03-17 10:34 ` Ludovic Brenta
  1 sibling, 0 replies; 11+ messages in thread
From: Ludovic Brenta @ 2004-03-17 10:34 UTC (permalink / raw)



There is a binding to Xlib, Xt, and Xm (Motif/Lesstif) called
AdaBindX, at http://home.arcor.de/hfvogt/programming.html.  It does
not have a binding to Xaw, the Athena widget set.  I am packaging it
right now for Debian, it should be uploaded later today.

-- 
Ludovic Brenta.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Xlib Binding or Re-implementation?
  2004-03-17  9:46 ` Preben Randhol
@ 2004-03-17 23:11   ` Ben Atkin
  2004-03-18  0:19     ` Ludovic Brenta
  2004-03-18 10:00     ` Preben Randhol
  0 siblings, 2 replies; 11+ messages in thread
From: Ben Atkin @ 2004-03-17 23:11 UTC (permalink / raw)


> X11 binding:
> 
>    http://www.adapower.com/lab/adax.html

I'll check it out, thanks.

> What is it that you don't like about Gtk?

It isn't Gtk in particular. It's that GUI libraries for 'nix, other
than Qt, don't encourage good GUI design principles. In fact, if you
compile their examples on GTK's website, you will get a broken GUI. By
broken I mean that pressing Esc doesn't close a dialog box, and
pressing Enter in a single-line text field doesn't cause the default
button to be pressed and the appropriate action to be taken.

Plus, GTK programs are full of other types of bugs, many of which
could be prevented by using something other than type-unsafe macros,
leading to spaghetti code.

Part of me wants to jump on the GTK bandwagon, and help things
progress toward a standard. But what I really want to progress toward
is having well-designed GUI's.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Xlib Binding or Re-implementation?
  2004-03-17 23:11   ` Ben Atkin
@ 2004-03-18  0:19     ` Ludovic Brenta
  2004-03-20 22:48       ` Ben Atkin
  2004-03-18 10:00     ` Preben Randhol
  1 sibling, 1 reply; 11+ messages in thread
From: Ludovic Brenta @ 2004-03-18  0:19 UTC (permalink / raw)


bma3@dana.ucc.nau.edu (Ben Atkin) writes:

> > X11 binding:
> > 
> >    http://www.adapower.com/lab/adax.html
> 
> I'll check it out, thanks.
> 
> > What is it that you don't like about Gtk?
> 
> It isn't Gtk in particular. It's that GUI libraries for 'nix, other
> than Qt, don't encourage good GUI design principles. In fact, if you
> compile their examples on GTK's website, you will get a broken GUI. By
> broken I mean that pressing Esc doesn't close a dialog box, and
> pressing Enter in a single-line text field doesn't cause the default
> button to be pressed and the appropriate action to be taken.

That is true, but at least GNOME has published human interface design
guidelines which, if followed, lead to this consistency.  Xlib doesn't
have such guidelines, it's not even a toolkit.  If you mean to use Xaw
(the Athena widgets) or Xm (Motif or Lesstif widgets), you won't
necessarily have a good GUI either.

> Plus, GTK programs are full of other types of bugs, many of which
> could be prevented by using something other than type-unsafe macros,
> leading to spaghetti code.

This is comp.lang.ada; we do not use type-unsafe macros here :)

The designers of GTK+ never intended for GTK+ applications to be
written in C.  I personally attended a presentation by Owen Taylor, a
member of the core GTK+ team, at FOSDEM 2003.  He specifically said
"Do Not Program In C", and he explained that his employer Red Hat uses
Python for all their GUIs.

The main (perhaps only) reason why GTK+ itself is written in C is to
make it easy to write thick bindings to it from high level languages
(see http://www.gtk.org/bindings).  GtkAda is one such binding, and a
pretty good one at that.

> Part of me wants to jump on the GTK bandwagon, and help things
> progress toward a standard. But what I really want to progress toward
> is having well-designed GUI's.

Over and above the thick binding to GTK+, GtkAda provides several rich
widgets (canvas and MDI come to mind) and certainly the authors would
gladly accept your contributions.

There is also Glade, the graphical UI designer, which can generate Ada
source code.  If you're really interested in good UI design, you'll
probably be much more productive with it than with Athena or Lesstif.

I suggest you really have a good look at GtkAda; you will probably
find that it already provides much more of what you want than do Xaw
or Xm.  And if something is missing, please offer to contribute :)

(You may also be interested in GNUStep, which is one pretty good
toolkit with UI guidelines and a graphical designer, but for that
you'd have to go to the Objective-C newsgroup.  GNUStep has been quite
active in recent months.)

-- 
Ludovic Brenta.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Xlib Binding or Re-implementation?
  2004-03-17 23:11   ` Ben Atkin
  2004-03-18  0:19     ` Ludovic Brenta
@ 2004-03-18 10:00     ` Preben Randhol
  2004-03-18 10:09       ` Peter Hermann
  2004-03-31  7:36       ` David Starner
  1 sibling, 2 replies; 11+ messages in thread
From: Preben Randhol @ 2004-03-18 10:00 UTC (permalink / raw)


On 2004-03-17, Ben Atkin <bma3@dana.ucc.nau.edu> wrote:
>> X11 binding:
>> 
>>    http://www.adapower.com/lab/adax.html
>
> I'll check it out, thanks.
>
>> What is it that you don't like about Gtk?
>
> It isn't Gtk in particular. It's that GUI libraries for 'nix, other
> than Qt, don't encourage good GUI design principles. In fact, if you
> compile their examples on GTK's website, you will get a broken GUI. By
> broken I mean that pressing Esc doesn't close a dialog box, and
> pressing Enter in a single-line text field doesn't cause the default
> button to be pressed and the appropriate action to be taken.

It would be very nice if you report the problems. At least I would be
interested.

> Plus, GTK programs are full of other types of bugs, many of which
> could be prevented by using something other than type-unsafe macros,
> leading to spaghetti code.

And GtkAda programs? Don't look at GTK programs programmed in C. C
program will crash regardless of the GUI. Of course I would also like to
have all libraries written in Ada, the problem is that then everybody
else must use Ada. I don't see this happing. Of course I could only use
the Ada library, but to introduce a new GUI which does things
differently than the others makes things inconsistent.

Now this said. I would rather have Gwindow or Claw ported to work on
Linux and Mac OS, than a new library. I don't want to put you off what
you want to do, but it is a huge task.

> Part of me wants to jump on the GTK bandwagon, and help things
> progress toward a standard. But what I really want to progress toward
> is having well-designed GUI's.

That would be great.

-- 
Preben Randhol -------- http://www.pvv.org/~randhol/

()  "Violence is the last refuge of the incompetent"
/\                                   - Isaac Asimov



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Xlib Binding or Re-implementation?
  2004-03-18 10:00     ` Preben Randhol
@ 2004-03-18 10:09       ` Peter Hermann
  2004-03-18 20:36         ` Randy Brukardt
  2004-03-31  7:36       ` David Starner
  1 sibling, 1 reply; 11+ messages in thread
From: Peter Hermann @ 2004-03-18 10:09 UTC (permalink / raw)


Preben Randhol <randhol+valid_for_reply_from_news@pvv.org> wrote:
> Now this said. I would rather have Gwindow or Claw ported to work on
> Linux and Mac OS, than a new library. I don't want to put you off what

if Randy agrees...



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Xlib Binding or Re-implementation?
  2004-03-18 10:09       ` Peter Hermann
@ 2004-03-18 20:36         ` Randy Brukardt
  0 siblings, 0 replies; 11+ messages in thread
From: Randy Brukardt @ 2004-03-18 20:36 UTC (permalink / raw)


"Peter Hermann" <ica2ph@sinus.csv.ica.uni-stuttgart.de> wrote in message
news:c3bsg5$4tc$1@news.BelWue.DE...
> Preben Randhol <randhol+valid_for_reply_from_news@pvv.org> wrote:
> > Now this said. I would rather have Gwindow or Claw ported to work on
> > Linux and Mac OS, than a new library. I don't want to put you off what
>
> if Randy agrees...

I have no objection to a Mac Claw. Its not clear to me if the interface of
Claw is too Windows-specific. We had considered a system-independent layer
that would be built on top of classic (Windows) Claw, but to date we haven't
bothered because the need seems to be met by GTKAda. But if anyone wants to
persue it, I'd be happy to hear from them.

                      Randy.






^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Xlib Binding or Re-implementation?
  2004-03-18  0:19     ` Ludovic Brenta
@ 2004-03-20 22:48       ` Ben Atkin
  2004-03-21  8:34         ` Preben Randhol
  0 siblings, 1 reply; 11+ messages in thread
From: Ben Atkin @ 2004-03-20 22:48 UTC (permalink / raw)


Ludovic Brenta <ludovic.brenta@insalien.org> wrote in message 
> The designers of GTK+ never intended for GTK+ applications to be
> written in C.  I personally attended a presentation by Owen Taylor, a
> member of the core GTK+ team, at FOSDEM 2003.  He specifically said
> "Do Not Program In C", and he explained that his employer Red Hat uses
> Python for all their GUIs.

I had no idea that Owen Taylor said that. I knew that Owen Taylor
works for Redhat and that Redhat uses Python for their admin tool
GUI's. That is good to know.

It would be nice if he was a little more vocal about it, though. Most
Gtk+ programs I've run across are coded in C, including the one I'm
using right now, Galeon. If they were written in something else, maybe
bugs and design issues would be fewer, and more easily fixed.

But I still think that there are a lot of fundamental problems with
the API, and there are a lot of glitches that annoy me to no end.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Xlib Binding or Re-implementation?
  2004-03-20 22:48       ` Ben Atkin
@ 2004-03-21  8:34         ` Preben Randhol
  0 siblings, 0 replies; 11+ messages in thread
From: Preben Randhol @ 2004-03-21  8:34 UTC (permalink / raw)
  To: comp.lang.ada

Ben Atkin <bma3@dana.ucc.nau.edu> wrote on 21/03/2004 (08:15) :
> But I still think that there are a lot of fundamental problems with
> the API, and there are a lot of glitches that annoy me to no end.

Please tell so that one might be able to fix them in GtkAda.

-- 
Preben Randhol -------------- http://www.pvv.org/~randhol/Ada95 --
                 �For me, Ada95 puts back the joy in programming.�



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Xlib Binding or Re-implementation?
  2004-03-18 10:00     ` Preben Randhol
  2004-03-18 10:09       ` Peter Hermann
@ 2004-03-31  7:36       ` David Starner
  1 sibling, 0 replies; 11+ messages in thread
From: David Starner @ 2004-03-31  7:36 UTC (permalink / raw)


On Thu, 18 Mar 2004 10:00:30 +0000, Preben Randhol wrote:

> Of course I would also like to
> have all libraries written in Ada, the problem is that then everybody
> else must use Ada. 

No, the problem is that everyone else must have an Ada compiler
installed. Interfaces.C is two-way; you can create a C or Fortran
or (non-standard) C++ interface for your Ada library.



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-03-31  7:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-16 21:20 Xlib Binding or Re-implementation? Ben Atkin
2004-03-17  9:46 ` Preben Randhol
2004-03-17 23:11   ` Ben Atkin
2004-03-18  0:19     ` Ludovic Brenta
2004-03-20 22:48       ` Ben Atkin
2004-03-21  8:34         ` Preben Randhol
2004-03-18 10:00     ` Preben Randhol
2004-03-18 10:09       ` Peter Hermann
2004-03-18 20:36         ` Randy Brukardt
2004-03-31  7:36       ` David Starner
2004-03-17 10:34 ` Ludovic Brenta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox