Re: Building and packaging for Windows

2007-10-31 Thread Pavel A. da Mek
 Can someone share ideas about how to compile a GTK application for
 Windows and package it so it includes GTK and its dependencies?

To develop GTK applications under Windows I am using
Dev-C++ which includes Mingw compiler
http://sourceforge.net/projects/dev-cpp/

GTK is usually already installed with GIMP;
if not, the packages are on
http://gimp-win.sourceforge.net/old.html
GTK+ 2 Runtime Environment (version 2.6.10-20050823, for Windows 98/ME and 
NT4)
GTK+ 2 Runtime Environment (version 2.10.13, for Windows 2000 and newer)

  P.A. 

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


Re: Building and packaging for Windows

2007-10-31 Thread Tor Lillqvist
 GTK is usually already installed with GIMP;

Presumably not everyone is interested in installing GIMP just to get a
copy of GTK+.

 if not, the packages are on
 http://gimp-win.sourceforge.net/old.html

That old should tell you that the versions there are already
obsolete, and will become increasingly so. Nowadays the GIMP installer
bundles the GTK+ runtime and dependencies, so it is not possible to
find an installer for just a fresh GTK+ from the gimp-win site. (And
even the GIMP 2.4.0 installer bundles GTK+ 2.10.14 and not the latest
2.12.1.) From a bundled GIMP + GTK+ + dependencies installation it can
also be hard to understand what files belong to which part, and which
are really needed for plain GTK+ apps. (For instance, the pangoft2 DLL
and the freetype and fontconfig DLLs and configuration files are quite
unneeded for plain GTK+ apps.)

The main, some may even say official, distribution for prebuilt
binaries of each version of GTK+ and dependencies is on ftp.gnome.org.
(In the form of zip archives, from which it should be a small matter
of scripting to construct installers if one likes.)

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


Print bug on Windows ?

2007-10-31 Thread Miroslav Rajcic
I wrote a simple printing test that shows a probable GTK+ bug when run on 
Windows OS.
Test draws one red rectangle over the page area.

When run on Linux, page preview looks good.
When run on Windows, rectangle does not fill entire area of the page (not 
counting margins)!
I've checked if the problem could be due to larger margins, but that is not 
it. It seems to be a bug.
Can anyone confirm this.

Screenshot of the correct Linux behaviour is at: 
http://notecase.sourceforge.net/temp/printtest_ok.jpg
Screenshot of incorrect Windows behaviour is at: 
http://notecase.sourceforge.net/temp/printtest_not_ok.jpg
(save to disk to properly view the big white area at the bottom of the page)

