Re: ANNOUNCE: Phasing out GTK mailing lists and move to Discord

2019-03-20 Thread Liam R E Quin
On Wed, 2019-03-20 at 21:37 -0400, Reuben Rissler wrote:
> I originally thought I would participate on Discourse via email,
> then email got discouraged in favor of the web UI.
> 
> I don't have that much answers, and neither do I have a lot of 
> questions. Therefore I will just quietly fade away...

Yeah, it become one more in my 200 browser tabs, or, more to the point,
i won’t be looking at all. It’s fairly rare that i can help answer a
question here, and more likely off-list, so if Discord or Discourse
(not sure which) brings more users and more life, maybe it's worth it.

Liam (irc::ankh)


-- 
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Web slave for vintage clipart http://www.fromoldbooks.org/

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Why is it impossible to move a window programmatically in GTK+ (C/C++)

2018-05-30 Thread Liam R E Quin
On Wed, 2018-05-30 at 13:33 -0400, Tarie Nosworthy via gtk-app-devel-
list wrote:
> I am writing an app in GTK+, and I wanted to center a splash screen.

Note, users get irritated by splash screens they can't move.

You *can* make a window that's centered and immovable, e.g. gimp does
it, so you could look at that, but if it's visible for more than a
second or two it's incredibly annoying in a world where people tend to
run lots of applications at the same time.

Liam

-- 
Liam Quin - web slave for https://www.fromoldbooks.org/
with fabulous vintage art and fascinating texts to read.
Click here to have the slave beaten.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: simple question

2018-02-17 Thread Liam R E Quin
On Sat, 2018-02-17 at 21:32 +0100, Wojciech Puchar wrote:
> i want in my program to change background color of the gtk_button to
> red 
> sometimes as a signal to the user.

Although i don't have an answer (sorry) i'll note - i've worked with
people who were red/black colourblind.
I'd really be irritated, too, if my theme had red text, and when it
mattered most i ended upwith red text on a red background.

Liam


-- 
Liam Quin, W3C, http://www.w3.org/People/Quin/
Staff contact for Verifiable Claims WG, SVG WG, XQuery WG
Improving Web Advertising: https://www.w3.org/community/web-adv/
Personal: awesome vintage art: http://www.fromoldbooks.org/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: gtk_text_view_im_context_filter_keypress - howto replace Tab with 4-spaces?

2015-12-21 Thread Liam R. E. Quin
On Mon, 2015-12-21 at 02:22 -0600, David C. Rankin wrote:
> 
[...]
> 
>  if (gtk_text_view_im_context_filter_keypress (GTK_TEXT_VIEW 
> (app->view),
>    event)) {
>  printf ("  Tab key handled by im_context\n");

This is the wrong way round. I think that
if gtk_text_view_im_context_filter_keypress returns true you're
supposed to return TRUE without doing anything.

> You may find the devhelp program useful - search for this function in
> the index and you'll see an example.

Liam

-- 
Liam R. E. Quin <l...@holoweb.net>

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: set custom entry background?

2015-11-16 Thread Liam R E Quin
On Mon, 16 Nov 2015 17:53:59 +
Emmanuele Bassi  wrote:
[...]
>   .error-entry { background-color: red; }

If you do this, watch that if the theme's foreground colour is red, the user 
will be screwed...
Setting background-color without setting the text color (color: yellow) is 
usually a mistake.

Of course, a red-black colourblind person (I do know such people) would be 
unable to use an application that hard-wired red and black...

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: gtk_text_buffer_delete ?

2015-10-09 Thread Liam R E Quin
On Thu, 08 Oct 2015 20:59:21 +0200
Stefan Salewski  wrote:

> I was hoping that it could be possible to simple block input when buffer
> has a maximum length, but I got that not working.

Note that this can give an unpleasant user experience. It might be more helpful 
just to have a count of characters available that becomes negative and changes 
from grey to red (change both lightness and colour, for people who can't 
differentiate black from red) - you see this approach on Web sites quite often. 
Then people can paste a longer text and delete it, or can add a new word and 
then delete a longer one.

Best,

Liam


-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GTK+3 styles and themes

2014-04-01 Thread Liam R E Quin
On Tue, 2014-04-01 at 11:49 +0200, Roland Koebler wrote:

 Using custom stylesheets *does* work (although it still seems that
 ~/.gtk-3.0.css has no effect under Gnome3); but for some themes and
 Gnome3, setting background-color doesn't have any effect, but setting
 background seems to work.

A reminder for people reading this in the mail archive months from
now ;-)

Don't forget to test with both a dark-on-light and a light-on-dark user
theme, and, as with CSS, remember to set the text colour when you change
the background...

Liam


-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Stylize Text Caret?

2014-01-18 Thread Liam R E Quin
On Sat, 2014-01-18 at 17:31 -0600, Zane Swafford wrote:
 I was wanting to make the text caret within a
 text entry wider and a specific color

Although I don't know the answer, I'll note that you have to watch
carefully for users with a different set of colours than you, and for
users who have chosen a specific style for accessibility reasons. For
example, I don't have a caret but a vertical bar, and can't deal with
the cursor blinking.

Best,

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: switch printer tray during printing

2013-03-13 Thread Liam R E Quin
On Mon, 2013-03-11 at 16:13 -0500, Michael Cronenworth wrote:

 Changing trays may be out of the question, but I do know that Postscript
 allows per-page paper orientation changes. I have a few PDFs that do so.

You can change paper sizes too, which will generally cause a different
paper tray to be used; you might also be able to tell the printer
directly to switch trays, just as you can turn duplex, stapling and
collation features off and on. I've used software that did this in the
past. Whether gtk can do it I have no idea.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: open an existing file in buffer and write on it

