Linux-Noob Forums
kda (or X) api porting from win32 - Printable Version

+- Linux-Noob Forums (https://www.linux-noob.com/forums)
+-- Forum: Linux Noob (https://www.linux-noob.com/forums/forum-3.html)
+--- Forum: Xorg Problems (https://www.linux-noob.com/forums/forum-56.html)
+--- Thread: kda (or X) api porting from win32 (/thread-2160.html)



kda (or X) api porting from win32 - dspln - 2006-02-12


I am moving a non-C app (smalltalk) from windows to linux.

Windows has win32 api functions for a lot of things - in particular, window management.

For example, if I have a window's handle, I can SetWindowPos, FlashWindow, GetWindowText, etc.

To get all window handles: EnumWindows

 

Currently I am trying to figure out how to move windows (programatically) to a specific desktop, and to determine the available desktop size (window size when maximized: the screen size - kicker panels).

 

In smalltalk, accessing the win32 api's is done by loading a dll ('user32.dll' 'kernel32.dll' 'winmm.dll' 'gdi32.dll' 'psapi.dll' 'advapi32.dll' 'ole32.dll'), then calling the exported function.

 

Smalltalk provides similar for linux - the 'oracle connect' use 'libclntsh.so'.

 

What is the general way to do these types of things in KDE/X

Any web sites you can recommend? developer.kde.org didn't really help, but then again, I don't really know what to look for :(

I think maybe libkdeui.so may have what I am looking for, but I didn't see any libkdeui.h - wth?

o_O:/




kda (or X) api porting from win32 - znx - 2006-02-12


I'm not a smalltalk programmer.. but..

 

STIX - Native GNU SmallTalk bindings to X Link to TOC

 

I also see talk of "Xm++" for use with Motif/Athena apps but cannot find any valid link to source.

 

Finally Squeak turns up everywhere.. so I'm guessing it might be good?

 

Any of these useful?




kda (or X) api porting from win32 - dspln - 2006-02-12


Interesting, but not what I needed.

I guess I figure that .so (shared object?) are the unix equivalent of windows' .dll (dynamic link library).

 

most (or all) windows .dll files have an corresponding .h (header) file detailing what is exported (functions that can be called), and how to use them (what it returns, what the arguments are).

 

Where is that info for unix .so files? slocate doesn't turn up .h files for libc.so - and yet my running smalltalk (Visualworks 7.4) uses one of ('libc.so' 'libc.sl' 'libc.a(shr.o)') - so it does work.

For example:

void openlog(char * ident, int option, int facility)

I can call this and add to the system log using it and a few other functions.

 

Sooo,

I am looking for a list of useful system/gui functions and what .so they can be found in.

A website would be great - I used microsoft.com/win32api... all the time when writing the win32 api calls.

 

the info for openlog:

misc/sys/syslog.h:extern void openlog (__const char *__ident, int __option, int __facility);

 

for chdir:

posix/unistd.h:extern int chdir (__const char *__path) __THROW __nonnull ((1));




kda (or X) api porting from win32 - dspln - 2006-02-13


Well, I got a little further:

/usr/lib/X11/include has a pile of .h files, which I guess get built into libX11.so - maybe, but there is no libX11.h.

/usr/kde/3.4/lib has kde .so files, and /usr/kde/3.4/include has the .h files




kda (or X) api porting from win32 - znx - 2006-02-14


How about XLib Programming Manual?

 

Specifical about the headers maybe?

 

And this is a monster amount of X related utilities.




kda (or X) api porting from win32 - dspln - 2007-04-08


I think the functions I need are in libkdeui.so, but they are C++ mangled, so a helper.so that does extern "C" is needed.

This works, there is some voodoo I don't understand (QApplication a(n,c) must initialize a global, because I get a seg fault without it)

 



Code:
/*
this is vwkde.c
make sure the next line's vars are set correctly, then execute to create vwkde.so
KDEDIR=/usr/kde/3.5; QTDIR=/usr/qt/3
g++ -c -I$KDEDIR/include -I$QTDIR/include  -Wall -fPIC vwkde.c && gcc -shared -Wl,-soname,vwkde.so -o vwkde.so vwkde.o
*/

#include <kwin.h>
#include <qapplication.h>
char **c;
int n =0;
QApplication a( n, c);

extern "C" int setCurrentDesktop(int i)
{
   KWin::setCurrentDesktop(i);
   return i;
}

extern "C" int setOnDesktop(int w, int d)
{
   KWin::setOnDesktop(w,d);
   return w;
}

extern "C" int setOnAllDesktops(int w, int d)
{
   KWin::setOnAllDesktops(w,d);
   return w;
}

extern "C" int numberOfDesktops()
{
   return KWin::numberOfDesktops();
}

extern "C" int currentDesktop()
{
   return KWin::currentDesktop();
}




These links were helpful:

[/url]http://api.kde.org/cvs-api/kdelibs-apidocs...ssKWin.html#e24

http://www.yolinux.com/TUTORIALS/LibraryAr...AndDynamic.html

[url=http://developer.kde.org/documentation/tutorials/index.html]http://developer.kde.org/documentation/tutorials/index.html