RE: Question regarding the dependency of GDK on other libraries

2008-08-20 Thread Kumar Siddharth

The first one can be considered as core dependencies for GTK/GDK. Second
list is more like add-ons like compositing manager etc for Alpha/blending.

Regards
Siddharth

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Ruchi Lohani
Sent: Wednesday, August 20, 2008 4:46 AM
To: gtk-app-devel-list@gnome.org
Subject: Question regarding the dependency of GDK on other libraries


Hi,

My application uses GTK and GDK (Layer isolating GTK from the details of the
windowing system).

I am using Ubuntu 8.04. When I run pkg-config --libs gdk-x11-2.0 on it I
get the following result :

-lgdk-x11-2.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo
-lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0

whereas when i run the same command on another ubuntu machine I get some
extra dependencies on libXcomposite, libXdamage etc.

Can somebody please explain me this discrepancy. Does my application need to
link to these libraries?

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


The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments contained in it.

Contact your Administrator for further information.

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


Why the Timer doesn't work? (about g_timeout_add())

2008-08-20 Thread Lazy Fox
I copy my source files CurveWindow.h and testCurveWindow.cpp below.
And attach them in this mail. You can compile them by:
$ g++ testCurveWindow.cpp -o testCurveWindow `pkg-config --cflags
--libs gtk+-2.0`

In this application, I create an 1 second timer to draw a moving line.
But in the function timer_1_test(), the timer is run only once, and
then stopped.
See the comment in this function.

The following is my two source files:

/***
 *  Filename : CurveWindow.h
 *   Begin : 2008-08-14 08:46:43
 * Project : CurveWindow
 *  Author : Wu Yin
 ***/
#include iostream
#include gtk/gtk.h
 using namespace std;

 class CurveWindow
 {
 public:
 CurveWindow(){};
 GtkWidget *create_drawing_win();
 GtkWidget *get_root_widget();
 int draw();
 GdkPixmap *pixmap;

 private:
 GtkWidget *drawing;
 };
//


/* Create a new backing pixmap of the appropriate size */
static gboolean configure_event( GtkWidget *widget, GdkEvent *event,
gpointer data)
{
CurveWindow *self = (CurveWindow *)data;
GdkColor color;
GdkGC *gc = gdk_gc_new(widget-window);

self-pixmap = gdk_pixmap_new(widget-window,
widget-allocation.width,
widget-allocation.height,
-1);
// Draw the background
gdk_draw_rectangle (self-pixmap,
widget-style-white_gc,
TRUE,
0, 0,
widget-allocation.width,
widget-allocation.height);
return TRUE;
}

/***
 * add by Wu Yin, 2008-08-14 08:55:09
 ***/
static gboolean redraw(GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
printf(expose-event \n);
CurveWindow *self = (CurveWindow *)data;
gdk_draw_drawable (widget-window,
widget-style-fg_gc[GTK_WIDGET_STATE (widget)],
self-pixmap,
event-area.x, event-area.y,
event-area.x, event-area.y,
event-area.width, event-area.height);
return TRUE;
}

/***
 * add by Wu Yin, 2008-08-19
 ***/
int CurveWindow::draw()
{
GtkWidget *widget = this-get_root_widget();
static int y = 0;

y += 10;
gdk_draw_line(pixmap,
widget-style-fg_gc[GTK_WIDGET_STATE(widget)],
0, 0, 120, y);
gtk_widget_draw(widget, NULL);
return 0;
}

/***
 * add by Wu Yin, 2008-08-14 08:55:09
 ***/
GtkWidget *CurveWindow::get_root_widget()
{
return drawing;
}

/***
 * add by Wu Yin, 2008-08-14 08:55:09
 ***/
GtkWidget *CurveWindow::create_drawing_win()
{
drawing = gtk_drawing_area_new();
g_signal_connect(G_OBJECT(drawing), expose-event,
G_CALLBACK(redraw), this);
g_signal_connect (G_OBJECT (drawing),configure_event,
G_CALLBACK (configure_event), this);
return drawing;
}