2013-01-25 Thread Liam R E Quin
On Fri, 2013-01-25 at 10:44 -0800, Andrew Potter wrote:
 [...]

 You can get a nice buffer of binary data to write to file:

Please let's not encourage the use of binary file formats where there's
no measured performance requirement. An XML file would be better if
structure is needed, as then it can be interchanged with other tools and
platforms, and the fields are self-describing. Even JSON is better than
a binary file, although JSON is not so good for the document-oriented
text you often find in bibliographies, which I think was the original
purpose here? Not sure.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: open an existing file in buffer and write on it

2013-01-25 Thread Liam R E Quin
On Fri, 2013-01-25 at 11:45 -0800, Andrew Potter wrote:
 On Fri, Jan 25, 2013 at 11:14 AM, Andrew Potter agpot...@gmail.com wrote:
 
  [...] blah blah blah.
 
 On second reading this comes off as a little flippant, my apologies.
 You made a good point, and I should have prefaced my example with links to
 proper serialization tools.

Apology accepted :-)

The important point is that the user's data belongs to the data, not to
the program, so using a suitably open file format is in its way as
important as using Free software.

That it's easier for the programmers to create and read
application-specific binary files is a problem that would be worth
fixing.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: open an existing file in buffer and write on it

2013-01-25 Thread Liam R E Quin
On Sat, 2013-01-26 at 00:06 +0100, David Nečas wrote:
 On Fri, Jan 25, 2013 at 04:25:53PM -0500, Liam R E Quin wrote:
  That it's easier for the programmers to create and read
  application-specific binary files is a problem that would be worth
  fixing.
 
 Probably you mean replacing it with the problem of application-specific
 hodge podge XML...

That's one assumption...

 I have implemented the import of ~80 data formats of varying complexity
 and style to one program.  I have seen both utterly mad binary formats
 and binary formats that were well thought out and pleasure to implement.
 But XML was crap quite invariably.  It appears to be used as an excuse
 for not thinking about data representation at all.

Some of the best formats I've seen have been XML-based and some of the
worst have been binary.  I agree there are bad XML-based formats,
although usually even those are amenable to processing with XQuery
and/or XSLT, to external validation and to editing in an XML editor, all
a step up from the single-application binary format.

The goal really has to be to model the problem space.

Sometimes problems people encounter don't translate well into
data-oriented formats: processing mixed content is a common need in
documents and a good example -- e.g. See titleIEE  Journal of Ankle
Quality/title vol36/vol, issueJuly/issue year1932/year,
especially pp236--238/pp. Representing the requirement that title,
volume, issue, year all be present may help greatly from the business
perspective (e.g. we reject articles with an improper bibliography and
tell the author to fix the problems, which are listed here...).

Sometimes people use XML when JSON is more suited - this is especially
often true when the data types are about machine representations,
uint32 or are used for binding external data to objects rather than
abstract such as year or shoe size and representing the user's view
of the world in the computer.

At any rate we've strayed a little far afield :-)

Liam


-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: GTK+3 fonts

2012-10-21 Thread Liam R E Quin
On Sat, 2012-10-20 at 20:23 -1000, Roger Davis wrote:
 Hi all,
 
 I [...] am partial to the Sans font for various reasons.

On most linux systems this is actually an alias, not a font name.

Here, it's DejaVu Sans Book:

$ fc-match Sans
DejaVuSans.ttf: DejaVu Sans Book
$ 

so, add DejaVuSans.ttf to your Mac.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GTK+3 fonts

2012-10-21 Thread Liam R E Quin
On Sun, 2012-10-21 at 09:58 -1000, Roger Davis wrote:
  when I 
 downsize my font display to smaller sizes (anything 16 or below), the font 
 weight appears to make a dramatic shift from Book to ExtraLight.

By default I believe the mac changes antialiasing and hinting strategies
(is this 16pt or 16px?)

 Second, at some point during my fiddling around this morning, the 
 following files magically appeared in /opt/X11/share/fonts/TTF:
 
 % ls -l fo*
 120 -rw-r--r--  1 root  wheel  57364 Oct 21 06:52 fonts.dir
8 -rw-r--r--  1 root  wheel   1962 Oct 21 06:51 fonts.list
 120 -rw-r--r--  1 root  wheel  57364 Oct 21 06:51 fonts.scale
mkfontscale does this (and/or mkfontdir)

The files are being ignored in practice by gtk. They are for legacy
applications that still use X-native font machinery, and are read by the
X server and by the X font server, if it's in use. It shouldn't be.


 Finally, I did some experimenting with removing ttf files from 
 /opt/X11/share/fonts/TTF. I found that if I got rid of the Vera*ttf files, 
 then this happened:

 % fc-match yuk-yuk
 Vera.ttf: Bitstream Vera Sans Roman

Yes, there's a fallback defined in one of he fonts.conf files.

 I suppose what I would like to do on my Mac is have it use DejaVu Sans to 
 satisfy a Sans request (because DejaVu has the UTF-8 characters I need and 
 Vera does not)

The pango renderer will try to substitute glyphs from other fonts as
needed, so this shouldn't be a problem. It's possible that some other
gtk+ back end doesn't do this.

You can edit the fonts.conf files to change the default font.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GTK+3 fonts

2012-10-21 Thread Liam R E Quin
On Sun, 2012-10-21 at 15:42 -1000, Roger Davis wrote:
  I'm thinking that my better strategy at 
 this point is to just #ifdef my app code to specifically request DejaVu 
 Sans on the Mac, rather than having to tweak these fontconfig files on 
 each Mac in addition to hand-installing DejaVu.

Or request it everywhere.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Open file from menu

