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

List:       kde-commits
Subject:    kdeutils/khexedit
From:       David Faure <faure () kde ! org>
Date:       2004-02-29 16:20:30
Message-ID: 20040229162030.9281B995A () office ! kde ! org
[Download RAW message or body]

CVS commit by faure: 

The proper way of porting XQueryPointer calls (when they're about getting the
keyboard modifiers state) is to port them to KApplication::keyboardModifiers().
That code is X11-specific too, but at least it'll be a single place to port to
other platforms.
CCMAIL: Benjamin Meyer <benjamin@csh.rit.edu>


  M +3 -14     hexviewwidget.cc   1.37
  M +3 -13     hexviewwidget.h   1.23


--- kdeutils/khexedit/hexviewwidget.cc  #1.36:1.37
@@ -140,14 +140,5 @@ void CDragManager::timerEvent( QTimerEve
     {
       mPending = false;
-
-#ifdef Q_WS_X11
-      Window root, w;
-      uint mask;
-      int i;
-
-      root = RootWindow( x11Display(), x11Screen() );
-      XQueryPointer( x11Display(), root, &w, &w, &i, &i, &i, &i, &mask );
-      emit startDrag( mask & ShiftMask ? true : false );
-#endif
+      emit startDrag( ( kapp->keyboardModifiers() & KApplication::ShiftModifier ) );
     }
   }
@@ -1526,12 +1517,10 @@ void CHexViewWidget::keyPressEvent( QKey
 void CHexViewWidget::keyReleaseEvent( QKeyEvent *e )
 {
-  if( e->state() & ShiftButton && shiftButtonState() == false )
+  if( ( e->state() & ShiftButton ) && shiftButtonState() == false )
   {
     //
     // The shift button was pressed when event was triggered, but is
     // now released. I use this as a sign to copy selected data to the
-    // clipboard. The shiftButtonState() uses X-lib functions so have a
-    // look in the headerfile (inlined method) if you want to remove
-    // this dependency.
+    // clipboard.
     //
     autoCopy();

--- kdeutils/khexedit/hexviewwidget.h  #1.22:1.23
@@ -267,5 +267,5 @@ class CHexViewWidget : public QFrame
     int  bookmarkMenu( const QString &title );
 
-    inline bool shiftButtonState( void );
+    static inline bool shiftButtonState( void );
 
     inline void setupCursorTimer( void );
@@ -313,15 +313,5 @@ class CHexViewWidget : public QFrame
 inline bool CHexViewWidget::shiftButtonState( void )
 {
-#ifdef Q_WS_X11
-  Window root = RootWindow( x11Display(), x11Screen() );
-  uint mask;
-  Window w;
-  int i;
-  
-  XQueryPointer( x11Display(), root, &w, &w, &i, &i, &i, &i, &mask );
-  return( mask & ShiftMask ? true : false );
-#else
-  return false;
-#endif
+  return kapp->keyboardModifiers() & KApplication::ShiftModifier;
 } 
 


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

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