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

List:       kde-cygwin
Subject:    [PATCH] QCursor improvements in Qt2-win32
From:       Richard_Lärkäng <nouseforaname () home ! se>
Date:       2003-06-12 14:13:31
[Download RAW message or body]

Hi!

I am stuck with a windows computer at the moment,
so I wanted to do some improvements to Qt.

This patch adds at least partial support of QCursor,
QWidget::setCursor(...) should work, at least for
those that I could figure out what the Windows
equivalents were. Don't know about overrideCursor,
as I'm not really sure how that works. And also
own bitmap-cursors doesn't work, as I have to
figure out how that works.

Richard L=E4rk=E4ng

["cursor.diff" (application/octet-stream)]

Index: qapplication_win32.cpp
===================================================================
RCS file: /cvsroot/kde-cygwin/qt-2/src/kernel/Attic/qapplication_win32.cpp,v
retrieving revision 1.1.2.11
diff -u -r1.1.2.11 qapplication_win32.cpp
--- qapplication_win32.cpp	15 Mar 2003 00:12:31 -0000	1.1.2.11
+++ qapplication_win32.cpp	12 Jun 2003 14:03:06 -0000
@@ -2221,7 +2221,7 @@
 #ifdef DEBUG_QAPPLICATION
 	qDebug("qapplication_win.cpp: setOverrideCursor");
 #endif
-/*    if ( !cursorStack ) {
+    if ( !cursorStack ) {
 	cursorStack = new QCursorList;
 	CHECK_PTR( cursorStack );
 	cursorStack->setAutoDelete( TRUE );
@@ -2238,11 +2238,11 @@
     while ( (w=it.current()) ) {		// for all widgets that have
 	if ( w->testWState(WState_OwnCursor) &&
 	     ( !amw || !w->isVisible() || w->topLevelWidget() == amw ) )	//   set a cursor
-	    XDefineCursor( w->x11Display(), w->winId(), app_cursor->handle() );
+//	    XDefineCursor( w->x11Display(), w->winId(), app_cursor->handle() );
 	++it;
     }
-    XFlush( appDpy );				// make X execute it NOW
-*/}
+//    XFlush( appDpy );				// make X execute it NOW
+}
 
 /*!
   Undoes the last setOverrideCursor().
@@ -6794,14 +6794,15 @@
         case WM_DESTROY:
             PostQuitMessage (0);
             break;
-#if 0
         case WM_SETCURSOR: {
+            qDebug("qapplication_win.cpp: WM_SETCURSOR");
             QCursor *cursor = qApp->overrideCursor ();
             if (cursor && cursor->handle ())
-                SetCursor (cursor->handle ());
+                SetCursor (cursor->handle());
+            else
+		SetCursor(widget->cursor().handle());
             break;
         }
-#endif
         default:
             qDebug("qapplication_win.cpp: processNextEvent: DefWindowProc");
             return DefWindowProc(hwnd, uMsg, wParam, lParam);
Index: qcursor_win32.cpp
===================================================================
RCS file: /cvsroot/kde-cygwin/qt-2/src/kernel/Attic/qcursor_win32.cpp,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 qcursor_win32.cpp
--- qcursor_win32.cpp	19 Jan 2003 15:09:41 -0000	1.1.2.1
+++ qcursor_win32.cpp	12 Jun 2003 14:03:07 -0000
@@ -34,6 +34,9 @@
 #include "qdatastream.h"
 #include "qt_x11.h"
 #include <X11/cursorfont.h>
+#define Status WIN_Status
+#include <windows.h>
+#undef WIN_Status
 
 // NOT REVISED
 
@@ -52,7 +55,7 @@
     QBitmap  *bm, *bmm;
     short     hx, hy;
     XColor    fg,bg;
-    Cursor    hcurs;
+    HCURSOR   hcurs;
     Pixmap    pm, pmm;
 };
 
@@ -401,11 +404,11 @@
 
 HCURSOR QCursor::handle() const
 {
-/*    if ( !initialized )
+    if ( !initialized )
 	initialize();
     if ( !data->hcurs )
 	update();
-*/    return (HCURSOR)data->hcurs;
+    return data->hcurs;
 }
 
 
@@ -428,7 +431,11 @@
     XQueryPointer( qt_xdisplay(), qt_xrootwin(), &root, &child,
 		   &root_x, &root_y, &win_x, &win_y, &buttons );
     return QPoint( root_x, root_y );
-*/	return QPoint( 1,1);
+*/
+    POINT* p;
+    GetCursorPos(p);
+    return QPoint(p->x, p->y);
+
 }
 
 /*!
@@ -449,7 +456,7 @@
     if (pos() == QPoint(x,y))
 	return;
 
-//    XWarpPointer( qt_xdisplay(), None, qt_xrootwin(), 0, 0, 0, 0, x, y );
+    SetCursorPos(x, y);
 }
 
 /*!
@@ -463,279 +470,71 @@
 
 void QCursor::update() const
 {
-/*    if ( !initialized )
+    if ( !initialized )
 	initialize();
     register QCursorData *d = data;		// cheat const!
     if ( d->hcurs )				// already loaded
 	return;
 
-    Display *dpy = qt_xdisplay();
-    Window rootwin = qt_xrootwin();
-
     if ( d->cshape == BitmapCursor ) {
+	/*
 	d->hcurs = XCreatePixmapCursor( dpy, d->bm->handle(), d->bmm->handle(),
-					&d->fg, &d->bg, d->hx, d->hy );
-	return;
-    }
-
-    static uchar cur_blank_bits[] = {
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-
-  // Non-standard X11 cursors are created from bitmaps
-
-#ifndef QT_USE_APPROXIMATE_CURSORS
-    static uchar cur_ver_bits[] = {
-	0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f,
-	0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f,
-	0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00 };
-    static uchar mcur_ver_bits[] = {
-	0x00, 0x00, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xf8, 0x3f,
-	0xfc, 0x7f, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xfc, 0x7f, 0xf8, 0x3f,
-	0xf0, 0x1f, 0xe0, 0x0f, 0xc0, 0x07, 0x80, 0x03 };
-    static uchar cur_hor_bits[] = {
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x30, 0x18,
-	0x38, 0x38, 0xfc, 0x7f, 0xfc, 0x7f, 0x38, 0x38, 0x30, 0x18, 0x20, 0x08,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-    static uchar mcur_hor_bits[] = {
-	0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x60, 0x0c, 0x70, 0x1c, 0x78, 0x3c,
-	0xfc, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, 0x78, 0x3c,
-	0x70, 0x1c, 0x60, 0x0c, 0x40, 0x04, 0x00, 0x00 };
-    static uchar cur_bdiag_bits[] = {
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3c, 0x00, 0x3e,
-	0x00, 0x37, 0x88, 0x23, 0xd8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0xf8, 0x00,
-	0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-    static uchar mcur_bdiag_bits[] = {
-	0x00, 0x00, 0xc0, 0x7f, 0x80, 0x7f, 0x00, 0x7f, 0x00, 0x7e, 0x04, 0x7f,
-	0x8c, 0x7f, 0xdc, 0x77, 0xfc, 0x63, 0xfc, 0x41, 0xfc, 0x00, 0xfc, 0x01,
-	0xfc, 0x03, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00 };
-    static uchar cur_fdiag_bits[] = {
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00,
-	0xf8, 0x00, 0xd8, 0x01, 0x88, 0x23, 0x00, 0x37, 0x00, 0x3e, 0x00, 0x3c,
-	0x00, 0x3e, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00 };
-    static uchar mcur_fdiag_bits[] = {
-	0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x01, 0xfc, 0x00,
-	0xfc, 0x41, 0xfc, 0x63, 0xdc, 0x77, 0x8c, 0x7f, 0x04, 0x7f, 0x00, 0x7e,
-	0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x7f, 0x00, 0x00 };
-    static uchar *cursor_bits16[] = {
-	cur_ver_bits, mcur_ver_bits, cur_hor_bits, mcur_hor_bits,
-	cur_bdiag_bits, mcur_bdiag_bits, cur_fdiag_bits, mcur_fdiag_bits,
-	0, 0, cur_blank_bits, cur_blank_bits };
-
-    static uchar vsplit_bits[] = {
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00,
-	0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00,
-	0x00, 0x41, 0x82, 0x00, 0x80, 0x41, 0x82, 0x01, 0xc0, 0x7f, 0xfe, 0x03,
-	0x80, 0x41, 0x82, 0x01, 0x00, 0x41, 0x82, 0x00, 0x00, 0x40, 0x02, 0x00,
-	0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00,
-	0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-    static uchar vsplitm_bits[] = {
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00,
-	0x00, 0xe0, 0x07, 0x00, 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe3, 0xc7, 0x00,
-	0x80, 0xe3, 0xc7, 0x01, 0xc0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07,
-	0xc0, 0xff, 0xff, 0x03, 0x80, 0xe3, 0xc7, 0x01, 0x00, 0xe3, 0xc7, 0x00,
-	0x00, 0xe2, 0x47, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00,
-	0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-    static uchar hsplit_bits[] = {
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00,
-	0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
-	0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00,
-	0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
-	0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00,
-	0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-    static uchar hsplitm_bits[] = {
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
-	0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00,
-	0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00,
-	0x00, 0xc0, 0x01, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00,
-	0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00,
-	0x80, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00,
-	0x00, 0xc0, 0x01, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00,
-	0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-    static uchar phand_bits[] = {
-	0x00, 0x00, 0x00, 0x00,	0xfe, 0x01, 0x00, 0x00,	0x01, 0x02, 0x00, 0x00,
-	0x7e, 0x04, 0x00, 0x00,	0x08, 0x08, 0x00, 0x00,	0x70, 0x08, 0x00, 0x00,
-	0x08, 0x08, 0x00, 0x00,	0x70, 0x14, 0x00, 0x00,	0x08, 0x22, 0x00, 0x00,
-	0x30, 0x41, 0x00, 0x00,	0xc0, 0x20, 0x00, 0x00,	0x40, 0x12, 0x00, 0x00,
-	0x80, 0x08, 0x00, 0x00,	0x00, 0x05, 0x00, 0x00,	0x00, 0x02, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00,	0x00, 0x00, 0x00, 0x00,	0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00,	0x00, 0x00, 0x00, 0x00,	0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00,	0x00, 0x00, 0x00, 0x00,	0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00,	0x00, 0x00, 0x00, 0x00,	0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00,	0x00, 0x00, 0x00, 0x00,	0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00,	0x00, 0x00, 0x00, 0x00 };
-    static uchar phandm_bits[] = {
-	0xfe, 0x01, 0x00, 0x00,	0xff, 0x03, 0x00, 0x00,	0xff, 0x07, 0x00, 0x00,
-	0xff, 0x0f, 0x00, 0x00,	0xfe, 0x1f, 0x00, 0x00,	0xf8, 0x1f, 0x00, 0x00,
-	0xfc, 0x1f, 0x00, 0x00,	0xf8, 0x3f, 0x00, 0x00,	0xfc, 0x7f, 0x00, 0x00,
-	0xf8, 0xff, 0x00, 0x00,	0xf0, 0x7f, 0x00, 0x00,	0xe0, 0x3f, 0x00, 0x00,
-	0xc0, 0x1f, 0x00, 0x00,	0x80, 0x0f, 0x00, 0x00,	0x00, 0x07, 0x00, 0x00,
-	0x00, 0x02, 0x00, 0x00,	0x00, 0x00, 0x00, 0x00,	0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00,	0x00, 0x00, 0x00, 0x00,	0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00,	0x00, 0x00, 0x00, 0x00,	0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00,	0x00, 0x00, 0x00, 0x00,	0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00,	0x00, 0x00, 0x00, 0x00,	0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00,	0x00, 0x00, 0x00, 0x00 };
-
-    static uchar *cursor_bits32[] = {
-	vsplit_bits, vsplitm_bits, hsplit_bits, hsplitm_bits,
-	    phand_bits, phandm_bits
-    };
-
-    static uchar forbidden_bits[] = {
-	0x00,0x00,0x00,0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xf0,0x00,0x38,0xc0,0x01,
-	    0x7c,0x80,0x03,0xec,0x00,0x03,0xce,0x01,0x07,0x86,0x03,0x06,0x06,0x07,0x06,
-	    0x06,0x0e,0x06,0x06,0x1c,0x06,0x0e,0x38,0x07,0x0c,0x70,0x03,0x1c,0xe0,0x03,
-	    0x38,0xc0,0x01,0xf0,0xe0,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00,0x00,0x00,0x00 };
-
-    static unsigned char forbiddenm_bits[] = {
-	0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xff,0x00,0xf8,0xff,0x01,0xfc,0xf0,0x03,
-	    0xfe,0xc0,0x07,0xfe,0x81,0x07,0xff,0x83,0x0f,0xcf,0x07,0x0f,0x8f,0x0f,0x0f,
-	    0x0f,0x1f,0x0f,0x0f,0x3e,0x0f,0x1f,0xfc,0x0f,0x1e,0xf8,0x07,0x3e,0xf0,0x07,
-	    0xfc,0xe0,0x03,0xf8,0xff,0x01,0xf0,0xff,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00};
-
-    static uchar *cursor_bits20[] = {
-	    forbidden_bits, forbiddenm_bits
-    };
-
-    if ( d->cshape >= SizeVerCursor && d->cshape < SizeAllCursor ||
-	 d->cshape == BlankCursor ) {
-	XColor bg, fg;				// ignore stupid CFront message
-	bg.red   = 255 << 8;
-	bg.green = 255 << 8;
-	bg.blue  = 255 << 8;
-	fg.red   = 0;
-	fg.green = 0;
-	fg.blue  = 0;
-	int i = (d->cshape - SizeVerCursor)*2;
-	d->pm  = XCreateBitmapFromData( dpy, rootwin, (char *)cursor_bits16[i],
-					16, 16 );
-	d->pmm = XCreateBitmapFromData( dpy, rootwin, (char *)cursor_bits16[i+1],
-					16,16);
-	d->hcurs = XCreatePixmapCursor( dpy, d->pm, d->pmm, &fg, &bg, 8, 8 );
-	return;
-    }
-    if ( d->cshape >= SplitVCursor && d->cshape <= PointingHandCursor ) {
-	XColor bg, fg;				// ignore stupid CFront message
-	bg.red   = 255 << 8;
-	bg.green = 255 << 8;
-	bg.blue  = 255 << 8;
-	fg.red   = 0;
-	fg.green = 0;
-	fg.blue  = 0;
-	int i = (d->cshape - SplitVCursor)*2;
-	d->pm  = XCreateBitmapFromData( dpy, rootwin, (char *)cursor_bits32[i],
-					32, 32 );
-	d->pmm = XCreateBitmapFromData( dpy, rootwin, (char *)cursor_bits32[i+1],
-					32, 32);
-	int hs = d->cshape != PointingHandCursor? 16 : 0;
-	d->hcurs = XCreatePixmapCursor( dpy, d->pm, d->pmm, &fg, &bg, hs, hs );
+					&d->fg, &d->bg, d->hx, d->hy );*/
+	// TODO how?
+	d->hcurs = LoadCursor(0, IDC_ARROW);
 	return;
     }