2012-07-09 Thread Liam R E Quin
On Tue, 2012-07-10 at 00:55 +0530, Rudra Banerjee wrote:
 Will anyone kindly show the way?


 stat(argv[1], filestat);
 buffer = (char *) malloc(filestat.st_size * sizeof (char));
 efile = fopen(argv[1], r);
 fread(buffer, filestat.st_size, 1, efile);
 gtk_text_buffer_set_text(textbuffer, buffer, filestat.st_size);
 free(buffer);

In C you need to check the return status of all system calls.

As Michael already said, first make sure argc  1;
if a filename was given, make sure that filestat is a struct stat:

struct stat filestat;

Make sure the malloc() successed - if there's not enoug hmemory it'll
return NULL.

Make sure the fopen() succeeded; it too will return NULL on failure.

Strictly speaking you should close the file, too, with fclose(efile),
and check that worked and also check that the free() was OK, if only to
help you catch programming errors!

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Open file from menu

2012-07-09 Thread Liam R E Quin
On Mon, 2012-07-09 at 22:01 +0200, David Nečas wrote:
 On Mon, Jul 09, 2012 at 03:40:11PM -0400, Liam R E Quin wrote:
  also check that the free() was OK
 
 I wonder how you do that (apart from not getting any glibc MALLOC_CHECK_
 error message or similar).

There's no portable way to do it really, you're right. In the past I've
written wrappers for malloc() and free() and realloc() to make sure
everything passed to free actually came from malloc or one of her
friends, and on some systems there are also calls to check the heap.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: pango or any other way to format text

2012-05-14 Thread Liam R E Quin
On Mon, 2012-05-14 at 20:20 +0800, Rudra Banerjee wrote:
 Can anybody please take some time to show me simple way of
 implementing pango formatting to get greek letters, subscripts and
 superscripts in gtk2+?
 A minimal(complete with headers) example will be very appriciated.

Greek is the same as English - just use the Unicode characters - even
for polytonic Greek in most cases.

For superscript and subscript you use sup and sub as in HTML. These
are not needed for Greek accents such as rough breathing, of course.

Liam
 

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GLIB for a webserver

2011-12-08 Thread Liam R E Quin
On Thu, 2011-12-08 at 11:13 -0200, Marcelo Elias Del Valle - SYSMAP
SOLUTIONS - Claro MA-SP - wrote:

 - On Apache ARP project, they said they created it instead of using
 glib because the lack of IPC functions like memory mapping.

This makes no sense since they could use glib and also write mmap
functions...

 - In some forums, people were complaining about the fact glib aborts
 when memory allocation fails, which is bad for a 24/7 running web
 server.

A robust Web server would probably have a framework that restarted
components as needed; Apache already does some of this with workers.

The main problem with memory allocation comes when someone else's
process is using all the memory.

If you are writing a new Web server (why?) glib is probably fine.

Don't fight it, though. There's no portable way to find the system's
free memory, and even if there were, it wouldn't help -

if (amount_of_memory  amount_available) {
 // imagine that after that test succeeds,
 // your program happens to get swapped out,
 // and another program allocates all of memory

 allocate_memory(); // fails
}

So it's better to assume that things will fail. Robustness does not come
from avoiding failure - it comes from recovering from failure.

For a Web server that may just mean restarting. Sure, some users will
have to reload Web pages; if that's actually a problem, use persistent
storage to record state.

Apache and IIS are fairly large codebases for a reason, though -- a
secure reliable production Web server would have a lot of catching up to
do.

But, it's fun writing Web servers :-)

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Memory leaks

2011-02-10 Thread Liam R E Quin
On Thu, 2011-02-10 at 10:50 +0200, Costin Chirvasuta wrote:
  Because malloc() implementations generally kept a linear linked list of
  free space, and traversed the list on a free() in case they found
  adjacent memory areas to the one you were freeing, which they could join
  together and make into a single larger area.
 
 I'm sorry, I now understand what you mean. If what you say is true
 (which I don't doubt) it's a really boneheaded mechanism in my
 opinion. Defragmenting memory in realtime is a performance nightmare.
 But that's irrelevant. Your point is well taken.

It was necessary on smaller machines. GNU malloc used to take he
approach (may still) of using only powers of two for bucket sizes, which
is faster (less fragmentation) but uses on average about twice as much
memory if requested sizes are random.

 
 However, consider a modern GUI app. It's allocating and freeing
 several orders of magnitude more pointers than are left at the end of
 the program. So, when you finally get to the end and have searched
 through all those heaps of pointers to free them and are stuck with
 only 200 (say) you just give up. It's like drowning near the shore.
 Plus, searching through a 200 pointer linked list should be an order
 of magnitude faster than ((200/n) * (what it takes to free the n
 pointers the program uses normally)). Assuming n is quite a bit larger
 than 200 (which IMHO is really not far-fetched).

A few million isn't unlikely for a GUI-based program - e.g. consider
allocating an event structure whenever the mouse pointer moves. Remember
that just because you free'd something doesn't mean it's gone -- it's
still on the heap and available for reuse in that list. Some versions of
malloc do try and return pages to the operating system under some
circumstances, although the cost of doing that in performance is large,
so you don't want to do it often.

Also, Bill C wrote,

 
 Liam - To have a problem with freeing up memory prior to exiting 
 suggests that either you have a memory leak, or a bad design  (or 
 both).  It might be your development environment.
 
Maybe it was bad -- System VR3 Unix, SunOS 4, IRIX, 4.3BSD etc etc. The
situation was a program that allocated millions of small objects. The
point still stands though - don't assume it's fast (or slow) until
you've measured.  The package itself did not, I think, have a badly
designed memory architecture for its time, but maybe I just think that
because I wrote it :-)  There were no leaks -- I measured carefully and
did in fact account for every item of memory. Well, I wrote a
carefully-tested program to do it :-)

Best,

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Memory leaks

