aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-screenshot
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2016-05-04 12:44:01 -0400
committerKen Moore <moorekou@gmail.com>2016-05-04 12:44:01 -0400
commitb6cb36bd5119c63a2376f64001a9f0afbee3cafc (patch)
treecdc3ff30d9279f6e0c85e5bd711458bbfa82fdee /src-qt5/desktop-utils/lumina-screenshot
parentUpdate LuminaUtils.cpp (diff)
downloadlumina-b6cb36bd5119c63a2376f64001a9f0afbee3cafc.tar.gz
lumina-b6cb36bd5119c63a2376f64001a9f0afbee3cafc.tar.bz2
lumina-b6cb36bd5119c63a2376f64001a9f0afbee3cafc.zip
Have lumina-screenshot use the current window stacking order for determining which window is under the mouse click (in the case of layered windows at the click point).
Diffstat (limited to 'src-qt5/desktop-utils/lumina-screenshot')
-rw-r--r--src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp b/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp
index 47828cdd..446e9bf7 100644
--- a/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp
@@ -158,10 +158,16 @@ void MainUI::mouseReleaseEvent(QMouseEvent *ev){
//In the middle of selecting a window to take a screenshot
// Get the window underneath the mouse click and take the screenshot
QList<WId> wins = XCB->WindowList();
+ QList<WId> stack = XCB->WM_Get_Client_List(true);
cwin = 0;
//qDebug() << "Try to select window:" << ev->globalPos();
- for(int i=0; i<wins.length() && cwin==0; i++){
- if( XCB->WindowGeometry(wins[i], true).contains(ev->globalPos()) ){ cwin = wins[i]; }
+ //for(int i=0; i<stack.length(); i++){
+ for(int i=stack.length()-1; i>=0 && cwin==0; i--){ //work top->bottom in the stacking order
+ if(!wins.contains(stack[i])){ continue; }
+ if( XCB->WindowGeometry(stack[i], true).contains(ev->globalPos()) && XCB->WindowState(stack[i])!=LXCB::INVISIBLE ){
+ qDebug() << "Found Window:" << i << XCB->WindowClass(stack[i]);
+ cwin = stack[i];
+ }
}
qDebug() << " - Got window:" << cwin;
if(cwin==this->winId()){ return; } //cancelled
bgstack15