On Windows, I've tested with VS200 using GTK+ 2.10.11 from 
http://gladewin32.sourceforge.net
Later I've updated this GTK to latest 2.12.1 using Tor's official Windows 
build (http://www.gimp.org/~tml/gimp/win32).

Is this a Win32 port bug ?
Does anyone have the same problems ?

Regards,
  Miroslav

PS. Test code:

#include gtk/gtk.h

GtkWidget *window1;
void create_window();
static void on_test(GtkButton *button, gpointer user_data);
static void begin_print (GtkPrintOperation *operation, GtkPrintContext 
*context, gpointer user_data);
static void draw_page (GtkPrintOperation *operation, GtkPrintContext 
*context,  gint page_nr, gpointer user_data);

int main (int argc, char *argv[])
{
 gtk_init (argc, argv);
 create_window();
 gtk_main ();
 return 0;
}

void create_window()
{
 GtkWidget *button5;

 window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
 gtk_window_set_title (GTK_WINDOW (window1), test);
 gtk_widget_show (window1);
 g_signal_connect (window1, destroy, G_CALLBACK (gtk_main_quit), NULL);

 button5 = gtk_button_new_with_mnemonic(Click);
 gtk_widget_show (button5);
 gtk_container_add (GTK_CONTAINER (window1), button5);

 g_signal_connect(button5, clicked, G_CALLBACK (on_test), NULL);
}

void begin_print (GtkPrintOperation *operation, GtkPrintContext *context, 
gpointer user_data)
{
 //one test page
 gtk_print_operation_set_n_pages (operation, 1);

 GtkPageSetup *page_setup = gtk_print_context_get_page_setup (context);
 gtk_page_setup_set_orientation (page_setup, GTK_PAGE_ORIENTATION_PORTRAIT);
}

void on_test(GtkButton *button, gpointer user_data)
{
 GtkPrintOperation *operation;
 GError *error = NULL;

 operation = gtk_print_operation_new ();
 gtk_print_operation_set_show_progress(operation, TRUE);
 gtk_print_operation_set_unit(operation, GTK_UNIT_POINTS);

 g_signal_connect (G_OBJECT (operation), begin-print, G_CALLBACK 
(begin_print), NULL);
 g_signal_connect (G_OBJECT (operation), draw-page, G_CALLBACK 
(draw_page), NULL);

 gtk_print_operation_run (operation, 
(GtkPrintOperationAction)GTK_PRINT_OPERATION_ACTION_PREVIEW, GTK_WINDOW 
(window1), error);
 g_object_unref (operation);
}

void draw_page (GtkPrintOperation *operation,  GtkPrintContext   *context, 
gint page_nr,
gpointer   user_data)
{
 cairo_t *cr;

 cr = gtk_print_context_get_cairo_context (context);

 // draw a red rectangle, as wide as the paper (inside the margins)
 cairo_set_source_rgb (cr, 1.0, 0, 0);
 cairo_rectangle (cr, 0, 0, gtk_print_context_get_width (context), 
gtk_print_context_get_height (context));
 cairo_fill (cr);
}


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


Re: Building and packaging for Windows

2007-10-31 Thread Pavel A. da Mek
 GTK is usually already installed with GIMP;

 Presumably not everyone is interested in installing GIMP just to get a
 copy of GTK+.

Is there a better choice of bitmap graphic editor than GIMP?
(I am just curious, not starting flamewar :-)
Of course, there may be some people who are not at all interested in image 
editing,
but it seems to me that this is a basic tool, alike vector editor (my choice 
is Inscape) and text editor (my choice is Notepad++).

 if not, the packages are on
 http://gimp-win.sourceforge.net/old.html

 That old should tell you that the versions there are already
 obsolete, and will become increasingly so.

The old versions are good enough for my purposes.

I do not use features newer than 2.6.10 because I got the impression that it 
is not possible to run the new versions also on Win98. Or am I wrong?

Also I suppose that it is not possible to write applications which would in 
run-time decide, depending on GTK version, whether they can call new 
functions or not. It is so?

 Nowadays the GIMP installer
 bundles the GTK+ runtime and dependencies, so it is not possible to
 find an installer for just a fresh GTK+ from the gimp-win site.

That is the reason why I use the old versions.

 The main, some may even say official, distribution for prebuilt
 binaries of each version of GTK+ and dependencies is on ftp.gnome.org.
 (In the form of zip archives, from which it should be a small matter
 of scripting to construct installers if one likes.)

I only thougt that for those like me, with less skill and time,
it would be helpful to know that there is also the quick and easy way with 
the old packages.

  P.A. 

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


Re: non-themed widget styles?

2007-10-31 Thread jcupitt
On 10/31/07, Chris Rorvick [EMAIL PROTECTED] wrote:
 I have a GTK application that modifies the foreground and background of
 many different buttons rapidly.  These buttons should not be themed, so
 it seems that the gtk_widget_modify_*() functions incur an unnecessary
 overhead.  Is there a way to remove the theming of a widget?  I've tried

I do this by defining a set of styles in a style file (eg.
error_style is reddish), then have a line binding all widgets named
error_widget to error_style. The colours there are based on the
shades of red in the gnome HIG.

style error_style = default
{
bg[NORMAL] = #C1665A
bg[PRELIGHT] = #E0B6AF
bg[ACTIVE] = #C1665A
bg[SELECTED] = #C1665A
bg[INSENSITIVE] = #884631
}
widget *error_widget* style error_style

In my code I do gtk_widget_set_name( widget, error_widget ); to get
it drawn in the red style, and _set_name(  ); to have it drawn in
the regular style.

Hope I've unserstood you.

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


Re: non-themed widget styles?

2007-10-31 Thread Chris Rorvick
[EMAIL PROTECTED] wrote:
 On 10/31/07, Chris Rorvick [EMAIL PROTECTED] wrote:
 I have a GTK application that modifies the foreground and background of
 many different buttons rapidly.  These buttons should not be themed, so
 it seems that the gtk_widget_modify_*() functions incur an unnecessary
 overhead.  Is there a way to remove the theming of a widget?  I've tried
 
 I do this by defining a set of styles in a style file (eg.
 error_style is reddish), then have a line binding all widgets named
 error_widget to error_style. The colours there are based on the
 shades of red in the gnome HIG.
 
 style error_style = default
 {
 bg[NORMAL] = #C1665A
 bg[PRELIGHT] = #E0B6AF
 bg[ACTIVE] = #C1665A
 bg[SELECTED] = #C1665A
 bg[INSENSITIVE] = #884631
 }
 widget *error_widget* style error_style
 
 In my code I do gtk_widget_set_name( widget, error_widget ); to get
 it drawn in the red style, and _set_name(  ); to have it drawn in
 the regular style.
 
 Hope I've unserstood you.
 
 John

Thank you for the feedback.  I think what you are suggesting is a way to
override the default style for a particular widget.  I don't think this
achieves my primary goal, though, of avoiding the overhead incurred by
the logic in GTK that supports themes.  This overhead includes acquiring
a lock and navigating/manipulating linked lists of styles.  Use of a
profiler has shown this to be a significant burden to my application.

What I'm hoping to do is assign widgets a style that I can manipulate
directly and have GTK honor this.  gtk_widget_set_style() looks
promising for this, but its associated comment states that it interacts
badly with themes.  GTK changes the style a widget points to under the
sheets, and I don't what events cause it to do so.

I'm not a GTK hacker (probably obvious by now) so I may be going about
this very wrong.  I'm hoping someone can point me in the right
direction.

Thanks!

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


Re: non-themed widget styles?

2007-10-31 Thread jcupitt
Hi again,

On 10/31/07, Chris Rorvick [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] wrote:
  On 10/31/07, Chris Rorvick [EMAIL PROTECTED] wrote:
  I have a GTK application that modifies the foreground and background of
  many different buttons rapidly.  These buttons should not be themed, so
  it seems that the gtk_widget_modify_*() functions incur an unnecessary
  overhead.  Is there a way to remove the theming of a widget?  I've tried
 
  I do this by defining a set of styles in a style file (eg.
  error_style is reddish), then have a line binding all widgets named
  In my code I do gtk_widget_set_name( widget, error_widget ); to get
  it drawn in the red style, and _set_name(  ); to have it drawn in
  the regular style.

 Thank you for the feedback.  I think what you are suggesting is a way to
 override the default style for a particular widget.  I don't think this
 achieves my primary goal, though, of avoiding the overhead incurred by
 the logic in GTK that supports themes.  This overhead includes acquiring
 a lock and navigating/manipulating linked lists of styles.  Use of a
 profiler has shown this to be a significant burden to my application.

Yes, I saw you other posts. I'm suggesting a way you can change button
styles quickly. The idea is that you make a set of static styles when
your program starts up, then as it runs, rather than modifying styles,
you just change which style is used to draw each widget.

I guess I don't understand what you're trying to do :-( What's the
problem with the theme engine?

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


Re: non-themed widget styles?

2007-10-31 Thread Chris Rorvick
[EMAIL PROTECTED] wrote:
 I guess I don't understand what you're trying to do :-( What's the
 problem with the theme engine?

Nothing except that the buttons I'm using basically have everything
style-related set programmatically and attributes of their style
(i.e., background and foreground colors) change rapidly.  Therefore
I'm asserting that any runtime support for configuration-based styles
is a waste of CPU.  Profiling has shown that this is contributing to
a significant amount of CPU usage.

Calls to gtk_widget_modify_style() cause a lot of stuff to happen, and
I think much of it is in making themes (or maybe I should just say
configuration-based styles) work nicely.  What I want to do is tell a
widget to be blue with minimal overhead.  A style is still handy in
that I still can benefit from having the widget's appearance change
with its state. But I think most of what gtk_widget_modify_style()
does is moot for how I'm using these particular widgets and so I'd
like to avoid the overhead.

Thanks,

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


Re: non-themed widget styles?

2007-10-31 Thread jcupitt
On 10/31/07, Chris Rorvick [EMAIL PROTECTED] wrote:
 configuration-based styles) work nicely.  What I want to do is tell a
 widget to be blue with minimal overhead.  A style is still handy in

I'm being so dumb here. So why doesn't gtk_widget_set_name() work for
this problem? I still don't understand :(

I'm suggesting that rather than modifying styles as your program runs,
you define a (large) set of static styles when you start up and then
just switch the style a widget renders with. It should be a lot
quicker.

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


Re: Building and packaging for Windows

2007-10-31 Thread Enrico Tröger
On Tue, 30 Oct 2007 19:44:19 -0400, Andrew Smith
[EMAIL PROTECTED] wrote:

 Hello
 
 I am the author of ISO Master ( http://littlesvr.ca/isomaster/ ).
 It's a reasonably simple GTK application. I'd like to make a Windows
 version. If possible, without porting the GUI to Win32. I managed to
 compile ISO Master on Windows using cygwin, but I don't see how I
 could distribute it without a cygwin prerequisite.
 
 Can someone share ideas about how to compile a GTK application for 
 Windows and package it so it includes GTK and its dependencies?
 
 Any tips you would care to share would be very much appreciated.
Besides the other tips already mentioned in this thread, have a look at
http://geany.uvena.de/Support/BuildingOnWin32, there we described how
to build Geany on Windows using Mingw without cygwin. You will also
have a look at the makefiles(makefile.win32) in the Geany source
tarball.


Regards,
Enrico

-- 
Get my GPG key from http://www.uvena.de/pub.key
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: non-themed widget styles?

2007-10-31 Thread Chris Rorvick
[EMAIL PROTECTED] wrote:
 On 10/31/07, Chris Rorvick [EMAIL PROTECTED] wrote:
 configuration-based styles) work nicely.  What I want to do is tell a
 widget to be blue with minimal overhead.  A style is still handy in
 
 I'm being so dumb here. So why doesn't gtk_widget_set_name() work for
 this problem? I still don't understand :(
 
 I'm suggesting that rather than modifying styles as your program runs,
 you define a (large) set of static styles when you start up and then
 just switch the style a widget renders with. It should be a lot
 quicker.
 
 John

Yes!  I am seeing better performance using this method, at least in a
small test application.  Will require some work to make the application
work like this, but this is very promising.  Thanks for your help!

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


Telling a widget not to be in the focus chain

2007-10-31 Thread Steffen Gutmann
Hi!

I would like to tell a widget to not be part of Gtk's focus chain.  I
know there is gtk_container_set_focus_chain, however, I would like to
keep Gtk's default focus chain logic and just would like to have one or
two widgets not being part of it.  The widget could be a GtkButton,
GtkEntry, GtkTreeView or GtkTextView, or any other user interface
element.

I tried to unset the GTK_CAN_FOCUS flag.  This works nicely e.g. for
GtkButton (pressing tab jumps over the button) but when doing this on a
GtkEntry or GtkTextView it means that the widget also doesn't grab the
focus when clicking on it, thus no text input is possible any more.

I tried g_signal_connect(widget, focus, G_CALLBACK(noFocus), NULL)
where the callback is defined as:

static gboolean noFocus(GtkWidget *widget)
{
g_signal_stop_emission_by_name(widget, focus);
return FALSE;
}

This works well for GtkButtons and GtkEntries but has a small glitch
for GtkTextView and GtkTreeView.  There is no focus drawn but still the
focus is 'somehow on the widget'.  Pressing the tab key again then
moves on to the next widget.  Not perfect.

So, anybody has an idea what the correct way of leaving a widget out of
the focus chain is?



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


How can I access to main loop in GTK+ apps?

2007-10-31 Thread Tomasz Jankowski
Hello!

I'm searching through API references for GLib and GTK+, for functions which
let me to attach new GSource to programs's main loop. I have no idea how to
get a pointer to main loop run with gtk_main_init. Can someone help me with
it?

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


Re: Telling a widget not to be in the focus chain

2007-10-31 Thread jcupitt
On 10/31/07, Steffen Gutmann [EMAIL PROTECTED] wrote:
 So, anybody has an idea what the correct way of leaving a widget out of
 the focus chain is?

I use gtk_container_set_focus_chain() to set an exact list of widgets
for a section of the focus chain.

  GList *focus_chain;

  focus_chain = NULL;
  focus_chain = g_list_append( focus_chain, iv-ip );
  focus_chain = g_list_append( focus_chain, iv-cv );
  focus_chain = g_list_append( focus_chain, iv-pbv );
  gtk_container_set_focus_chain( GTK_CONTAINER( vbox ), focus_chain );

John

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


Re: Building and packaging for Windows - theme?

2007-10-31 Thread Andrew Smith
Andrew Smith a écrit :
 Hello
 
 I am the author of ISO Master ( http://littlesvr.ca/isomaster/ ). It's a 
 reasonably simple GTK application. I'd like to make a Windows version. 
 If possible, without porting the GUI to Win32. I managed to compile ISO 
 Master on Windows using cygwin, but I don't see how I could distribute 
 it without a cygwin prerequisite.
 
 Can someone share ideas about how to compile a GTK application for 
 Windows and package it so it includes GTK and its dependencies?
 
 Any tips you would care to share would be very much appreciated.
 
 Thanks in advance,
 
 Andrew
 

Thanks everybody. I managed to build ISO Master on mingw and run it on a 
stock Windows box (just copied some dlls from the mingw bin directory), 
looks like the GTK parts work fine. Still, I'll be sure to look at all 
the examples that you pointed out.

With Vista even windows application don't look native any more :) but 
all the same, is there any way to give the GTK I ship with my program a 
special theme? So at least the gray background matches other 
applications? I guess the theme is inside one of the dlls (cause the 
stock buttons do show up), but I'm willing to recompile it if that's 
what it takes.

Cheers,

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