2011-02-09 Thread Liam R E Quin
On Thu, 2011-02-10 at 00:43 +0200, Costin Chirvasuta wrote:
  but aside from that it's a pure waste of CPU cycles.
 
 I hate to throw fuel in the fire but this is just absurd!
 How complex is freeing 200 pointers? O(1)?

Years ago my text retrieval package had an option to call free() for all
the data structures on exit, basically just for debugging.  It made the
programs often go really slow when they exited - adding tens of seconds
wasn't uncommon.

Why?

Because malloc() implementations generally kept a linear linked list of
free space, and traversed the list on a free() in case they found
adjacent memory areas to the one you were freeing, which they could join
together and make into a single larger area.

If your application had a larger heap than fit comfortably into main
memory, every free() would bring in every page from disk in turn and
swap out the earlier ones... and with the next free() the process would
repeat... and then just a few million calls to free() could take many
many minutes.

But on exit() without doing a free, it's indeed O(1) because the OS just
marks the pages as unused, without caring about the no-longer-relevant
internal structure.

These days things are much faster, but a very simple test program
indicated that free() can be comparable in some cases in time overhead
to malloc().  I'll attach the program; you can vary the constant N and
also the amount allocated each time.  Using a random amount would be a
fairer simulation, and would also might make some implementations of
malloc/free() run quite a bit slower.

Whether it's better to add something to an API or to write a valgrind
special-case file is another matter... consider code that creates a
singleton factory,t hat would now have to add that factory to a linked
list of items to destroy, together with (possibly new) code to destroy
it... using a bit more memory, a bit more code space, more lines of code
to maintain, slightly bigger API, documentation, translations...

So, I agree it's a good idea to do (and as I mentioned, I've done it
myself in the past) but it's for sure not a case of adding one simple
line of O(1) code...

Best,

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Application path

2011-01-17 Thread Liam R E Quin
On Wed, 2011-01-12 at 13:13 +, John Emmas wrote:
  Is there any [...] function that would tell me the full path to the
 application - e.g. /usr/bin/my_app/my_app under Linux, or C:
 \Program Files\my_app\my_app.exe under Windows?

Not in general - it's best to decide you don't need this :-)

Some programs behave differently based on their name, but in C you can
use argv[0] to get at that, bearing in mind it might not actually
correspond to any filename at all.

If you do get the original file (whether via /proc or argv[0] or ps or
some other method), remember that on some systems it might have been
renamed, moved, or even deleted, after the program started, and also
that the user might have made a link, symbolic link, shortcut or
whatever...

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Grid Based Canvas

2010-05-24 Thread Liam R E Quin
On Tue, 2010-05-25 at 05:04 +0500, Asad Jibran Ahmed wrote:
 [...]

 The canvas will have grids, much like a graph paper. Whenever
 the user clicks on one of the grid squares, that square will become
 selected and the selection will be shown by highlighting the square.

It sounds like you really have a grid of squares, even if the user
doesn't think of it that way.

I think all of the canvas APIs support scrolling and zooming.

Or take a peek at e.g. the minesweeper game?

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Snow effect over a GtkWindow

2009-12-27 Thread Liam R E Quin
On Sun, 2009-12-27 at 16:27 +0100, Matteo Landi wrote:
 Hi all,
 for fun I'm trying to reproduce snowflakes falling down on my
 fullscreen gtk app.

I'd say look at xsnow if it's still around.

Liam


-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Window Managers Key Combinations and Accelerators

2009-12-09 Thread Liam R E Quin
On Wed, 2009-12-09 at 08:10 -0500, dhk wrote:

 Two things I would like to do is override the default Tab key press
 behavior and the Ctrl-Alt-Del behavior.

Tab is usually used by gtk+ (not the window manager) to move between
items e.g. in a dialogue box. Shift-tab does the same but in the
opposite direction.

Gnome-terminal overrides this, so you could look there.

Control-alt-del is interpreted (on Linux at least) by the X server,
depending on the value of the DontZap option in /etc/X11/xorg.conf,
and I think cannot easily be overridden by an application.

Liam




-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: csv (comma separated value) file

2009-08-03 Thread Liam R E Quin
On Mon, 2009-08-03 at 12:45 -0400, Tristan Van Berkom wrote:
[...]
 Currently its pretty easy using g_file_get_contents()/g_strsplit() 

CSV files are not just comma separated, and in some cases can have
column headers and other metadata.  There's also escaping.

a,b,c\d,e
a,b,c,d,e
a;b;c,d;e

You also have to deal with differing line ending conventions.

It's enough of a mess that both MS Office and most other
office programs today seem o use XML instead :-)

Probably gnumeric has code for this, though.

Liam


-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: csv (comma separated value) file

2009-08-03 Thread Liam R E Quin
On Mon, 2009-08-03 at 14:23 -0400, Tristan Van Berkom wrote:
 On Mon, Aug 3, 2009 at 1:21 PM, Liam R E Quinl...@holoweb.net wrote:
  On Mon, 2009-08-03 at 12:45 -0400, Tristan Van Berkom wrote:
[...]
 I see that was an uneducated comment on my part ;-)
My reply wasn't meant as a criticism, hope it didn't appear this.

[...]

 Dont have much of an opinion if it should be in glib, we have
 GKeyFile wich does similar high-levelish stuff already so it
 might be a suitable addition.

I'd rather steer people towards XML for new stuff, and for
old stuff, maybe a csv library split off from gnumeric
might be possible?

Liam




-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How to set a window filled the whole screen when we start the window?

2009-05-25 Thread Liam R E Quin
On Mon, 2009-05-25 at 14:20 +0800, donglongchao wrote:
 Hi,all
 I want to know that when I start a window,how can I set it's default size to 
 fill the whole screen?

Others have already explained how to do it, but,