-    if ( d->cshape == ForbiddenCursor ) {
-	XColor bg, fg;				// ignore stupid CFront message
-	bg.red   = 255 << 8;
-	bg.green = 255 << 8;
-	bg.blue  = 255 << 8;
-	fg.red   = 0;
-	fg.green = 0;
-	fg.blue  = 0;
-	int i = (d->cshape - ForbiddenCursor)*2;
-	d->pm  = XCreateBitmapFromData( dpy, rootwin, (char *)cursor_bits20[i],
-					20, 20 );
-	d->pmm = XCreateBitmapFromData( dpy, rootwin, (char *)cursor_bits20[i+1],
-					20, 20);
-	d->hcurs = XCreatePixmapCursor( dpy, d->pm, d->pmm, &fg, &bg, 10, 10 );
-	return;
-    }
-#endif /* ! QT_USE_APPROXIMATE_CURSORS *//*
 
-    uint sh;
-    switch ( d->cshape ) {			// map Q cursor to X cursor
+    LPCSTR sh;
+    switch ( d->cshape ) {
 	case ArrowCursor:
-	    sh = XC_left_ptr;
+	    sh = IDC_ARROW;
 	    break;
 	case UpArrowCursor:
-	    sh = XC_center_ptr;
+	    sh = IDC_UPARROW;
 	    break;
 	case CrossCursor:
-	    sh = XC_crosshair;
+	    sh = IDC_CROSS;
 	    break;
 	case WaitCursor:
-	    sh = XC_watch;
+	    sh = IDC_WAIT;
 	    break;
 	case IbeamCursor:
-	    sh = XC_xterm;
+	    sh = IDC_IBEAM;
 	    break;
 	case SizeAllCursor:
-	    sh = XC_fleur;
+	    sh = IDC_SIZEALL;
 	    break;
-#ifdef QT_USE_APPROXIMATE_CURSORS
 	case SizeVerCursor:
-	    sh = XC_top_side;
+	    sh = IDC_SIZENS;
 	    break;
 	case SizeHorCursor:
-	    sh = XC_right_side;
+	    sh = IDC_SIZEWE;
 	    break;
 	case SizeBDiagCursor:
-	    sh = XC_top_right_corner;
+	    sh = IDC_SIZENESW;
 	    break;
 	case SizeFDiagCursor:
-	    sh = XC_bottom_right_corner;
+	    sh = IDC_SIZENWSE;
 	    break;
 	case BlankCursor:
-	    XColor bg, fg;                          // ignore stupid CFront message
-	    bg.red   = 255 << 8;
-	    bg.green = 255 << 8;
-	    bg.blue  = 255 << 8;
-	    fg.red   = 0;
-	    fg.green = 0;
-	    fg.blue  = 0;
-	    d->pm  = XCreateBitmapFromData( dpy, rootwin,
-		(char *)cur_blank_bits, 16, 16 );
-	    d->pmm = XCreateBitmapFromData( dpy, rootwin,
-		(char *)cur_blank_bits, 16,16);
-	    d->hcurs = XCreatePixmapCursor( dpy, d->pm, d->pmm, &fg,
-		&bg, 8, 8 );
-	    return;
-	    break;
 	case SplitVCursor:
-	    sh = XC_sb_h_double_arrow;
-	    break;
 	case SplitHCursor:
-	    sh = XC_sb_v_double_arrow;
+	    // TODO What?
+	    sh = IDC_ARROW;
+	    break;
 	    break;
 	case PointingHandCursor:
-	    sh = XC_hand1;
+	    sh = IDC_HAND;
 	    break;
 	case ForbiddenCursor:
-	    sh = XC_circle;
+	    sh = IDC_NO;
 	    break;
-#endif /* QT_USE_APPROXIMATE_CURSORS *//*
 	default:
-#if defined(CHECK_RANGE)
+	    sh = IDC_ARROW;
 	    qWarning( "QCursor::update: Invalid cursor shape %d", d->cshape );
-#endif
 	    return;
     }
-    d->hcurs = XCreateFontCursor( dpy, sh );
-*/}
+    d->hcurs = LoadCursor(0, sh);
+}
+
Index: qwidget_win32.cpp
===================================================================
RCS file: /cvsroot/kde-cygwin/qt-2/src/kernel/Attic/qwidget_win32.cpp,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 qwidget_win32.cpp
--- qwidget_win32.cpp	13 Mar 2003 01:46:56 -0000	1.1.2.5
+++ qwidget_win32.cpp	12 Jun 2003 14:03:25 -0000
@@ -366,7 +366,7 @@
 #ifdef DEBUG_QWIDGET
 	qDebug("qwidget_win.cpp: destroy");
 #endif
