GDKATOM error in GTK program

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
wallyg
Posts: 88
Joined: May 08, 2009 7:08
Location: Tucson Arizona

GDKATOM error in GTK program

Postby wallyg » Nov 18, 2012 21:17

I am using FB 0.23 and 0.24. I cleared out and reloaded 0.24 and error still happens. I reduced large program to a small one the has the same error.

Code: Select all

#Include "gtk/GTK-2.24.bi"
    Dim cb As gtkclipboard Ptr
    cb = gtk_clipboard_get(GDK_NONE)


I get the following response from FBEDIT running 0.23 and fresh 0.24 I have tried numerous different symbols instead of GDK_NONE all with the same result.

I am using gtk 2.24 - long project and I am not ready to do work needed to upgrade to 3.x until next Spring.

Build error(s)
C:\Program Files (x86)\FreeBASIC\fbc -g -R -s gui "(Untitled).bas"
(Untitled).bas(3) error 40: Variable not declared, GdkAtom in 'cb = gtk_clipboard_get(GDK_NONE)'
(Untitled).bas(3) warning 1(1): Passing scalar as pointer, at parameter 1 of GTK_CLIPBOARD_GET()

Build error(s)


I tried this on three different machines that I have at home and work all running windows 7 and same error occurs. The clipboard code was just entered this morning and this was first time I compiled it ever. Everything is fine and compiles and runs correctly without this code.

I have looked at the gtk...bi and gdk...bi files and find a definition of GDKATOM in terms of _GDKATOM but cannot find a definition of _GDKATOM in any file? I have the lastest GTK stuff from a download of new complete FB 0.24 system today from Sourceforge.

Is there a newer GTK 2.24 system I should be using? Any suggestions on how to fix this problem would be appreciated. I hope I have given you all the information you need and reduced the problem to as simple as possible.

Thanks, Wally
D.J.Peters
Posts: 7711
Joined: May 28, 2005 3:28

Re: GDKATOM error in GTK program

Postby D.J.Peters » Nov 18, 2012 22:18

two params
DECLARE FUNCTION gtk_widget_get_clipboard(BYVAL AS GtkWidget PTR, BYVAL AS GdkAtom) AS GtkClipboard PTR
wallyg
Posts: 88
Joined: May 08, 2009 7:08
Location: Tucson Arizona

Re: GDKATOM error in GTK program

Postby wallyg » Nov 19, 2012 2:06

Thanks for the suggestion. However I am sorry but there is only one parameter in function "gtk_clipboard_get"

Quoting from GTK 2.24 documentation it says
GtkClipboard * gtk_clipboard_get (GdkAtom selection);

Returns the clipboard object for the given selection. See gtk_clipboard_get_for_display() for complete details.

selection :
a GdkAtom which identifies the clipboard to use
Returns :
the appropriate clipboard object. If no clipboard already exists, a new one will be created. Once a clipboard object has been created, it is persistent and, since it is owned by GTK+, must not be freed or unreffed. [transfer none]


In the routine this comes from, there is no current widget, I am just trying to get the clipboard to a local string for processing.

I however tried your routine suggestion by using the main form window (rt_pObjects(0)->FORM_gpWindow is stored as a GtkWidget Ptr) that is always displayed

Code: Select all

cb = gtk_widget_get_clipboard(rt_pObjects(0)->FORM_gpWindow, GDK_NONE)


And I get the same GDKATOM error message.

Thanks for the suggestion but it does not work in this case.
TJF
Posts: 3473
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: GDKATOM error in GTK program

Postby TJF » Nov 19, 2012 10:00

wallyg wrote:... Any suggestions on how to fix this problem would be appreciated. I hope I have given you all the information you need and reduced the problem to as simple as possible.

Thanks, Wally

You found a bug in the gdk-header! Thanks for your good report containing all needed information and sorry for your trouble.

wallyg wrote:Is there a newer GTK 2.24 system I should be using?

Your code starts with
    #Include "gtk/GTK-2.24.bi"
so I assume you're using the updated headers from the fbc-0.24 package. Smallish improvements are done in
but your bug isn't fixed in neither of them.

To get your program working edit your file (fbc-0.24.0)
    gdk/gdk-2.24.bi
and add some CAST translations by replacing lines 95 to 105 by this code

Code: Select all

#DEFINE GDK_ATOM_TO_POINTER(atom) (atom)
#DEFINE GDK_POINTER_TO_ATOM(ptr) CAST(GdkAtom, ptr)

#IFDEF GDK_NATIVE_WINDOW_POINTER
#DEFINE GDK_GPOINTER_TO_NATIVE_WINDOW(p) CAST(GdkNativeWindow, p)
#ELSE ' GDK_NATIVE_WINDOW_POINTER
#DEFINE GDK_GPOINTER_TO_NATIVE_WINDOW(p) GPOINTER_TO_UINT(p)
#ENDIF ' GDK_NATIVE_WINDOW_POINTER

#DEFINE _GDK_MAKE_ATOM(val) CAST(GdkAtom, GUINT_TO_POINTER(val))
#DEFINE GDK_NONE _GDK_MAKE_ATOM (0)

This bug is only in gdk-2.24.bi ( gdk-3.4.bi is OK!).

BTW:
wallyg wrote:... and I am not ready to do work needed to upgrade to 3.x until next Spring.

I found a windows installer for GTK-3.4 on the net (untested):
wallyg
Posts: 88
Joined: May 08, 2009 7:08
Location: Tucson Arizona

Re: GDKATOM error in GTK program

Postby wallyg » Nov 19, 2012 15:12

Thank you, I will try this out tonight after work and let you know how it goes. Please keep me informed of progress with 3.4... If I have some time later in December I might give 3.4 a try if you think there are good conversions for windows.

Return to “Libraries”

Who is online

Users browsing this forum: Josep Roca and 1 guest