Please consider carefully if this is the behaviour you want --
maximised windows are very disruptive when people aren't expecting
them, and people can easily maximise the window themselves if they want
it.

Liam


-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How to set a window filled the whole screen when we start the window?

2009-05-25 Thread Liam R E Quin
On Mon, 2009-05-25 at 21:15 +0800, donglongchao wrote:
 Thanks for your advice.Because there are too many widgets in the start window,
 I think it is necessary to maximize it first.Maybe I should ask my customs 
 for their suggestions.

Show fewer widgets in the main window, perhaps :-)

Liam


-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: g_malloc overhead

2009-01-21 Thread Liam R E Quin
On Wed, 2009-01-21 at 10:21 +0100, BJörn Lindqvist wrote:
 2009/1/21 Liam R E Quin l...@holoweb.net:
  On Mon, 2009-01-19 at 18:43 +0100, BJörn Lindqvist wrote:
  Actually, a custom allocator could be useful even in the general case.
  Malloc is a system call and has quite bad performance on certain
  platforms (windows in particular i think). Something like the gslice
  allocator could
  Probably improve performance a bit.
 
  malloc is a library call.
 
 On Linux, it is implemented using mmap() and brk() which are system
 calls.

brk(2) is called to grow the heap, but not on every malloc() call;
mmap(2) is used only for large objects, and then not always.

If you malloc() a few megabytes and then call free, a program
that allocates a lot of small objects may well go faster on some
systems, and slower on others.

Yes, g_slice was tested, but the program _calling_ g_slice is in
the domain of the user, and errors in calling g_slice or malloc()
can be hard to debug.

No more from me on this.

Liam

 
-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: change the focus ring's color

2009-01-16 Thread Liam R E Quin
On Fri, 2009-01-16 at 17:54 +0800, zhenghe zhang wrote:
 Hi all
 I have some problems, and I hope you tell me, thank you.
 As followed:
 The button obtains the focus, and there is focus ring, now I want to
 change the focus ring's color, but I don't do it.


Please remember that colours are generally under the control of
the user, who may have chosen a particular theme for accessibility
reasons (e.g. needing low contrast).

What is your motivation here?

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Generic character types of gregex are unrecognised

2009-01-08 Thread Liam R E Quin
On Thu, 2009-01-08 at 17:43 +0900, tks wrote:
  On Wed, 2009-01-07 at 02:00 +0900, tks wrote:
  [...]
reg = g_regex_new (\d\D\s\S\w\W,
   0,
   0,
   error);
 
 
  Watch out that \ is special in C strings, so you need
  \\d\\D etc.
 
  Liam
 
 Thanks, I'm so stupid! :P

No - it's actually not obvious, especially since regular
expressions are a separate type in some other languages.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Generic character types of gregex are unrecognised

2009-01-06 Thread Liam R E Quin
On Wed, 2009-01-07 at 02:00 +0900, tks wrote:
[...]
   reg = g_regex_new (\d\D\s\S\w\W,
  0,
  0,
  error);


Watch out that \ is special in C strings, so you need
\\d\\D etc.

Liam


-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: URI's

2008-09-30 Thread Liam R E Quin
On Tue, 2008-09-30 at 13:19 -0600, Kevin DeKorte wrote:

 Ok, thanks for the info. Some macros like G_IS_URI or something similar
 would have been nice, but maybe I can work out some code using the
 g_filename_to_uri and g_filename_from_uri functions to determine what
 value I have.

What are you trying to do? What if you get a telnet: or mailto: URI?
What about data: ?

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Preventing Multiple instance of GTK application

2008-04-14 Thread Liam R E Quin
On Sat, 2008-04-12 at 15:16 +0100, Carlos Pereira wrote:

 You can write a .lock file everytime you start and then remove it when 
 you close. To know if other instance is running, you just have to check 
 if your .lock file exists.

Please don't do this.

If you must, take into account
(1) multiple instances may create the file -- especially if it is
on a network file system.  You can use O_CREAT|E_EXCL but it
is not guaranteed to work over a network and neither in
practice.

(2) after a system crash, or if your application crashes, the lock
file will not be removed.
A way round this is to make the lock file by a symbolic link
to a non-existant file with your process ID in it, and then on
startup to check if that process name exists use kill(the_proc, 0),
but this will fail on a network drive if the program is running on
another machine.
A way round this is to include your machine's IP address in the
link, but this fails on a laptop (say) that gets a new IP address
each time it starts and which might get shut down quickly.

(3) if your application was run as root, or as another user, you might
not be able to delete the lock file.

(4) the above 3 items don't have portable solutions between operating
systems.

It is much better to use dbus, or an X Windows property..

and even better to use a library that packages all this stuff,
as was suggested by others.

If you do end up making a lock file, consider making it a directory,
as there are generally fewer locking problems.

best,

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: I can't understand the difference output of only a line differ

2007-12-06 Thread Liam R E Quin
On Thu, 2007-12-06 at 09:40 -0800, Mike Melanson wrote:
 I just wanted to throw out the possibility of asking your client whether
 they have any interest in open sourcing the video codec itself?

