Can GTK+ make use of XSHM extension from MIT

2008-01-10 Thread Bin Chen
Hello,

I am running GTK+ in a singal machine, the machine is slow so I want
make GTK+ use XSHM extension to accelerate the drawing speed.

By taking a look at both GTK+ source code and the MIT-SHM paper, my
conclusion is :

1) The XSHM can only support XImage and Pixmap.
2) The GTK+ engine update the image using XCopyArea, so its impossible
to accelerate the entire process.

I am thinking a case, we do all the rendering process in GTK+
side(such as use pango to render text, use other library to render
image), the transfer the rendered image to XServer using XSHM, then
draw this Image to the window.

Will this work?

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


Re: Can GTK+ make use of XSHM extension from MIT

2008-01-10 Thread Bin Chen
On Jan 10, 2008 4:26 PM, Tapani Pälli [EMAIL PROTECTED] wrote:
 Hello;

 ext Bin Chen wrote:
  Hello,
 
  I am running GTK+ in a singal machine, the machine is slow so I want
  make GTK+ use XSHM extension to accelerate the drawing speed.
 
  By taking a look at both GTK+ source code and the MIT-SHM paper, my
  conclusion is :
 
  1) The XSHM can only support XImage and Pixmap.
 
 It is supporting the creation of XImage structure in shared memory and
 'transferring' it to X-server to be used as a pixmap.

  2) The GTK+ engine update the image using XCopyArea, so its impossible
  to accelerate the entire process.
 
  I am thinking a case, we do all the rendering process in GTK+
  side(such as use pango to render text, use other library to render
  image), the transfer the rendered image to XServer using XSHM, then
  draw this Image to the window.
 
 

 SHM extension is made to 'accelerate' data transfer between X client and
 server when they reside on same machine. When data is on server end, it
 can be used and manipulated via Xlib commands such as XCopyArea and the
 operation is done on server side. Operation performance depends on the
 X-server driver implementation.

  Will this work?
 

 Your usecase is valid, but are you facing some performance issues with
 current implementation? Have you profiled where the time is actually
 spent? You might want to create these buffers (images) beforehand and
 then transfer them to server. See also XRender API for rendering and
 manipulating buffers on server-side.

I am not doing very detailed profiling against this, but by comparing
the frame rate in my player against using pure framebuffer
implementation. The performance difference is large. If not using
shared memory to transfer the decoded image data, obviously the
performance can't be good in slow machine.

The GTK+ can draw pixbuf and image to the drawable, is there any
existing method for me to choose to force the low level gdk to use SHM
extension?

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


Re: Can GTK+ make use of XSHM extension from MIT

2008-01-10 Thread Tapani Pälli
Hello;

ext Bin Chen wrote:
 Hello,

 I am running GTK+ in a singal machine, the machine is slow so I want
 make GTK+ use XSHM extension to accelerate the drawing speed.

 By taking a look at both GTK+ source code and the MIT-SHM paper, my
 conclusion is :

 1) The XSHM can only support XImage and Pixmap.
   
It is supporting the creation of XImage structure in shared memory and
'transferring' it to X-server to be used as a pixmap.

 2) The GTK+ engine update the image using XCopyArea, so its impossible
 to accelerate the entire process.

 I am thinking a case, we do all the rendering process in GTK+
 side(such as use pango to render text, use other library to render
 image), the transfer the rendered image to XServer using XSHM, then
 draw this Image to the window.

   

SHM extension is made to 'accelerate' data transfer between X client and
server when they reside on same machine. When data is on server end, it
can be used and manipulated via Xlib commands such as XCopyArea and the
operation is done on server side. Operation performance depends on the
X-server driver implementation.

 Will this work?
   

Your usecase is valid, but are you facing some performance issues with
current implementation? Have you profiled where the time is actually
spent? You might want to create these buffers (images) beforehand and
then transfer them to server. See also XRender API for rendering and
manipulating buffers on server-side.


 Thanks.
 Bin
 ___
 maemo-developers mailing list
 [EMAIL PROTECTED]
 https://lists.maemo.org/mailman/listinfo/maemo-developers

   


// Tapani Pälli

-- 
Software Engineer
Open Source Software Operations 

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


Re: Can GTK+ make use of XSHM extension from MIT

2008-01-10 Thread Tapani Pälli
Hello;

