Jump to content

kda (or X) api porting from win32

Recommended Posts

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?


  • Like 1
Link to post
Share on other sites

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?

Link to post
Share on other sites

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.



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));

Link to post
Share on other sites
  • 1 year later...

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)


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)
   return i;

extern "C" int setOnDesktop(int w, int d)
   return w;

extern "C" int setOnAllDesktops(int w, int d)
   return w;

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

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

These links were helpful:




Link to post
Share on other sites
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...