Re: gtk_paint_string future

2002-06-06 Thread Matej Knopp

Dňa St, 2002-06-05 at 22:18, Daniel Elstner napísal:
> Am Mit, 2002-06-05 um 21.21 schrieb Matej Knopp:
> > 
> > I'm writing an application and have chosen Gtk+ 2.0 for the gui. During
> > the programming I came to a very significant problem. The main window
> > consists of a pane with GtkTextView and GtkTreeView. The text view is
> > fine but the tree view almost made me abanon Gtk. It has 12 columns
> > (text) and after it's filled working with the app turns to be a pain.
> > Some experimentation showed the reason: GtkCellRendererText (and Pango).
> > Resizing the window, moving the pane or resizing columns was so delayed
> > that the app was absolutely unusable for production. I like pango and
> > the way it works but computing unicode layout and painting it so many
> > times was a too big deal even for duron 850. So I decided let unicode be
> > a wrote my own simple text renderer that converts unicode to 8 bit local
> > enc. and draws it with gtk_paint_string. It works suprisingly well.
> 
> I just can't stand it.  That's so damn egoistic.  Yes, I honestly hope
> others will be able to help you with the performance problems.  But
> performance reasons just can't be taken as an excuse for not using
> Unicode.  Did you realize that most people on this world speak languages
> which cannot be represented in an 8bit encoding?

Yes, I did. But the app is very specific and I doubt anyone out of my
country would find any use for it. It's not a problem to add a feature
that would allow you to switch to unicode but this is not the point.
Forcing me to use unicode (removing gtk_paint_string) would almost equal
to forcing me to change toolkit because The application would be
unusable for the people here who need it no matter how many languages it
could render.


> > So my question is: How long will the gtk_paint_string be in Gtk+?
> > I know gtk_paint_string is deprecated but it seems to be the only thing
> > that can make my app usable. Can I count on it in future? 
> > I also know that with gtk_paint_string there's no bi-di, antialiasing,
> > etc. but I'd give all these for fast text output.
> 
> It would be much better to ask how you can make the Pango version
> faster.  I suspect it *might* a problem on your side, a Duron 850 is not
> slow enough to render your app "unusable".

I can hardly imagine the rendering could undertake some significant
optimization without huge increasing of the memory consumption. 
I've mentioned the other possible optimizations but I don't dare to do
it myself (I'm not a GtkTreeView hacker...).

> --Daniel

-matej.


___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Tooltip in a grafigwidget

2002-06-06 Thread Bernd Demian

Hi all,
I have a little problem, I show in a gtk2 application in a drawable some
objects and I want show the user the name of the object when he goes
over the object with the pointer and wait for 1 or 2 second. I have no
idea which widget i have to take for this  task. I think tooltips  are
not flexible enough. Please help.
Bernd



___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Problem with g_io_channel_read_chars

2002-06-06 Thread Andrew E. Makeev

Good day,

I am trying to write app that gonna connect to remote host using TCP
service.

So, I've created connection channel (simple error handling is omitted):

m_FileDescriptor = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
connect(m_FileDescriptor, (struct sockaddr *)&m_Addr,
sizeof(m_Addr);
m_pChannel = g_io_channel_unix_new (m_FileDescriptor);

Then set callback:

Glib::signal_io().connect (SigC::slot(*this,
&TcpClient::tcp_action_cb),
   m_FileDescriptor, Glib::IO_IN |
Glib::IO_HUP);

...

bool TcpClient::tcp_action_cb (Glib::IOCondition cond)
{
switch(cond)
{
case Glib::IO_IN:
cout << "tcp_action_cb(): Got Glib::IO_IN"
 << endl;
if (!tcp_read ())
{
// [error handling]
return false;
}
break;
...
}
return true;
}

Where tcp_read() defined as:

bool TcpClient::tcp_read ()
{
gsize   rsize;
gchar   buffer[5120];
GError *errcode = 0;
Glib::ustring   data;
if ((status = g_io_channel_read_chars ( m_pChannel,
buffer,
sizeof(buffer),
   &rsize,
   &errcode)) !=
G_IO_STATUS_NORMAL)
{
cout << endl << "tcp_read(): " << errcode->message << endl;
if (errcode) g_free (errcode);
return false;
}
}
if (errcode) g_free (errcode);

// [work on buffer data]
return true;
}

And tcp_write() function:

bool TcpClient::tcp_write (Glib::ustring& str)
{
GError *errcode = 0;
gsize   rsize;

if (str[str.size()-1] != '\n') str += '\n';

if (g_io_channel_write_chars (m_pChannel,
  str.c_str(),
  str.size(),
  &rsize,
  &errcode) != G_IO_STATUS_NORMAL)
{
cout << "tcp_write(): " << errcode->message << endl;
if (errcode) g_free (errcode);
return false;
}
if (errcode) g_free (errcode);

// gotta flush chan write buffer to force remote host to get my
message
// remote host application written in TCL, using socket as well
// it reads messages and always writes some answer back
g_io_channel_flush (m_pChannel, 0);

return true;
}

Ok, the problem is - I am able to read from remote host only once.
connect...

send 1st message, get answer (usually 1-2 text lines "500\n300[n\]") ->
OK.

send 2nd (and any next, if I didn't remove watch callback with error):
then I got error: "Invalid byte sequence in conversion input" that came
in GError.

My TCL app on other side was still running and getting my messages, but
I won't receive any of the answers back.

Could someone explain in what cases that error occurs?
And could someone, please, gimme a hint how to handle reading properly?

thanks
-Andrew


___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



How can I refresh sorting rules?

2002-06-06 Thread Jarek Dukat

I have a GtkTreeView. I call gtk_tree_sortable_set_default_sort_func()
with some function and then
gtk_tree_sortable_set_sort_column_id(GTK_DEFAULT_SORT_COLUMN_ID).
Sorting works well, but some time later I want to change sorting
function to some other one. But calling ...set_default_sort_func again
doesn't force the model to re-sort its data. How can I force it to do
so?

-- 
struct Sig {
  string name(" J a r e k   D u k a t ");
  string mail(" madmaxer (at) poczta (dot) fm ");
};


--
Aaa, fantastyczny sprzet DVD do wygrania!!!
>>> http://link.interia.pl/f15e4 


___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: gtk_paint_string future

2002-06-06 Thread Matej Knopp

Dňa St, 2002-06-05 at 22:49, Chris Nystrom napísal:
> On 5 Jun 2002, Daniel Elstner wrote:
> 
> > I just can't stand it.  That's so damn egoistic.  Yes, I honestly hope
> > others will be able to help you with the performance problems.  But
> > performance reasons just can't be taken as an excuse for not using
> > Unicode.
> 
> If the performance is unacceptable, then the performance is unacceptable.
> If reducing the target user base is the only way the programmer can get
> his or her app to work to their standard, then that is their decision. If
> this is an open source project, you are free to improve it if you want.

You got the point. Nobody would use program with such a slow feedback if
there were more acceptable solutions. And adding support for unicode is
a matter of several lines to allow switching the cell renderers. Anyone
who could afford it could use unicode. For the others (who are the
primary target) 8-bits are enough.

> Either the library has to be sped up, or if it is a problem with the
> person writing the code, then the documentation needs to improve. Don't
> shoot the messenger. This is valuable feedback.

I can't affect the performance of the CellRenderer. The Gtk+ demos are
faster, but the difference is that my table is bigger (covers almost the
whole screen) and also more dense (12 columns).

> My $0.02,
> Chris
> 
> 


___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: gtk_paint_string future

2002-06-06 Thread Soeren Sandmann

Matej Knopp <[EMAIL PROTECTED]> writes:

> I can hardly imagine the rendering could undertake some significant
> optimization without huge increasing of the memory consumption. 
> I've mentioned the other possible optimizations but I don't dare to do
> it myself (I'm not a GtkTreeView hacker...).

Actually, a variant of the "only draw uncovered areas" optimization
has been in CVS HEAD for a while. You could try that version (it is
source and binary compatible), but if the current TreeView is really
_unusable_, then I suspect something else might be the real reason.
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



blit'n

2002-06-06 Thread Billy Patton

Please forgive me for not looking at the archive first.  I'm multi-tasking
just to do this( jumpinging between writing in gtk and testing 4 other
programs)

I've currently gotten my data to draw to a drawing area.  I have the
scaling and shifting all done, don't know if it is right, but it works for
now.

I've gottne this far from looking at examples to get something to work.

Now I need to speed up my data drawing.

I have a configure_event that creates a pixmap and draws it black.  I want
a black background;
It then calls my draw_cell which draws into the pixmap.
Within this recursive routine I do
gdk_rgb_gc_set_foreground(gc,white);
gdk_draw_rectangle (pixmap,gc,FALSE,mcr.ll.x,mcr.ll.y,w,h);

and some
gdk_rgb_gc_set_foreground(gc,white);
gdk_draw_polygon(pixmap,gc,FALSE,gpts,npts);

At the end of this function I do a 

gdk_draw_pixmap(drawing_area->window,gc,pixmap,0,0,0,0,canvas_x,canvas_y);


I take it that this is my blitting.  Problem is I may call this draw_cell
several hundred thousand times.  SO this is ver slow.

Should this draw_pixmap be placed after the call to draw_cell
so that blitting is done only once?

My code was originally written for gtk1.???

Is there any new features that allows scaling of data,
0,0 at the lower left??

___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: Wheel Mouse Scrolling

2002-06-06 Thread Vince Busam

>From what I understand (and please speak up if I'm wrong), this is done by 
the driver.  E.g., the application is getting a page up or page down 
command, not a "mouse wheel up" or "mouse wheel down" command.  Thus, 
you'd have to configure your driver to send different commands.  In 
XFree86, you'd use imwheel to change that.

Vince

On Sat, 1 Jun 2002, Robert Boucher wrote:

> Is there any way to adjust the amount of scrolling that's done when the 
> wheel button on a mouse is moved up or down?
> 
> Right now it seems to scroll half a page of whatever is focused.  Can it 
> somehow be set to an absolute value (like three lines) or a lower 
> percentage?
> 
> This seems to be the case with both GTK+ 1.2.x and 2.0.x.
> 
> -Rob
> 
> ___
> gtk-list mailing list
> [EMAIL PROTECTED]
> http://mail.gnome.org/mailman/listinfo/gtk-list
> 

-- 
Vince Busam
http://www.phatnoise.com

___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Newbie question: # of colors in a pixmap

2002-06-06 Thread Gabriel Chime

What is the number of all possible colors in a pixmap?
Is it 2^depth?

Thanks in advance.


__
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: multithreading problem.

2002-06-06 Thread Robert Walker

On Tue, 4 Jun 2002, Paul Davis wrote:

> > I called gthread_init() at the beginning of the program
> >and the gtk_main() is surrounded by threads_enter(), threads_leave() calls.
> > It probably doesn't make any difference but I am using pthreads.
>
> no, it makes no difference. there's no big secret to doing this. you
> either wrap *every* call, or you use the generally simpler and more
> designer-style approach of having only a single thread ever make
> glib/gdk/gtk/xlib calls (others communicate with that thread via a
> pipe or some other mechanism). it works - i've written several MT
> programs that use GTK+ (in some cases, with up to 10 threads), and i
> have no problems with any of this stuff until i forget the rule and
> end up inadvertently calling a glib/gdk/gtk/xlib function from the
> wrong thread.


I guess I am going to give the second approach a try. A simple pipe should
do the job but is there any message system in gtk/glib/gdk that
should be used (user defined signals ?) ?

Thanks a lot.
Bob.

>
> --p
>

___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



A question about menu color. Thank you for respond.

2002-06-06 Thread 海鸥

Hi! all:
 I want to change the front-ground color of menu, but I can't find the
function in GTK library, could you tell me how to do that? thanks!
 Also, could you tell me how to attach a pixmap to menu or menuitem? thanks!
 And, I only want to use gtk for this function.



face-3.gif
Description: GIF image


steal window

2002-06-06 Thread xy s

Hi all,

I new a gtk window( gtk_window_new() )
and also I create a X11 window ( XCreateWindow() ).
And now, thw window can be displayed on screen.
But how can I put the X11 window into the gtk window ?

Thanks very much !

Jason

__
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



More info about signals

2002-06-06 Thread Philippe FREMY


Hi,

I am trying to understand better the signal stuff of Gtk. I have read the
tutorial but I still have some questions. The api reference did not help me
much.

1. All the arguments that are received by the function the signal is
connected to are set when connecting the signal, right ? I'm asking this
because I am more familiar with Qt where you define the info that your
signal is carrying when emitting the signal.

2. Is it possible to pass more info in the signals than just a pointer ? All
the signals I have seen are either signals linked to events or signal
without much info embedded in them. What if I want to pass three int and a
custom struct in  my signal ? Is it what the marshaller are for ?

Thanx in advance,

Philippe
###

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.F-Secure.com/

___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



gtk_adjustment_get_value()

2002-06-06 Thread David J. Singer


OK, it's late and I'm probably going mad.

I've been playing around with Gtk Adjustments and have found some 
useful examples  My problem is, everything works just fine until 
I try and call gtk_adjustment_get_value(), then it gets weird...!

My compilation fails with: undefined reference to `gtk_adjustment_get_value'

Why is this!?  The call is documented in the Gtk tutorial.  I've even seen 
it mentioned on this list!   

I'm using Gtk 1.2.  Have I missed something *really* obvious...!?

-- 
David J. Singer
[EMAIL PROTECTED]
"Time flies like an arrow, fruit flies like a banana"
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



allocation returns -1, -1, 1, 1

2002-06-06 Thread Jason Bodnar

I'm using gtk-perl but I think this is general GTK thing. 

I'm adding hboxes as needed in a signal handler to hold rows of photo
thumbnails. The first hbox which is created before the main loop even starts
returns proper numbers from $widget->allocation but hboxes that are added
during the signal handler return -1, -1, 1, 1 for x, y, height and width. 


I'm calling show_all on the hboxes parents to make sure everything gets shown
so I guess I need to some how force space to be allocated for the hboxes since
that doesn't seem to happen inside the signal handler?

--
Jason Bodnar
[EMAIL PROTECTED]
http://www.shakabuku.org

___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: allocation returns -1, -1, 1, 1

2002-06-06 Thread Jean-Yves Lefort

On Thu, 6 Jun 2002 20:21:13 -0500
"Jason Bodnar" <[EMAIL PROTECTED]> wrote:

> I'm adding hboxes as needed in a signal handler to hold rows of photo
> thumbnails. The first hbox which is created before the main loop even
> starts returns proper numbers from $widget->allocation but hboxes that
> are added during the signal handler return -1, -1, 1, 1 for x, y,
> height and width. 
> 
> 
> I'm calling show_all on the hboxes parents to make sure everything
> gets shown so I guess I need to some how force space to be allocated
> for the hboxes since that doesn't seem to happen inside the signal
> handler?

$widget->realize() might help you.

Regards,
Jean

-- 
Jean-Yves Lefort

[EMAIL PROTECTED]
http://void.adminz.be/
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: allocation returns -1, -1, 1, 1

2002-06-06 Thread Jason Bodnar

> On Thu, 6 Jun 2002 20:21:13 -0500
> "Jason Bodnar" <[EMAIL PROTECTED]> wrote:
> 
> > I'm adding hboxes as needed in a signal handler to hold rows of photo
> > thumbnails. The first hbox which is created before the main loop even
> > starts returns proper numbers from $widget->allocation but hboxes that
> > are added during the signal handler return -1, -1, 1, 1 for x, y,
> > height and width. 
> > 
> > 
> > I'm calling show_all on the hboxes parents to make sure everything
> > gets shown so I guess I need to some how force space to be allocated
> > for the hboxes since that doesn't seem to happen inside the signal
> > handler?
> 
> $widget->realize() might help you.

Unfortunately, that didn't seem to help. If I called realize on the widget
before it was packed I got an error about a NULL window which makes sense. If
I called realize after it's packed I still got -1, -1, 1, 1.

Thanks for your help,

Jason


--
Jason Bodnar
[EMAIL PROTECTED]
http://www.shakabuku.org

___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list