ext Bin Chen wrote:
 On Jan 10, 2008 4:26 PM, Tapani Pälli [EMAIL PROTECTED] wrote:
   
 Hello;

 ext Bin Chen wrote:
 
 Hello,

 I am running GTK+ in a singal machine, the machine is slow so I want
 make GTK+ use XSHM extension to accelerate the drawing speed.

 By taking a look at both GTK+ source code and the MIT-SHM paper, my
 conclusion is :

 1) The XSHM can only support XImage and Pixmap.

   
 It is supporting the creation of XImage structure in shared memory and
 'transferring' it to X-server to be used as a pixmap.

 
 2) The GTK+ engine update the image using XCopyArea, so its impossible
 to accelerate the entire process.

 I am thinking a case, we do all the rendering process in GTK+
 side(such as use pango to render text, use other library to render
 image), the transfer the rendered image to XServer using XSHM, then
 draw this Image to the window.


   
 SHM extension is made to 'accelerate' data transfer between X client and
 server when they reside on same machine. When data is on server end, it
 can be used and manipulated via Xlib commands such as XCopyArea and the
 operation is done on server side. Operation performance depends on the
 X-server driver implementation.

 
 Will this work?

   
 Your usecase is valid, but are you facing some performance issues with
 current implementation? Have you profiled where the time is actually
 spent? You might want to create these buffers (images) beforehand and
 then transfer them to server. See also XRender API for rendering and
 manipulating buffers on server-side.

 
 I am not doing very detailed profiling against this, but by comparing
 the frame rate in my player against using pure framebuffer
 implementation. The performance difference is large. If not using
 shared memory to transfer the decoded image data, obviously the
 performance can't be good in slow machine.
   

You did not mention a 'player' before. Video playback is very much of a
special case. Are you drawing/compositing other elements on top of
video? If so, you are entering very experimental areas here. You might
want to check out Xv extension which is available for video. I don't
know much about video so I'll stop here, good luck :-)

 The GTK+ can draw pixbuf and image to the drawable, is there any
 existing method for me to choose to force the low level gdk to use SHM
 extension?

 Thanks.
 Bin

   


// Tapani Pälli

-- 
Software Engineer
Open Source Software Operations 

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


Re: Whats the purpose of libegg

2008-01-10 Thread Nigel Tao
On 06/01/2008, Bin Chen [EMAIL PROTECTED] wrote:
 I searched the internet for libegg and found some tips but still can't
 got whats libegg working for? Is it another useful widget lib?
 After I check out the libegg and catch the README:

   - All features are intended to end up in a stable platform library
  when they're ready.

 Whats the meaning?

My understanding is that libegg is for code that is useful enough to
be shared, but experimental enough to exclude it from a package like
GTK or GLib that promises API stability.  Eventually, as consensus
forms about its design and implementation, the code gets migrated to
the appropriate package, but in the meantime, you just copy and paste
libegg code into your source.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: OpenGL interface

2008-01-10 Thread Jon Harrop
On Thursday 03 January 2008 19:02:03 Peter Hildebrandt wrote:
 Happy new year everyone,

 I'd like to use opengl in my gtk application.  I've come across GtkGLArea
 [1] and GtkGLExt [2].  The former appears to be undocumented, while the
 latter is according to the website no longer actively maintained.

The latter website says:

  GtkGLExt has new maintainers! More information will be available soon.

 Which one should I use?  Or is there a different solution out there?

 I am working on linux (Ubuntu 7.10, GTK 2.20).

You can use the package popularity contest to find out what most other people 
are using. This is an excellent way to jump straight to mature software!

I get:

  libgtkglext1: 42,020
  gtkglarea5:8,148

  libgtkglext1-dev: 2,614
  gtkglarea5-dev: 652

