Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
kda (or X) api porting from win32
#1

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:/

Reply
#2

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?

Reply
#3

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

Reply
#4

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

Reply
#5

How about XLib Programming Manual?

 

Specifical about the headers maybe?

 

And this is a monster amount of X related utilities.

Reply
#6

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

Reply


[-]
Quick Reply
Message
Type your reply to this message here.

Human Verification
Please tick the checkbox that you see below. This process is used to prevent automated spam bots.

Forum Jump:


Users browsing this thread: 1 Guest(s)