[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Work on KDE/QT native port to MS Windows started.
From:       Holger Schroeder <holger-kde () holgis ! net>
Date:       2002-12-24 2:26:17
[Download RAW message or body]

Hi all,

the short form of this is: i started porting QT for X11 to Windows. I can
already open a window on the screen and draw to it, but i will need a long
time or some help to get the message passing stuff of windows integrated.

discussion of this will be on kde-cygwin@mail.kde.org.

And now the long one: 

QT on Windows native readme by holger...

The Big Picture

I think it is time to have KDE on windows now. i was using only linux for
about a year now, and then i got an ibm thinkpad with windows xp preinstalled,
and i had to work with it for university. when working on windows, i really
missed a lot of the usability and consistency i was used to in kde.
internet explorer can only log into ftp sites as anonymous, mozilla can only
download files from ftp sites, i didn't find any sftp client, network
neighborhood did not work at all, to transfer files to/from other people
involved installing ftp clients and servers for all these people. i was told
that windows xp was the most stable windows ever, half an hour later i made it
reboot, but not by hitting start->reboot, but by unpacking an archive file from
the cygwin installation. i crash this notebook several times a day...

so i thought about having kde on windows. i wanted a usable set of programs on
windows on the one hand, and on the other hand i think it would be easier to
convince people that linux/kde is better than windows, when they could test the
"linux gui"/kde on windows for some weeks and then decide, if they still need
the windows os under the kde gui.

so i started looking into "porting" kde to windows.

What works today:

today you can download and inatall a version of kde 2.2 for cygwin. this is kde
on windows with the restriction, that all kde windows are in a big XFree window.
this is mainly like a vmware window running windows, only the other way around.
from the normal user point of view this is not that cool, it is a proof of
concept, but for example you can not play Tron, because the delay in the system
is to big for that "fast" game.
but from the programmers point of view this proves, that kde on windows is
possible. look at www.cygwin.com, cygwin provides a posix compatibility layer
for windows. that means, you compile your normal mc for linux and it works in
the cygwin environment. cygwin also comes with a x-server, to which the
programs can draw. this is was kde on cygwin does. for screenshots look at
kde-cygwin.sourceforge.net.
so you can already compile windows binarys of kde today, thanks to the cygwin
and kde-cygwin people. the only thing missing for kde on windows without this
X11 layer inbetween is a QT for windows library.

looking into qt:

qt is a platform and operating system independent gui toolkit. you write
programs based on qt, and then you can compile them for linux, other unixes
which have X11 servers or for embedded devices running linux, like the sharp
zaurus or you compile them for mac os or for ms windows. look at
www.trolltech.com for more information on qt. the opera browser from
www.opera.com is an example for a platform-independent application.
kde uses almost only qt methods and almost no native X11 or operating system
functions in the different qt programs for opening windows on the screen and
displaying stuff in them.
qt is licensed under different licenses. qt for x11 is licensed under the GPL.
that means, i can change the sourcecode like i want, as long as i give out the
changed sourcecode for free and do not build and sell any binary only changed
version of qt.
qt for windows, qt for mac os and qt for x11 are also licensed under a commercial
license, which allows customers to build and sell programs based on qt without
having to give out the source code of their programs.

looking into the source code of qt for x11, only about fifteen files in the
sources are x11-dependent. they can be found in the src/kernel directory of the
qt sources. they are all named *_x11*. as the qt sources consist of several
thousand files, the trolltech people did a very good job on creating this toolkit.
in these files there are the implementations of the methods to open a window,
paint stuff in them, like lines and rectangles and so on, to draw pixmaps on them,
to draw text of a special font in a special size on them and to communicate with
the underlying window system, for example to implement drag and drop and copy and
paste with other windows or to get mouse or keyboard events from it.

as the gpl allows me to port qt-x11-free to windows, i started doing it.
i am able to open a window on windows, resize it, move it on the screen, draw
points, lines and rectangles in it, fill them in different colors and with
different brushes, draw in different colors. The fonts stuff is still not done,
but i can write text with it already. The methods to get the size of characters or
strings on screen are still missing, so the placement of strings is not as it
should be, but i think i will get that done in the next time.

there is a lot of stuff that can be left out for later, like sound and drag and
drop or cut and paste stuff.

i guess i finished about a quarter of what has to be done to be able to basically
run qt on windows in beta quality. there is only one area, which i do not
understand until now, and that is the windows message system, which seems to be
needed to get mouse and keyboard events as well as repaint and window move and
other stuff. also i still need to slightly modify the sourcecode of qt programs
to be able to start them. i have to insert a WinMain and a WndProc function into
the qt application sources, as i couldn't figure out how to do that stuff in the
qt library sources.

so i am searching for some interested people, which do know how to help with this stuff.

to get a start at this, you need a ms windows system, i have windows xp professional.
then install cygwin from www.cygwin.com. then look at kde-cygwin.sourceforge.net
and follow the instructions to install KDE 2. you somewhere have to enter the
url from where you want to download the packages. be sure that you do not enter
any leading or trailing spaces in this field, as the setup program doesn't
understand that :(.
when you have kde running, install the stuff needed to compile qt 2, like gcc and
so on, it is all mentioned on kde-cygwin. when i started playing around with this
qt 3 was not yet working on cygwin for me, so i started with qt 2. once qt 2 is
running, it should take about a day to apply the needed changes to qt 3 to get it
working.
then follow the instructions to compile qt 2 from the cvs sources at
cvs.kde-cygwin.sf.net and test if some of the tutorial and example programs work
for you to be sure that everything works until here.

then you can download my qt-win sources from http://holgis.net/qt-win.
unpack them and compile them

cd into the tutorial/t1 directory and type make, that should build the changed
./t1.exe. start it and see what it does.
now you can start fiddling around with the sources. for now ignore all directories
except /tutorial/t1 as this is the test program and /src/kernel as here are the
files, that need to be adopted. the original files for X11 are named *_x11*,
the windows ones i made with the X11 ones as templates are named *_win*.
i changed the makefiles to not compile the _x11 ones but the _win ones.

the qpainter_win.cpp, qpixmap_win.cpp and qfont_win.cpp files are for drawing on
the screen, you have to look here, if you want to make that better.
when you want to get this message/event stuff working, you have to look into
the qapplication_win.cpp and qwidget_win.cpp files.

it was quite useful to me to look at the sources of the SDL library 
(www.libsdl.org), as they also open windows on the screen and draw to them, and
the microsoft development network, search for it with
gg:msdn gdi
and you will find some relevant stuff, but for me mozilla was the better browser
for those pages.

Happy hacking !



i plan to get a sf account and create a branch in the kde-cygwin qt-2 repository,
if i am allowed to do so. i will spend the next two months hacking on this, let's
see how far we will come until then.

NOTE: This is not to fool the Trolltech people, they are really doing a great job.
I think, that as well as many kde programmers use qt for commercial projects at
their companies and generate income for trolltech this way, qt on windows will
convince more people to use qt. Imagine you could use konqueror, kmail, koffice
and kdevelop instead of internet explorer, outlook, ms office and visual studio
at no cost and even develop gpl`ed programs with that for free.
as kdevelop recently was mentioned as the best ide for linux beating kylix besides
others according to a dot.kde.org article, i guess we could convince quite some
people not to use .net and switch to qt for their next projects. but let's see
how far we will come.
Holger 
holger-kde@holgis.net


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic