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

List:       kde-commits
Subject:    KDE/kdegraphics
From:       Pau Garcia i Quiles <pgquiles () elpauer ! org>
Date:       2010-12-15 12:47:32
Message-ID: 20101215124732.DC48FAC8AB () svn ! kde ! org
[Download RAW message or body]

SVN commit 1206685 by pgquiles:

Initial port of KSnapshot to Windows. For now, just disable X11-specific stuff (child \
window, window under cursor). I'll implement that later.


 M  +4 -1      CMakeLists.txt  
 M  +2 -2      ksnapshot/CMakeLists.txt  
 M  +2 -0      ksnapshot/kbackgroundsnapshot.cpp  
 M  +1 -1      ksnapshot/kipiinterface.h  
 M  +2 -0      ksnapshot/ksnapshot.cpp  
 M  +1 -1      ksnapshot/ksnapshotimagecollectionshared.h  
 M  +3 -0      ksnapshot/ksnapshotobject.cpp  
 M  +13 -2     ksnapshot/windowgrabber.cpp  


--- trunk/KDE/kdegraphics/CMakeLists.txt #1206684:1206685
@@ -67,8 +67,11 @@
   macro_optional_add_subdirectory(okular)
 endif(QIMAGEBLITZ_FOUND)
 
+IF(Q_WS_X11 OR Q_WS_WIN)
+  macro_optional_add_subdirectory(ksnapshot)
+ENDIF(Q_WS_X11 OR Q_WS_WIN)
+
 if(Q_WS_X11)
-    macro_optional_add_subdirectory(ksnapshot)
     if (X11_xf86vmode_FOUND)
        macro_optional_add_subdirectory(kgamma)
     endif (X11_xf86vmode_FOUND)
--- trunk/KDE/kdegraphics/ksnapshot/CMakeLists.txt #1206684:1206685
@@ -2,8 +2,8 @@
 
 include(MacroBoolTo01)
 
-set(HAVE_X11_EXTENSIONS_SHAPE_H X11_Xshape_FOUND)
-set(HAVE_X11_EXTENSIONS_XFIXES_H X11_Xfixes_FOUND)
+set(HAVE_X11_EXTENSIONS_SHAPE_H ${X11_Xshape_FOUND})
+set(HAVE_X11_EXTENSIONS_XFIXES_H ${X11_Xfixes_FOUND})
 macro_log_feature(HAVE_X11_EXTENSIONS_XFIXES_H "X11 Fixes Extension (xfixes.h)" "X11 \
XFixes Extension" "http://www.x.org/" FALSE "" "Needed to capture the cursor in \
ksnapshot.")  
 if (KIPI_FOUND)
--- trunk/KDE/kdegraphics/ksnapshot/kbackgroundsnapshot.cpp #1206684:1206685
@@ -114,7 +114,9 @@
         savePictureOnDesktop();
     }
     else {
+#ifdef Q_WS_X11
         snapshot = QPixmap::grabWindow( QX11Info::appRootWindow() );
+#endif // Q_WS_X11
         savePictureOnDesktop();
     }
 }
--- trunk/KDE/kdegraphics/ksnapshot/kipiinterface.h #1206684:1206685
@@ -30,7 +30,7 @@
 #include <libkipi/imagecollectionshared.h>
 
 class KSnapshot;
-class KIPIInterfacePrivate;
+struct KIPIInterfacePrivate;
 
 class KIPIInterface :public KIPI::Interface {
 	Q_OBJECT
--- trunk/KDE/kdegraphics/ksnapshot/ksnapshot.cpp #1206684:1206685
@@ -568,7 +568,9 @@
 
 void KSnapshot::slotScreenshotReceived( qulonglong handle )
 {
+#ifdef Q_WS_X11
     slotWindowGrabbed( QPixmap::fromX11Pixmap( handle ) );
+#endif
 }
 
 void KSnapshot::closeEvent( QCloseEvent * e )
--- trunk/KDE/kdegraphics/ksnapshot/ksnapshotimagecollectionshared.h #1206684:1206685
@@ -41,7 +41,7 @@
         bool isDirectory() { return false; }
 
 private:
-        class Private;
+        struct Private;
         Private* d;
         KUrl::List mImages;
 };
--- trunk/KDE/kdegraphics/ksnapshot/ksnapshotobject.cpp #1206684:1206685
@@ -26,7 +26,10 @@
 
 #include "ksnapshotobject.h"
 
+#ifdef Q_WS_X11
 #include <fixx11h.h>
+#endif
+
 //kde include
 #include <KMessageBox>
 #include <KMimeType>
--- trunk/KDE/kdegraphics/ksnapshot/windowgrabber.cpp #1206684:1206685
@@ -31,12 +31,14 @@
 #include <QMouseEvent>
 #include <QWheelEvent>
 
+#ifdef Q_WS_X11
 #include <X11/Xlib.h>
 #include <config-ksnapshot.h>
 #ifdef HAVE_X11_EXTENSIONS_SHAPE_H
 #include <X11/extensions/shape.h>
 #endif
 #include <QX11Info>
+#endif
 
 static
 const int minSize = 8;
@@ -47,6 +49,7 @@
     return r1.width() * r1.height() < r2.width() * r2.height();
 }
 
+#ifdef Q_WS_X11
 // Recursively iterates over the window w and its children, thereby building
 // a tree of window descriptors. Windows in non-viewable state or with height
 // or width smaller than minSize will be ignored.
@@ -199,6 +202,7 @@
 
     return pm;
 }
+#endif
 
 QString WindowGrabber::title;
 QString WindowGrabber::windowClass;
@@ -209,8 +213,10 @@
   current( -1 ), yPos( -1 )
 {
     setWindowModality( Qt::WindowModal );
+	int y, x;
+
+#ifdef Q_WS_X11
     Window root;
-    int y, x;
     uint w, h, border, depth;
     XGrabServer( QX11Info::display() );
     Window child = windowUnderCursor();
@@ -218,13 +224,14 @@
     QPixmap pm( grabWindow( child, x, y, w, h, border, &title, &windowClass ) );
     getWindowsRecursive( windows, child );
     XUngrabServer( QX11Info::display() );
-
     QPalette p = palette();
     p.setBrush( backgroundRole(), QBrush( pm ) );
     setPalette( p );
     setFixedSize( pm.size() );
     setMouseTracking( true );
     setGeometry( x, y, w, h );
+#endif // Q_WS_X11
+
     current = windowIndex( mapFromGlobal(QCursor::pos()) );
 }
 
@@ -234,6 +241,7 @@
 
 QPixmap WindowGrabber::grabCurrent( bool includeDecorations )
 {
+#ifdef Q_WS_X11
     Window root;
     int x, y;
     uint w, h, border, depth;
@@ -259,8 +267,11 @@
     QPixmap pm( grabWindow( child, x, y, w, h, border, &title, &windowClass ) );
     XUngrabServer( QX11Info::display() );
     return pm;
+#endif // Q_WS_X11
+	return QPixmap(); // TODO Implement on Windows and Mac
 }
 
+
 void WindowGrabber::mousePressEvent( QMouseEvent *e )
 {
     if ( e->button() == Qt::RightButton )


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

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