Now would be a good time, if the codec might be useable on the Web --
see for example http://www.webvideosummit.com/ -- especially if it
not encumbered by software patents that you [Binary Chen's client]
don't control...

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Subtitle extraction via OCR

2007-07-30 Thread Liam R E Quin
On Tue, 2007-07-31 at 00:32 +0200, Mathias Brodala wrote:
 Since I’m currently working on extracting hardcoded subtitles from some video
 files, I needed an application to do this. I quickly found SubRip[0], but it 
 is,
 unfortunately, only available for Windows.

Check that there's no teletext/videotext/closed captioning first - you
don't need OCR in that case.

I've yet to use any open source OCR package that has been less effort
than rekeying -- commercial OCR software is workable though.  I don't
know if the abby finereader API is available for Linux; there are
others, if not.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Subtitle extraction via OCR

2007-07-30 Thread Liam R E Quin

On Tue, 2007-07-31 at 01:13 +0200, Mathias Brodala wrote:
 Hi Liam.
 
 (You don’t need to CC me, I’m subscribed.)
evolution really needs a swap To and Cc fields button.

  I've yet to use any open source OCR package that has been less effort than
  rekeying -- commercial OCR software is workable though.
 
 Hm, is libgocr that bad? (As an example.)
Yes.

There's one from Google that may be slightly better,
tesseract, as it's based on what was originally proprietary
code written in the 1980s.
http://code.google.com/p/tesseract-ocr/

  I don't know if the abby finereader API is available for Linux;
 
 Seems like[2]:
 
  ABBYY FineReader SDKs […]  provide developers with an Application 
  Programming
  Interface (API) for integrating the functionality of ABBYY FineReader into
  applications built for Windows or Linux platforms.

yes.

 [2] http://www.abbyy.com/for_developers/

If you have some samples I can run them through Abby FineReader and also
gocr (and maybe tesseract) if it is of use to you.

If you have only one font, you might be able to do well with some
pre-processing, and by training the software.  Watch out for
italic or bold emphasised words though, which count as a different
font.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: gtk eating tab hotkey

2007-04-19 Thread Liam R E Quin
On Thu, 2007-04-19 at 20:45 -0400, Dan McMahill wrote:
 I've created a main menubar with a handful of menus using the UI 
 manager.  All of my hotkeys work except for the menuitem which uses 
 Tab as the hotkey.  The problem is that gtk eats the tab and uses it 
 to move the focus around my different buttons and and other widgets on 
 the screen.  Then the menus never get triggered by a Tab press.

Please don't fight the accessibility support :-)  Tab is used to
help mouseless operation.

Can't you find an alternative within your program?  Users are
likely to discover tab in other programs and want yours to
work the same way.

Best,

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Application for finding all Windows

2007-02-21 Thread Liam R E Quin
On Wed, 2007-21-02 at 17:11 +0530, Udayan Singh wrote:
 Hi,
 
 I want to develop an application where I can get a list of all the windows 
 that are open in the GNOME Screen and find any activity being performed on 
 any other window on the GUI screen (and not only my application) e.g. 
 mouse click on window of another application sends me a signal.

You can see the xlsclients program (part of the core X distribution)
for getting a list of windows.

To find activity, one way is to set up a listener on a particular
port, 6161 say, and then use :6161 as your DISPLAY variable; your
listener would forward connections to the real X server.

Another way would be event interposition and synthetic events but
it is deliberate (for security reasons) that this technique
does not always work.  For example, if someone types in a
password and you captured the keystrokes...

If you are trying to write a screen saver, see the code for the
existing ones.


 Notice: The information contained in this e-mail
 message and/or attachments to it may contain 
 confidential or privileged information.

Please don't post to public archived mailing lists
with this sort of stuff, even though courts have rejected
it and it is essentially meaningless gibberish.  Get
yourself a mail account outside your company if they
are that clueless.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: thread stack size

2007-01-18 Thread Liam R E Quin
On Mon, 2007-15-01 at 16:02 -0500, Dr. Michael J. Chudobiak wrote:

 If I patch the code to use 64k stack size for new threads, like this:
[...]
 memory consumption drops dramatically (and the program still works):

does it still work with larger images?  E.g. make one in gimp
that's 5,000 pixels by 5,000 pixels.

I notice that the first time I run gthumb in a folder of images,
it uses a lot more memory than the next time, so I suspect there
may be a memory leak connected with thumbnail creation.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How To Draw Bitmaps From FreeType?

2006-12-24 Thread Liam R E Quin
On Sat, 2006-23-12 at 10:30 -1000, Eric Mader wrote:

 I'm trying to render anti aliased bitmaps (i.e. 8 bits per pixel) 
 generated by FreeType.

There are some examples in the gfontview code, although the CVS
version of that does not (or didn't last time I tried) compile out
of the box directly, the author had wandered off mid-project.

Pango or (as John Coppen suggested) Cairo might work better.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Memory Issue

2006-12-14 Thread Liam R E Quin
On Fri, 2006-15-12 at 09:28 +0530, Preeti Joshi wrote:
  Does GTK
 have a bug that doesn't free the memory used by a window (say dialog) even
 after it has been destroyed?

It's often simpler to keep dialogues around and hide/show them.

Also make sure you unref everything!

In general the toolkit shouldn't have such leaks, or every
application would leak memory.  Well, a lot do, but I hope
not because of gtk :-)

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: help with window widgets

2006-11-12 Thread Liam R E Quin
On Sat, 2006-11-11 at 20:05 -0800, ybisou wrote:
 Hi,[...]
Hello! :-)

 I'm writing a code that should allow me to read a list of int(one at the
 time) from a STDIN into my GTK program.

Eventually you'll probably want to do this by registering stdin as
a file descripter (fileno(STDIN), or just 0) so that gtk calls a
function whenever data is available.  This way your program can
be updating the display while more numbers arrive.

Some toolkits have on-each-line-of-input-from-fd but I don't think
that's included in gtk unfortunately.

  The reading is fine but I am trying
 to output those numbers into a window. I can ouput the first number but I
 can't refresh and ouput the second number or the rest of the numbers.