/***
 *  Filename : testCurveWindow.cpp
 *   Begin : 2008-08-14 08:46:43
 * Project : CurveWindow
 *  Author : Wu Yin
 ***/
#include gtk/gtk.h
#include iostream
#include CurveWindow.h
using  namespace std;

/***
 * add by Wu Yin, 2008-08-14 08:55:09
 ***/
static void timer_1_test(gpointer data)
{
CurveWindow *cw = (CurveWindow *)data;
cw-draw();

/* !!! Look Here !!!
 * Uncomment each statement of the following, the timer will run
correctly, WHY?
 */
//  printf(timer_1_test() \n);
//  gtk_widget_draw(cw-get_root_widget(), NULL);
}

/***
 * add by Wu Yin, 2008-08-14 08:55:09
 

Re: Why the Timer doesn't work? (about g_timeout_add())

2008-08-20 Thread Tor Lillqvist
Look at this:

 static void timer_1_test(gpointer data)

g_timeout_add(1000, (GSourceFunc)timer_1_test, cw);

Then look at the documentation for GSourceFunc:
http://library.gnome.org/devel/glib/stable/glib-The-Main-Event-Loop.html#GSourceFunc
. Notice anything?

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


Hitting return in Gtk::Entry control doesn't do default action in dialog with Gtk::Notebook

2008-08-20 Thread Garth's KidStuff
Hi All,

I have a dialogs with a Gtk::Entry control in a Gtk::Notebook and -- unlike
other Gtk::Entry controls in dialogs without notebooks -- if I set:

m_IDOK.set_flags(Gtk::CAN_DEFAULT);
m_IDOK.grab_default();
...
m_ENTRY.set_activates_default(true); // Enter while editing should
activate default OK

Hitting Entry still doesn't activate the OK button.

Thanks in Advance.

-Garth


-- 
Garth Upshaw
Garth's KidStuff
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Question regarding the dependency of GDK on other libraries

2008-08-20 Thread Ruchi Lohani
Can anybody explain me the significance of Requires and Requires.private
field in the pkg-config .pc file ?
For the gdk-x11-2.0 package, one Ubuntu system has some of the X libs like
Xcomposite, Xdamage etc in Requires field whereas another one has all of
them in Requires.private field.

This affect the applications using gdk as the application fails to load
these X libraries during run time. I am not very clear about the pkg-config
fields. Should there be a unique .pc file for a package like gdk and if so
then what all should be its dependencies?

Thanks
Ruchi



On Wed, Aug 20, 2008 at 12:40 AM, Kumar Siddharth 
[EMAIL PROTECTED] wrote:


 The first one can be considered as core dependencies for GTK/GDK. Second
 list is more like add-ons like compositing manager etc for Alpha/blending.

 Regards
 Siddharth

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Ruchi Lohani
 Sent: Wednesday, August 20, 2008 4:46 AM
 To: gtk-app-devel-list@gnome.org
 Subject: Question regarding the dependency of GDK on other libraries


 Hi,

 My application uses GTK and GDK (Layer isolating GTK from the details of
 the
 windowing system).

 I am using Ubuntu 8.04. When I run pkg-config --libs gdk-x11-2.0 on it I
 get the following result :

 -lgdk-x11-2.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo
 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0

 whereas when i run the same command on another ubuntu machine I get some
 extra dependencies on libXcomposite, libXdamage etc.

 Can somebody please explain me this discrepancy. Does my application need
 to
 link to these libraries?

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


 The information contained in this electronic message and any attachments to
 this message are intended for the exclusive use of the addressee(s) and may
 contain proprietary, confidential or privileged information. If you are not
 the intended recipient, you should not disseminate, distribute or copy this
 e-mail. Please notify the sender immediately and destroy all copies of this
 message and any attachments contained in it.

 Contact your Administrator for further information.


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


(1) How to implement Image Buttons without gaps? (2) Can GtkImage stretch an image automatically?

2008-08-20 Thread Daniel Yek

Hi,

(1) I have been looking for a way to use GtkButton to create an Image 
Button that is exactly of the same size as the GtkImage that it 
contains, so that two Image Buttons next to each others would leave no 
gap in between.


I have some ideas in mind, but I wonder if I'm going to over-engineering 
them and if there is a well-known approach to solve this, supposedly, 
common problem.


For this first issue, this is the main idea that I am considering to 
investigate:
(1a) Subclassing GtkButton and force it to allocate the size of the 
GtkImage it contains and overwrite all its drawing functionalities that 
cause non-image area to appear around GtkImage. If focus or default 
lines are to be drawn, draw them on the inside edge of GtkImage or 
suppress them entirely if necessary.


I haven't looked into GtkButton source code lately, but I think this 
approach can potentially boil down to reimplementing the entire button 
from scratch to derive from GtkWidget, if GtkButton turns out to not 
allow a subclass to override certain drawing function. Reimplementing a 
new button widget can cause deviation in functionalities in future GTK+ 
releases and I want to avoid if there is a better solution available.


I am hoping someone would point out to me an easier way to accomplish this.

If GtkButton simply is not able to function as Image Buttons without 
gap, I wonder if GTK+ developers considered the usage during the process 
of GtkButton implementation/development? I wonder if the usage model was 
intentionally excluded (for reasons that I am obviously not sure of -- 
maybe for memory efficiency reasons; or for theming reasons)? Or is it 
simply the case that it wasn't implemented yet? Or is this usage model 
really unusual?



(2) I implemented image tiling using lower-level APIs before. However, I 
thought it was odd that tiling or stretching functionalities are missing 
from GtkImage. Is there a widget that can tile/stretch, for display, an 
image to cover its allocated size automatically?


If not, are there popular approaches used to implement this 
functionality, other than using low-level drawing APIs?


Insights are very much appreciated. Thanks.

--
Daniel.

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


Markup in GtkTreeViewColumns

2008-08-20 Thread John Coppens
Hello people.

It may be evident, but I can't seem to find how. I need to put markup in
the column title of GtkTreeViewColumns, as the column titles are
parameters with sub-indexes. (S11 etc).

Is this possible?

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


Re: Markup in GtkTreeViewColumns

2008-08-20 Thread Paul Pogonyshev
John Coppens wrote:
 It may be evident, but I can't seem to find how. I need to put markup in
 the column title of GtkTreeViewColumns, as the column titles are
 parameters with sub-indexes. (S11 etc).

Use gtk_tree_view_column_set_widget() on the column.  You can
then use any widget as a title, including a label with markup.

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


Re: Markup in GtkTreeViewColumns

2008-08-20 Thread John Coppens
On Wed, 20 Aug 2008 22:47:02 +0300
Paul Pogonyshev [EMAIL PROTECTED] wrote:

 John Coppens wrote:
  It may be evident, but I can't seem to find how. I need to put markup
  in the column title of GtkTreeViewColumns, as the column titles are
  parameters with sub-indexes. (S11 etc).
 
 Use gtk_tree_view_column_set_widget() on the column.  You can
 then use any widget as a title, including a label with markup.
 
 Paul

I _knew_ it had to be simple ;-)Thanks  lot, Paul!

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


Re: Why the Timer doesn't work? (about g_timeout_add())

2008-08-20 Thread Lazy Fox
At last, I found it.
Thanks.


On 8/20/08, Tor Lillqvist [EMAIL PROTECTED] wrote:

 Look at this:

  static void timer_1_test(gpointer data)

 g_timeout_add(1000, (GSourceFunc)timer_1_test, cw);

 Then look at the documentation for GSourceFunc:

 http://library.gnome.org/devel/glib/stable/glib-The-Main-Event-Loop.html#GSourceFunc
 . Notice anything?

 --tml




-- 
--
┏┓
┃菩提本无树,明镜亦非台。本来无一物,何处惹尘埃。┃
┗┛
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list