-/*    deactivateWidgetCleanup();
+    deactivateWidgetCleanup();
     if ( testWState(WState_Created) ) {
 	clearWState( WState_Created );
 	if ( children() ) {
@@ -390,14 +390,15 @@
 	else if ( testWFlags(WType_Popup) )
 	    qApp->closePopup( this );
 #ifdef QT_XFT
-	qt_destroy_ft_draw (x11Display (), winid);
+//	qt_destroy_ft_draw (x11Display (), winid);
 #endif
 	if ( testWFlags(WType_Desktop) ) {
 	    if ( acceptDrops() )
 		qt_dnd_enable( this, FALSE );
 	} else {
 	    if ( destroyWindow )
-		qt_XDestroyWindow( this, x11Display(), winid );
+		DestroyWindow(winid);
+		//qt_XDestroyWindow( this, x11Display(), winid );
 	}
 	setWinId( 0 );
 
@@ -405,7 +406,7 @@
 	if ( testWState(WState_Reparented) )
 	    qPRCleanup(this);
     }
-*/}
+}
 
 /*!
   Reparents the widget.  The widget gets a new \a parent, new widget
@@ -807,7 +808,7 @@
 #ifdef DEBUG_QWIDGET
 	qDebug("qwidget_win.cpp: setCursor");
 #endif
-/*    if ( cursor.handle() != arrowCursor.handle()
+    if ( cursor.handle() != arrowCursor.handle()
 	 || (extra && extra->curs) ) {
 	createExtra();
 	delete extra->curs;
@@ -815,10 +816,14 @@
     }
     setWState( WState_OwnCursor );
     QCursor *oc = QApplication::overrideCursor();
-    XDefineCursor( x11Display(), winId(),
-		   oc ? oc->handle() : cursor.handle() );
-    XFlush( x11Display() );
-*/}
+
+    if (oc)
+        extra->curs = oc;
+
+//    XDefineCursor( x11Display(), winId(),
+//		   oc ? oc->handle() : cursor.handle() );
+//    XFlush( x11Display() );
+}
 
 
 /*!
@@ -1448,19 +1453,21 @@
 #ifdef DEBUG_QWIDGET
 	qDebug("qwidget_win.cpp: hideWindow");
 #endif
-/*    clearWState( WState_Exposed );
+    clearWState( WState_Exposed );
     deactivateWidgetCleanup();
     if ( isTopLevel() ) {
 	qt_deferred_map_take( this );
 	if ( winId() ) // in nsplugin, may be 0
-	    XWithdrawWindow( x11Display(), winId(), x11Screen() );
+	    ShowWindow(winid, SW_HIDE);
+//	    XWithdrawWindow( x11Display(), winId(), x11Screen() );
 	crect.moveTopLeft( fpos );
 	topData()->fsize = crect.size();
     } else {
 	if ( winId() ) // in nsplugin, may be 0
-	    XUnmapWindow( x11Display(), winId() );
+	    ShowWindow(winid, SW_HIDE);
+//	    XUnmapWindow( x11Display(), winId() );
     }
-*/}
+}
 
 
 /*!


_______________________________________________
kde-cygwin mailing list
kde-cygwin@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-cygwin


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

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