While your program is in read it is blocked, and gtk windows can't
refresh.

 I'm doing something like this, and the windows only shows the first number.
 Please help...
 
 //widgets initializations
 
 while( read(0,x,strln(x))

this is certainly not what you want.  I think you need something like,
unsigned char buffer[BUFSIZ];
while (read(0, buffer, BUFSIZ - 1)) ...

strlen is measuring the number of characters before the first 0 byte
in the string.

More likely you want fgets() here in fact.  But when you move
to callbacks you'll need to use read() so you might as well
deal with it.  Note also that read() might not give you a complete
line of input, or might give you multiple lines, depending on
e.g. whether the input comes from a terminal or a program, and on
how it's generated.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Scrolling a Tree View before it's realized

2006-11-11 Thread Liam R E Quin
On Sat, 2006-11-11 at 11:51 +0100, Attilio Fiandrotti wrote:
[...]
 I eventually managed this by scrolling the treeview from a callback that 
 gets fired after the expose event is fired.
 In order to have scrolling performed only the first time expose event is 
 fired, i use a global flag which i reset from inside the callback the 
 first time it's run.

An alternative might be to have the signal handler disconnect the
signal.

Or is that what you mean by a second signal handler?  The first
time handler would look like:
replace the signal handler with the redraw function
scroll the view
call the redraw function
and the other is the redraw function.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkTree cursor scoping

2006-05-10 Thread Liam R E Quin
On Tue, 2006-05-09 at 10:50 -0400, Hassaan Khan wrote:

 1. is it possible for the cursor not to move during an update for TreeView2 
 while the u
 If not how do i make sure that the cursor returns to the correct TreeView 
 after an upda

This doesn't answer your question (sorry) but may help you to answer
them yourself...

Thee term you are looking for is keyboard focus, I think, rather than
cursor scoping.  

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Rebooting the System

2006-04-13 Thread Liam R E Quin
On Thu, 2006-04-13 at 15:59 +1000, Justin Clift wrote:
 Liam R E Quin wrote:
 snip
  Root password should not be prompted for in a
  gtk-engine-themed window, of course...
 snip
 
 Out of curiosity, why is this bad?

A gtk+ theme engine is a piece of executable code (usually in C)
that can live in the user's login directory, not root's.

So you could write a gtk+ theme that (for example) captures
keystrokes and saves them to a file.

Note that most Gtk+ themes don't work this way, and even
when they do, the theme engine is usually in a trusted
directory, e.g. under /usr/share somewhere.

Investigate consolehelper, perhaps.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Modal windows behaviour

2006-04-11 Thread Liam R E Quin
On Tue, 2006-04-11 at 12:17 -0300, Juan Pablo wrote:
 .
 I made a program with a main window which opens a dialog and this
 dialog opens another dialog.
 The two dialogs are set modal.

I know your programming question was answered... but you might also like
to consider how hard it would be to design your program so that the
dialogue boxes did not need to be modal at all.

It can be a lot easier for people sometimes if they can
work in the main window even when the dialogue is visible.

I haven't seen your program, of course, so it's just a
suggestion based on general ideas.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: labels and dpi

2006-01-10 Thread Liam R E Quin
On Tue, 2006-01-10 at 13:53 +0100, Fernando Apesteguía wrote:
 Yes but... in fact if I make a bigger label and the user changes dpi again,
 I run into the same problem. My question is if this is fixable? Or can I
 only make bigger the label?

It sounds like you are using a fixed x/y layout instead of packing
the label and widget into a horizontal box.

Use automatic layout if you can.  If for some reason you have
to use fixed positioning, your code needs to position the
label and then move the widget to make room... taking into
account the changes in a right-to-left locale such as one
using Arabic!

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


RE: How to determine Script from given Unicode text?

2005-10-21 Thread Liam R E Quin
On Fri, 2005-10-21 at 10:50 -0700, Gaurav Jain wrote:
[...]
  I have a
 unicode character, and I need to find out what script
 it belongs to.  Is it possible to determine this using
 a single Unicode character?

In general no, because a single Unicode character can
belong to more than one script (e.g. to Chinese Han and
also to Japanese Kanji, and also even to Korean; this is
the CJK Unification that was a controversial part of
Unicode).

You may find the gucharmap code useful, though, or the
W3C Internationalisation pages (www.w3.org/International/)
or www.Unicode.org.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: What about OCR ?

2005-10-04 Thread Liam R E Quin
On Sun, 2005-10-02 at 19:37 -0600, Michael Torrie wrote:
 On Sun, 2005-10-02 at 09:43 +0200, Alpe.Nusslé wrote:
  I'm french and I cannot undurstand a long text in english, so I try to 
  send you this request.
  
  Can we get an OCR function (reconnaissance de caractères en français) 
  with GIMP ?

Unfortunately I have yet to find an open source or Free OCR program
that works reliably for me.  The best I have used is Finereader
made by http://abbyy.com/ but it is commercial, and I think runs
only under Microsoft Windows, or at any rate is not supported under
any Free operating environment.

There is also gocr but this is much less effective.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Are windows necessary?

2005-08-23 Thread Liam R E Quin
On Tue, 2005-08-23 at 11:07 +0200, LaundroMat wrote:
 Hi,
 
 Quick question: is it possible to draw buttons on an empty screen (ie
 without a window parent)?
Under X, not really, you'd be drawing on the root window, which is
itself a window.

If you want the *appearance* i.e., user can't move the window, can't
easily give it focus, you can turn off window decorations, but this
greatly interferes with useability and accessibility.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org
XML Blog: http://people.w3.org/~liam/blog/

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Fonts

2005-08-02 Thread Liam R. E. Quin
On Tue, 2005-08-02 at 10:35 +1000, Russell Shaw wrote:

 I was wandering if every time a gtk app prints some text, the instructions
 for each character to print are sent as 1 byte, or 4 bytes like utf-8 or
 whatever (eg, 0x61 for 'a') so that the text rendering thing on the server
 side knows which glyph to render, or if there are fonts where each *bitmap*
 for a character is sent from the client to the server.

It's rather more complex than that.

In the simplest case, an instruction to draw at a given location
is sent using the X protocol, and the operands include the graphics
context to use, the drawable to draw onto, the x and y coordinates
(all as 16-bit integers I think, although compression is used in
some circumstances) followed by the 16-bit length of the string,
followed by the string, and the server maps each character of the
string to the corresponding bitmap in a font.

However, it turns out to be faster and more efficient to render
the fonts to bitmaps on the client.  The first time each character
is used it is sent to the server as a bitmap, but subsequently
it is reused.

One reason that this is more efficient is that in order for the
client to tell the server to use the server-side fonts, the
server has to send the full font metrics to the client -- the
bounding box of each character, etc. -- and this is a lot of
data.

 Is pango running on the client side, or the server side?
client.

 
 A previous post mentioned font caching. I was wandering if gtk can be
 speeded up.
For any particular application there may be ways to speed up rendering,
but in general a lot of effort has already been put into making it
at least reasonably fast.  Have you written a program that's too
slow?

One thing to check is that your DISPLAY variable is set to :0.0 and
not to the full hostname -- this can make a significant difference on
slow systems.

Otherwise it's hard for me to guess where you might have performance
problems: it's necessary to measure.

Liam

Liam Quin,
http://www.holoweb.net/~liam/
http://fromoldbooks.org/


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Fonts

2005-08-01 Thread Liam R. E. Quin
On Tue, 2005-08-02 at 00:16 +1000, Russell Shaw wrote:
 Hi,
 Does all text in gtk/pango get sent to the X server as ascii, or are bitmaps
 sent too?

Both, depending on whether client-side core X fonts are used or
whether client-side fonts are used with Xft.

  If sent as ascii, is it 7-bit, 8-bit, or something longer?
I don't understand this question -- a font is a collection of
descriptions of outlines, including curves and/or code to draw
the glyphs as well as other metadata.  Are you asking if the
instructions to draw an a (for example) are sent in ascii over
the connection to the X server, or are you really trying
to ask if pango can render non-latin text?  If the latter, yes
it can, see www.pango.org.  if the former, no, the connection to
the X server must be 8-bit clean as it's binary data.

 Does gtk have any control over what renders the fonts at the X server?
 Is XDrawString used?
pango controls this.  And yes if pango calls XDrawString() then
XDrawString() will be used. Gdk may also draw text directly,
without pango, I think.

I hope this helps, but I suspect all I can do is help you to
phrase your question more precisely, or to describe what you
are trying to do so people can give a better answer.

Liam

-- 
Liam R. E. Quin [EMAIL PROTECTED]  http://www.holoweb.net/~liam/
Pictures from old books at http://fromoldbooks.org/


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: What key is now pressed?

2005-06-20 Thread Liam R. E. Quin
On Mon, 2005-06-20 at 21:28 +, Jan wrote:
 Hello.
 
 Using gdk_display_get_pointer, I can know is ctrl, alt, shift now up or
 down, 
 and I wonder is there function to check up or down any key?

A better approach is often to have a callback for a keypress and/or
key release.  Have your program react to key presses rather than
polling.

If you're trying to make the user hold control-alt-w down while
dragging, you may run into accessibility problems!

I'm sorry if I didn't really understand your question though.

Liam

-- 
Liam Quin, W3C XML Activity Lead, http://www.w3.org/People/Quin
Pictures from old books: http://www.holoweb.net/~liam/pictures/oldbooks/
IRC (chat) programs: www.ircreviews.org/clients/

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: OT: Processor register size

2005-04-12 Thread Liam R. E. Quin
On Mon, 2005-04-11 at 20:20 -0500, Timothy Flechtner wrote:
 wouldn't a pointer be register size?

Depends on the CPU architecture.  E.g. some have
a mixture of register sizes (especially 8-bit CPUs,
but also 16-bit ones).  On the PDP11 series an int
was typically 16 bits and so was a register, but
a pointer would be 32 bits (and so was a long).


 typedef unsigned char byte;
 byte word[sizeof(float)];

A float almost never fits into a register (except on
the FPU of course), but that expression will get you the numbe
of bytes that a float uses in memory, which seems to be
what you want.  You could also use
#define FLOAT_BYTES sizeof(float)

Liam


-- 
Liam Quin, W3C XML Activity Lead, http://www.w3.org/People/Quin
Pictures from old books: http://www.holoweb.net/~liam/pictures/oldbooks/
IRC (chat) programs: www.ircreviews.org/clients/

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: how to communicate with LPT? is this posible?

2005-03-22 Thread Liam R. E. Quin
On Tue, 2005-03-22 at 13:31 -0400, Antonio Gomes wrote:
 LTP = Linux Test Project ?!

I'm guessing ALLs soft meant the printer, since
LPT was the name for a Line Printer on some 1960s
DEC operating systems.

If so, the answer depends... to send something to the
printer, you can pipe output to lpr or lp; for a better
interface, see maybe libgnomeprint?

Liam


-- 
Liam Quin, W3C XML Activity Lead, http://www.w3.org/People/Quin
Pictures from old books: http://www.holoweb.net/~liam/pictures/oldbooks/
IRC (chat) programs: www.ircreviews.org/clients/

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: label char ''

2005-02-13 Thread Liam R. E. Quin
On Sun, 2005-02-13 at 18:20 +0100, ALLs soft wrote:
 gtk_label_set_markup (GTK_LABEL (naziv_pjesme), span weight=\bold\ 
 size=\xx-large\Naziv pjesme/span);
 
 why i cant print any string with ''?

The  is special in XML, so you need to escape it.
Either use amp; or #38;

Liam

-- 
Liam Quin, W3C XML Activity Lead, http://www.w3.org/People/Quin
Pictures from old books: http://www.holoweb.net/~liam/pictures/oldbooks/
IRC (chat) programs: www.ircreviews.org/clients/

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list