Page 1 of 1
gdk_get_display error
Posted: Wed Apr 09, 2008 9:22 pm
by Stefan Schnell
Hello community,
I do my first steps in programming with Linux. Now I have a question about the following error:
The program is very small and works on Windows well:
Code: Select all
; Begin-----------------------------------------------------------------
EnableExplicit
; Procedure Main------------------------------------------------------
Procedure Main()
Protected desks.b
Protected i.l
desks = ExamineDesktops()
Debug desks
If desks
For i = 0 To desks - 1
Debug Str(DesktopWidth(i)) + " X " + Str(DesktopHeight(i))
Next i
EndIf
EndProcedure
; Main----------------------------------------------------------------
CallDebugger
Main()
; End-------------------------------------------------------------------
End
How can I solve this problem? I use OpenSUSE Linux 10.3.
Thanks for tips.
Cheers
Stefan
Posted: Wed Apr 09, 2008 10:44 pm
by bembulak
You have installed all the needed dependencies correctly?
Suse, hm?
KDE running? Have you installed GTK2.0 and GTK2.0-devel packages, as well as SDL1.2 and SDL1.2-devel packages with all their dependencies?
Basically this should work. I'll test on my machine, as soon, as I did a reboot. We'll know more then...
Posted: Wed Apr 09, 2008 11:07 pm
by bembulak
Strange.
If I run the following:
Code: Select all
MessageRequester("Desktop Information", "You have"+Str(ExamineDesktops())+" Desktops.")
it works like a charm.
This also works:
Code: Select all
ExamineDesktops()
MessageRequester("Display Information", "Name of main desk = "+DesktopName(0))
As soon, as I do a little more, I get the same error.
Examples
Code: Select all
de = ExamineDesktops()
Debug de
; Linker error
Or this:
I don't understand. I'm running Version 4.1 "stable" atm.
Don't know, seems like an issue for the "BUG"-Section.
Posted: Thu Apr 10, 2008 11:21 am
by #NULL
i got that error once, too.
i remember something like it works if you open a window before. but it's some time ago, i'm not shure. that could also makes sense cause it works with the requester.
Posted: Thu Apr 10, 2008 5:51 pm
by Stefan Schnell
Hello bembulak and #NULL,
thanks for your answers and tests, I get the same results with the standard examples. The tip from #NULL solve the problem, if I change the code to:
Code: Select all
; Begin-----------------------------------------------------------------
EnableExplicit
; Procedure Main------------------------------------------------------
Procedure Main()
Protected desks.b
Protected i.l
desks = ExamineDesktops()
Debug desks
If desks
For i = 0 To desks - 1
Debug Str(DesktopWidth(i)) + " X " + Str(DesktopHeight(i))
Next i
EndIf
EndProcedure
; Main----------------------------------------------------------------
CallDebugger
If OpenWindow(0, 0, 0, 320, 240, "Test", #PB_Window_Invisible)
Main()
EndIf
; End-------------------------------------------------------------------
End
it works well. I think as workaround it is okay. I mean it is worth for a message in the bug section, as bembulak write.
Cheers
Stefan
Posted: Thu Apr 10, 2008 5:57 pm
by bembulak
OK, opening a window before helps. Good to know. This should be in the HELP!
That you'll need a window before, makes sense because:
it could be, one is running a different windowmanager (KDE, ion, blackbox, openbox [like i do], xfwm,...). How should GTK know about your resolution and windowmanager-settings? It simply can't. So it has to wait for a window with GTK-widgets (the main-frame client area) to get advise from the window manager to appear
- on which desktop
- with which resolution
- with which depth.
Makes sense. Not really a bug, but worth a note to the developers for improving the help.
Posted: Fri Apr 11, 2008 8:07 am
by walker
Well.. thats only partly true.... you do not need a Window... but you have to call gtk_init_(0,0) and it will work as expected (if opening a Window the gtk_init_() call is done by PB automatically ... but not by other commands as ExamineDesktops() which need the gtk-libs too)
Posted: Mon Apr 14, 2008 8:28 pm
by Stefan Schnell
Hello walker,
thanks for your tip, it is great. I use now gtk_init_check_(0, 0), as the alternative to gtk_init_(0, 0).
Cheers
Stefan