So the newer GTKGLExt library is substantially more common among both users 
and developers. I actually use GLArea from OCaml and haven't had any 
difficulties (although I don't distribute in compiled form).

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


gtk and color in a GtkTextview

2008-01-10 Thread exhortae

Hi,

First of all sorry for my bad english .

I would like to know how I can color text entered in a GtkTextView (in real
time), let me explain.

first when the user enter text it is displayed normally, then if my lexer
recognize the text, I want to be able to color it, I have the lexer, the
problem is with the coloring. This is what I have done as a start in
coloring fonts but it doesn't work. Can someone please tell me what am I
missing. 

thank you



*/--
   GtkTextView (color)
  
--
*/
#include gtk/gtk.h

int main (int argc, char **argv)
{

   GtkWidget *p_fenetre = NULL;
   GtkWidget *p_zone_texte = NULL;
   GtkTextBuffer *p_tampon = NULL;
   GtkTextIter start;
   GtkTextIter end;


   gtk_init (argc, argv);

  p_fenetre = gtk_window_new (GTK_WINDOW_TOPLEVEL);

 
   gtk_window_set_default_size (GTK_WINDOW (p_fenetre), 320, 200);

  
   p_zone_texte = gtk_text_view_new ();

  
   p_tampon = gtk_text_view_get_buffer (GTK_TEXT_VIEW (p_zone_texte));


   gtk_container_add (GTK_CONTAINER (p_fenetre), p_zone_texte);

   
   gtk_text_buffer_create_tag (p_tampon, font-blue, foreground, blue,
NULL);

  
   gtk_text_buffer_get_bounds (p_tampon, start, end);
   gtk_text_buffer_apply_tag_by_name (p_tampon, font-blue, start, end);

   
   gtk_widget_show_all (p_fenetre);

   g_signal_connect (G_OBJECT (p_fenetre), delete_event, G_CALLBACK
(gtk_main_quit), NULL);

   /* Boucle */
   gtk_main ();

   return 0;
}



-- 
View this message in context: 
http://www.nabble.com/gtk-and-color-in-a-GtkTextview-tp14497051p14497051.html
Sent from the Gtk+ - Apps Dev mailing list archive at Nabble.com.

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


Re: Can GTK+ make use of XSHM extension from MIT

2008-01-10 Thread Emmanuele Bassi

On Thu, 2008-01-10 at 16:50 +0800, Bin Chen wrote:

 The GTK+ can draw pixbuf and image to the drawable, is there any
 existing method for me to choose to force the low level gdk to use SHM
 extension?

if the Xshm extension is available at compile time, gtk+ will use it;
there's no need to force anything.

ciao,
 Emmanuele.

-- 
Emmanuele Bassi,
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net

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


Test

2008-01-10 Thread 张飞
Just a test!
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


menu sensitivity setup hook

2008-01-10 Thread Steve Splonskowski
Hello,

I have been searching around to find the appropriate way (hook) to  
know when to setup the sensitivity of the menu and toolbar (action)  
items in my GTK app.

All other UI frameworks that I have ever worked with had a well  
defined way to get notified that the menu items needed their enabled/ 
disabled state setup. But I have not found this place in GTK.

Any ideas?

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


Destroying a GtkNotebook

2008-01-10 Thread Cyril Dupuit
Hello,

I am delopping an application on Windows XP that uses a GtkNotebook but I 
don't know how can I destroy it without destoying the application.

At the initialization of my application, I create the menu, the toolbar and 
when I open a file, a GtkNotebook is created to draw some information.

But, when this file is closed, I need to close this Notebook too (because 
the drag and drop doesn't work with a notebook).

To do that, I am using g_object_unref() function but I have some warnings 
:

GLib-GObject-WARNING **: instance of invalid non-instantiatable type 
`invalid'
GLib-GObject-CRITICAL **: g_signal_emit_valist: assertion 
`G_TYPE_CHECK_INSTANCE (instance)' failed
GLib-GObject-WARNING **: instance of invalid non-instantiatable type 
`invalid'
GLib-GObject-CRITICAL **: g_signal_handlers_destroy: assertion 
`G_TYPE_CHECK_INSTANCE (instance)' failed
GLib-GObject-WARNING **: instance of invalid non-instantiatable type 
`invalid'
GLib-GObject-CRITICAL **: g_signal_handlers_destroy: assertion 
`G_TYPE_CHECK_INSTANCE (instance)' failed

I think that is not the better way to destroy the notebook and to free all 
the associated memory.

Have you any solution that can help me ?

Thank you in advance,

Cyril 

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


How to program a simple dialog?

2008-01-10 Thread Florian Harmuth
Hello all,
i try to program a simple dialog without success.

Here is my actual code:
code
#include unistd.h
#include stdlib.h
#include gtk/gtk.h

void quick_message () {

   GtkWidget *system_dialog, *label;

   /* Create the widgets */

   system_dialog = gtk_dialog_new ();
   gtk_widget_set_name (system_dialog, system_dialog);
   gtk_window_set_title (GTK_WINDOW (system_dialog), System Settings);
   gtk_window_set_position (GTK_WINDOW (system_dialog), GTK_WIN_POS_CENTER);
   gtk_window_set_modal (GTK_WINDOW (system_dialog), TRUE);
   gtk_window_set_default_size (GTK_WINDOW (system_dialog), 500, 280);
   gtk_window_set_resizable (GTK_WINDOW (system_dialog), FALSE);
   gtk_window_set_type_hint (GTK_WINDOW (system_dialog),
GDK_WINDOW_TYPE_HINT_DIALOG);

   label = gtk_label_new ();

   /* Ensure that the dialog box is destroyed when the user responds. */

   g_signal_connect_swapped (system_dialog,
 response,
 G_CALLBACK (gtk_widget_destroy),
 system_dialog);

   /* Add the label, and show everything we've added to the dialog. */

   gtk_container_add (GTK_CONTAINER (GTK_DIALOG(system_dialog)-vbox),
  label);
   gtk_widget_show_all (system_dialog);
}


int main(int argc, char *argv[])
{
quick_message();

return 0;
}
/code

Here is my compile line: cc -o tc_system_new main.c `pkg-config --cflags
--libs gtk+-2.0 gthread-2.0 glib-2.0`

And here is my error output:

 [EMAIL PROTECTED]:~/Desktop/really_new# ./tc_system_new

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-CRITICAL **: g_once_init_leave: assertion
`initialization_value != 0' failed

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-GObject-CRITICAL **: g_type_add_interface_static:
assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-GObject-CRITICAL **: g_type_add_interface_static:
assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-GObject-CRITICAL **: g_type_add_interface_static:
assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-CRITICAL **: g_once_init_leave: assertion
`initialization_value != 0' failed

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-GObject-CRITICAL **: g_type_add_interface_static:
assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(process:6096): GLib-CRITICAL **: g_once_init_leave: assertion
`initialization_value != 0' failed

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-GObject-CRITICAL **: g_type_add_interface_static:
assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(process:6096): GLib-CRITICAL **: g_once_init_leave: assertion
`initialization_value != 0' failed

(process:6096): GLib-GObject-CRITICAL **: g_object_new: assertion
`G_TYPE_IS_OBJECT (object_type)' failed

Any suggestions?

Best regards,
flo
___
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 program a simple dialog?

2008-01-10 Thread Eduardo M KALINOWSKI
Florian Harmuth wrote:
 Hello all,
 i try to program a simple dialog without success.

 Here is my actual code:
 code
 #include unistd.h
 #include stdlib.h
 #include gtk/gtk.h

 void quick_message () {

GtkWidget *system_dialog, *label;

/* Create the widgets */

system_dialog = gtk_dialog_new ();
gtk_widget_set_name (system_dialog, system_dialog);
gtk_window_set_title (GTK_WINDOW (system_dialog), System Settings);
gtk_window_set_position (GTK_WINDOW (system_dialog), GTK_WIN_POS_CENTER);
gtk_window_set_modal (GTK_WINDOW (system_dialog), TRUE);
gtk_window_set_default_size (GTK_WINDOW (system_dialog), 500, 280);
gtk_window_set_resizable (GTK_WINDOW (system_dialog), FALSE);
gtk_window_set_type_hint (GTK_WINDOW (system_dialog),
 GDK_WINDOW_TYPE_HINT_DIALOG);

label = gtk_label_new ();

/* Ensure that the dialog box is destroyed when the user responds. */

g_signal_connect_swapped (system_dialog,
  response,
  G_CALLBACK (gtk_widget_destroy),
  system_dialog);

/* Add the label, and show everything we've added to the dialog. */

gtk_container_add (GTK_CONTAINER (GTK_DIALOG(system_dialog)-vbox),
   label);
gtk_widget_show_all (system_dialog);
 }


 int main(int argc, char *argv[])
 {
 quick_message();

 return 0;
 }
 /code

 Here is my compile line: cc -o tc_system_new main.c `pkg-config --cflags
 --libs gtk+-2.0 gthread-2.0 glib-2.0`

 And here is my error output:

 [snip]

 Any suggestions?

   
Yes. Read the GTK+ Tutorial at http://gtk.org/tutorial/ . This way you 
would know that  you must call gtk_init() at the start of the program 
(that's the cause for the messages), and that you need a call to 
gtk_main() to do anything useful (in this case, displaying the window).


-- 
I must have slipped a disk -- my pack hurts!

Eduardo M KALINOWSKI
[EMAIL PROTECTED]
http://move.to/hpkb

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


Re: Destroying a GtkNotebook

2008-01-10 Thread Eduardo M KALINOWSKI
Cyril Dupuit wrote:
 Hello,

 I am delopping an application on Windows XP that uses a GtkNotebook but I 
 don't know how can I destroy it without destoying the application.

 At the initialization of my application, I create the menu, the toolbar and 
 when I open a file, a GtkNotebook is created to draw some information.

 But, when this file is closed, I need to close this Notebook too (because 
 the drag and drop doesn't work with a notebook).

 To do that, I am using g_object_unref() function but I have some warnings 
 :

 GLib-GObject-WARNING **: instance of invalid non-instantiatable type 
 `invalid'
 GLib-GObject-CRITICAL **: g_signal_emit_valist: assertion 
 `G_TYPE_CHECK_INSTANCE (instance)' failed
 GLib-GObject-WARNING **: instance of invalid non-instantiatable type 
 `invalid'
 GLib-GObject-CRITICAL **: g_signal_handlers_destroy: assertion 
 `G_TYPE_CHECK_INSTANCE (instance)' failed
 GLib-GObject-WARNING **: instance of invalid non-instantiatable type 
 `invalid'
 GLib-GObject-CRITICAL **: g_signal_handlers_destroy: assertion 
 `G_TYPE_CHECK_INSTANCE (instance)' failed

 I think that is not the better way to destroy the notebook and to free all 
 the associated memory.

 Have you any solution that can help me ?
   

The proper way to destroy widgets is with gtk_widget_destroy(). That 
should work.

-- 
I must have slipped a disk -- my pack hurts!

Eduardo M KALINOWSKI
[EMAIL PROTECTED]
http://move.to/hpkb

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


Re: Destroying a GtkNotebook

2008-01-10 Thread Cyril Dupuit
Thank you for your help,

It works fine !

Cyril

- Original Message - 
From: Eduardo M KALINOWSKI [EMAIL PROTECTED]
To: Cyril Dupuit [EMAIL PROTECTED]
Cc: gtk-app-devel-list@gnome.org
Sent: Thursday, January 10, 2008 10:03 PM
Subject: Re: Destroying a GtkNotebook


 Cyril Dupuit wrote:
 Hello,

 I am delopping an application on Windows XP that uses a GtkNotebook but I 
 don't know how can I destroy it without destoying the application.

 At the initialization of my application, I create the menu, the toolbar 
 and when I open a file, a GtkNotebook is created to draw some 
 information.

 But, when this file is closed, I need to close this Notebook too (because 
 the drag and drop doesn't work with a notebook).

 To do that, I am using g_object_unref() function but I have some 
 warnings :

 GLib-GObject-WARNING **: instance of invalid non-instantiatable type 
 `invalid'
 GLib-GObject-CRITICAL **: g_signal_emit_valist: assertion 
 `G_TYPE_CHECK_INSTANCE (instance)' failed
 GLib-GObject-WARNING **: instance of invalid non-instantiatable type 
 `invalid'
 GLib-GObject-CRITICAL **: g_signal_handlers_destroy: assertion 
 `G_TYPE_CHECK_INSTANCE (instance)' failed
 GLib-GObject-WARNING **: instance of invalid non-instantiatable type 
 `invalid'
 GLib-GObject-CRITICAL **: g_signal_handlers_destroy: assertion 
 `G_TYPE_CHECK_INSTANCE (instance)' failed

 I think that is not the better way to destroy the notebook and to free 
 all the associated memory.

 Have you any solution that can help me ?


 The proper way to destroy widgets is with gtk_widget_destroy(). That 
 should work.

 -- 
 I must have slipped a disk -- my pack hurts!

 Eduardo M KALINOWSKI
 [EMAIL PROTECTED]
 http://move.to/hpkb

 

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


Re: Can GTK+ make use of XSHM extension from MIT

2008-01-10 Thread Bin Chen
在 2008-01-10四的 17:40 +0200,Eero Tamminen写道:
 Hi,
 
 ext Bin Chen wrote:
  I am not doing very detailed profiling against this, but by comparing
  the frame rate in my player against using pure framebuffer
  implementation. The performance difference is large. If not using
  shared memory to transfer the decoded image data, obviously the
  performance can't be good in slow machine.
  
  The GTK+ can draw pixbuf and image to the drawable, is there any
  existing method for me to choose to force the low level gdk to use SHM
  extension?
 
 If you have a local connection to X server it uses that
 (where it helps, setting up XSHM has its own overhead).
 
 Gdk handles images internally as 32-bits, the display is 16-bits.
 Conversion is done automatically when needed by Gdk.  Need I say
 more?
 
 It sounds like your use-case would be more appropriate to be done
 with libSDL (which also does automatic conversions, but can handle
 surfaces in display bit-depth if you've just asked it to do that).

Ok, let me make the things clear, the content in a gdk window includes
many widgets, such as label, entry, button. But from the perspective of
X server, this widgets are just bitmaps with the states updated by GTK+,
right?

Xshm will accelerate the client to server transfer for type of Image and
Pixmap, but the GTK+ use XCopyArea to update the bitmap, can XCopyArea
can benefit from the Xshm?

In more detail, I am using gdk_draw_image to draw an image to a gdk
drawable, will this benefit the Xshm?

Of course, my GTK+ built with Xshm enabled and from Xdpyinfo the Xshm is
enabled in X side.



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

transparents widget and back image of menu

2008-01-10 Thread zfei
I want to make a widget transparent ! I have no ideahow to do it!
Is there anybody can help me!
Ps: If i want to chang the back pixmap of a menu  how to do that?
Thanks a lot!
Fei Zhang

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


Re: GIcon thoughts

2008-01-10 Thread Alexander Larsson

On Wed, 2008-01-09 at 13:53 -0500, Matthias Clasen wrote:
 This leaves GIcon support, pixel sizes and caching. Concrete API
 additions could look as follows:

That sounds like a good plan to me.

 /* Creates a new GtkIconInfo for a fixed pixbuf - this is not
 * really necessary as API, but it is used internally 
 * for GFileIcons, and making it public doesn't cost us much
 */
 GtkIconInfo *
 gtk_icon_info_new_for_pixbuf (GtkIconTheme *theme,
   GdkPixbuf*pixbuf);
 
 /* Looks up a GtkIconInfo for a GIcon and a given pixel size.
 * Note that looking up by pixel size still doesn't guarantee
 * that you actually get a pixbuf of that size; for that, see
 * load_at_size().
 *
 * To look up by GtkIconSize, use gtk_icon_size_lookup_for_settings. 
 */
 GtkIconInfo *
 gtk_icon_theme_lookup_by_gicon (GtkIconTheme *theme,
 GIcon*icon,
 gint  pixel_size);

 /* Loads the icon, and scales it to the given size -
 * some care should be taken to make load_at_size(); load() work
 * correctly wrt. to sizes, while still getting some caching 
 * benefits for repeated load_at_size() with the same size 
 */
 GdkPixbuf *
 gtk_icon_info_load_at_size (GtkIconInfo *info,
 gint pixel_size);
 

Since this does I/O it would be nice if it took a GCancellable argument.
However, that might be slightly weird, given that
gtk_icon_info_load_icon() doesn't. It should have a GError arg too.

 We can't implement the cache using toggle references for 2 reasons:
 a) GtkIconSize is a boxed, not an object 
 b) toggle references only work for a single user, thus they have
to be reserved for bindings, at least bindable objects.
 I propose to instead turn GtkIconInfo into a refcounted boxed object,
 and then implement the caching logic for the case that the refcount
 drops to one.

I'm not sure this is enought, cache-wise. In many cases you'd get a
GtkIconInfo, then get the pixbuf for that, save the pixbuf (e.g. in a
widget) and unref the info. In fact, it seems unlikely that apps would
keep the GtkIconInfo alive for long periods of time. It would be nice if
we could get the GtkIconInfo cached until the last ref is dropped to the
pixbuf. 

Of course, this is slightly harder, as GdkPixbuf is a public GObject
where we can't use toggle references. We could however implement this
with some help from the GdkPixbuf implementation. For instance, if we
add a resurrect signal to GdkPixbuf and have the dispose()
implementation emit this then the cache could connect to this and grab a
ref (for some time) before finalization. (The dispose call must also
detect that the object is ressurected and avoid chaining to dispose.)

That might be useful for other pixbuf caches too.


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


Re: l10n/i18n issue in gvfs [and glib]

2008-01-10 Thread Matthias Clasen
On Jan 10, 2008 4:09 AM, Alexander Larsson [EMAIL PROTECTED] wrote:


 
  Actually, I'd really rather not have an intltool dependency in glib.

 This is for gvfs only.



Ah, go ahead then.
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: l10n/i18n issue in gvfs [and glib]

2008-01-10 Thread Luca Ferretti

Il giorno mer, 09/01/2008 alle 10.17 +0100, Alexander Larsson ha
scritto:
  
  The fix (attached as patch) should be applied to _glib_ and is a
 simple:
 
  -   -e s/^\[.*\] +//  \
  +   -e /^\[.*\]/d \
 
 I don't think that is quite right. A better rule is probably :
  's/^\[[^]]*\] *//' as that strips any trailing newlines.
 Full patch attached.

I'll test it.

  Now, applying this patch to glib, reverting changes in gvfs (re-add
 call
  to glib-gettextize in autogen.sh, delete mkinstalldirs and
  po/Makefile.in.in from svn), everything works file: you can delete
 and
  recreate a working POTFILES and you can run intltool-update LANG
 with
  no errors.
 
 But does the --from-code=UTF-8 thing get added to the xgettext call?

Good question. I'll test this too.

  Waiting for this release, OK to use intltool in gvf? Just as workaround
  solution: gvfs don't need intltool 'cause all translations come from
  plain C source files (no .desktop, no .schemas, no .glade...)
 
 Yeah. Can you hack that up?
 

I'm doing just now: `make distcheck` says it's OK, so I'm going to
commit.

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


Can I use gtk_widget_unref() to releasetthe object created by gtk_invisible_new()?

2008-01-10 Thread Brian Lu
Hi, experts,

I found following codes will crash in gnome 2.21 environment:

  ...
  GtkWidget *foo = gtk_invisible_new();
  gtk_widget_unref(foo);
  ...

But it works well if gtk_widget_unref() is replaced with 
gtk_widget_destroy().

Does that mean that we can't use gtk_widget_unref() on such object and 
we can only
use gtk_widget_destroy() to release it?

Thanks

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


Re: Using GLX_EXT_texture_from_pixmap for redirected rendering of widgets/windows.

2008-01-10 Thread Rémi Cardona
Mirco Müller a écrit :
 Greetings xorg/gtk+-crowd!
 
   I finally got that gtk+-widgets _ontop_ of a GL-context working and
 would like to get some input from anybody interested in the topic.

I saw your blog post this morning, it's very cool :)

   Apart from toolkit-level input-redirection not working, which is likely
 another big chunk of work to design and implement, I am mainly
 interested in solving any possible GLXFBConfig-selection issues, people
 might run into. Sofar I've only successfully tested it under
 metacity/compiz on a GeForce-card and still battle to get it working on
 an i965.

I'm also interested in this. I'm working on making Metisse work with
XComposite and GLX_EXT_texture_from_pixmap and so far, I'm having
trouble find simple code that actually works.

Your examples come at the perfect time :)

I'll let you know if I find anything that could help.

Cheers

-- 
Rémi Cardona
LRI, Université Paris-Sud
[EMAIL PROTECTED]
[EMAIL PROTECTED]
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: GIO API review

2008-01-10 Thread Mathias Hasselmann

Am Donnerstag, den 13.12.2007, 17:31 +0100 schrieb Alexander Larsson:

 typedef enum {
   G_FILE_QUERY_INFO_FLAGS_NONE = 0,
   G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS = (10) 
 }
 
 vs
 
 typedef enum  {
   G_FILE_MONITOR_FLAGS_NONE = 0,
   G_FILE_MONITOR_FLAGS_MONITOR_MOUNTS = (10)
 } GFileMonitorFlags;
 
 What do people think is the best approach here?

To my knowledge GTK+ would call them:

typedef enum { /* flags */
  G_FILE_QUERY_INFO_NONE = 0,
  G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS = (10) 
} GFileQueryInfoFlags;

and

typedef enum { /* flags */
  G_FILE_MONITOR_NONE = 0,
  G_FILE_MONITOR_MONITOR_MOUNTS = (10)
} GFileMonitorFlags;

A problem is the doublicate monitor, so the second value should be
something like:

  G_FILE_MONITOR_WATCH_MOUNTS


Ciao,
Mathias
-- 
Mathias Hasselmann [EMAIL PROTECTED]
http://taschenorakel.de/


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: How to implement a UI like Microsoft Word table by GTK??

2008-01-10 Thread Bin Chen
在 2007-12-11二的 12:48 +0800,li_top写道:
  Hi all
 I have a problem to implement a UI like Microsoft Word table .
 That is , The UI have tables . User can combine 2or3 or more tables to one 
 table. How to 
 
 do this UI? Please help me .
 Thanks  Regardse
 Tom
 The UI like following:
 
 __
 |_|___|___|| 
 | | | | |
 | | | | | 
 |_|___|___||
 | | | | |
 |_|___|___||
  
Maybe you can try embed a gtk table in another gtk table.

Bin

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


Re: g_format_file_size_for_display()

2008-01-10 Thread Mathias Hasselmann

Am Dienstag, den 18.12.2007, 23:01 +0100 schrieb Sven Neumann:
 Hi,
 
 On Tue, 2007-12-18 at 16:45 -0500, David Zeuthen wrote:
  On Tue, 2007-12-18 at 14:50 -0600, Federico Mena Quintero wrote:
   Should this be called generically g_format_size_for_display()?  You
   could use it for more than file sizes (free RAM in gnome-system-monitor,
   etc.).
  
  It's here btw
  
  http://svn.gnome.org/viewvc/glib/trunk/glib/gfileutils.c?revision=6076view=markup
  
  char *g_format_file_size_for_display (goffset size);
  
  Ideally this one needs to take another parameter indicating whether you
  want 1kb = 1000 bytes or 1kb = 1024 bytes. 
 
 We should also decide then whether the displayed size should use MB or
 MiB, see http://en.wikipedia.org/wiki/Mebibyte and
 http://www.iec.ch/zone/si/si_bytes.htm

I am all for SI units, even it writing MiB could cause some users to
believe, we are too stupid to spell.

Seemingly random switching between 1000 and 1024 whouldn't really help -
I guess: Imagine some user wants to copy a 64 MiB file from some 1024 to
some 1000 scale media: WTF doesn't this 64 MB file (64 * 2^10 bytes) fit
on this 64 MB stick (64 * 10^6 bytes)?

Ciao,
Mathias
-- 
Mathias Hasselmann [EMAIL PROTECTED]
http://taschenorakel.de/


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: GTK+ Website Review - Hosting Windows Binaries

2008-01-10 Thread Mohammed Sameer
On Wed, Jan 09, 2008 at 09:44:01AM +, Martyn Russell wrote:
 Murray Cumming wrote:
  HTML is slightly more likely to be kept-up-to-date than DocBook.
  However, no FAQ is likely to be kept up to date unless it's very easy to
  edit/comment.
 
 Well, given the new site has proper CSS and HTML separation, editing the
 FAQ will be no harder to edit than the docbook SGML.

Why not a CMS then ? No flame please. Just wondering...


-- 
GPG-Key: 0xA3FD0DF7 - 9F73 032E EAC9 F7AD 951F  280E CB66 8E29 A3FD 0DF7
Debian User and Developer.
Homepage: www.foolab.org


signature.asc
Description: Digital signature
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Extended Layout Summary

2008-01-10 Thread Sven Herzberg
Am Freitag, den 21.12.2007, 11:05 +0100 schrieb Mathias Hasselmann:
 Am Donnerstag, den 20.12.2007, 11:46 -0500 schrieb Havoc Pennington:
  Third, since implementing an interface requires extra boilerplate 
  GObject stuff, it would be convenient for authors of a custom widget if 
  GtkWidget already did the boilerplate for them. Since for newly-written 
  custom widgets, the recommendation would be to always support extended 
  layout.
 
 I don't see the boilerplate savings you talk about? As far as I
 understand GObject interfaces, you always need this this single-line
 boilerplate for overriding interface methods:
 
   G_DEFINE_TYPE_WITH_CODE (MamanBar, maman, GTK_TYPE_WIDGET,
   G_IMPLEMENT_INTERFACE (GTK_TYPE_IFACE, maman_bar_iface_init))

Not if GtkWidget already implements GtkExtendedLayout-get_min_size()
like this: GTK_WIDGET_GET_CLASS(instance)-get_min_size. Then you could
easily override the implementation in class_init(). I think this was
what Havoc meant.

Regards,
  Sven

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


Re: Can I use gtk_widget_unref() to releasetthe object created by gtk_invisible_new()?

2008-01-10 Thread Markku Vire

Hi,

The caller doesn't own the returned reference in case of any gtk_*_new
functions, but the results are floating references (they are removed
once somebody calls gtk_object_sink). This is different from normal
GObjects. So, unreffing the returned value causes practically a double
free.

gtk_widget_destroy in turn runs dispose, ie. asks widget to drop
references to other widgets. Dropping external references usually causes
somebody else to drop the last reference to your widget, so it
efectively gets destroyed. In case of toplevels some global window list
is holding the reference.

Calling gtk_widget_destroy without taking ownership a a widget is
usually a bug that causes a memory leak, but this is not the case here,
since we are talking about a toplevel.

Cheers,

-Markku- 

On Wed, 2008-01-09 at 17:39 +0800, Brian Lu wrote:
 Hi, experts,
 
 I found following codes will crash in gnome 2.21 environment:
 
   ...
   GtkWidget *foo = gtk_invisible_new();
   gtk_widget_unref(foo);
   ...
 
 But it works well if gtk_widget_unref() is replaced with 
 gtk_widget_destroy().
 
 Does that mean that we can't use gtk_widget_unref() on such object and 
 we can only
 use gtk_widget_destroy() to release it?
 
 Thanks
 
 Brian
 ___
 gtk-devel-list mailing list
 gtk-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-devel-list

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