aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-08-04 09:01:12 -0400
committerKen Moore <moorekou@gmail.com>2015-08-04 09:01:12 -0400
commitdcf609187b8c12fef2698356a2bcfad15fc471d0 (patch)
treecbb003feb5ff9a9212ee674e5da33d39b1dd5835
parentMerge branch 'master' of github.com:pcbsd/lumina (diff)
downloadlumina-dcf609187b8c12fef2698356a2bcfad15fc471d0.tar.gz
lumina-dcf609187b8c12fef2698356a2bcfad15fc471d0.tar.bz2
lumina-dcf609187b8c12fef2698356a2bcfad15fc471d0.zip
Convert lumina-screenshot to use the XCB interface exclusively (no more XLib), and add the option to include/exclude window borders for a single-window screenshot.
-rw-r--r--lumina-screenshot/MainUI.cpp14
-rw-r--r--lumina-screenshot/MainUI.h4
-rw-r--r--lumina-screenshot/MainUI.ui73
3 files changed, 53 insertions, 38 deletions
diff --git a/lumina-screenshot/MainUI.cpp b/lumina-screenshot/MainUI.cpp
index 22d18169..24db2afd 100644
--- a/lumina-screenshot/MainUI.cpp
+++ b/lumina-screenshot/MainUI.cpp
@@ -1,6 +1,6 @@
//===========================================
// Lumina-DE source code
-// Copyright (c) 2014, Ken Moore
+// Copyright (c) 2014-2015, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
@@ -11,6 +11,7 @@
MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
ui->setupUi(this); //load the designer file
+ XCB = new LXCB();
cpic = QApplication::screens().at(0)->grabWindow(QApplication::desktop()->winId()); //initial screenshot
ppath = QDir::homePath();
QWidget *spacer = new QWidget();
@@ -77,11 +78,11 @@ bool MainUI::getWindow(){
if(ui->radio_window->isChecked()){
settings->setValue("screenshot-target", "window");
//Use xprop to get the desired window from the user
- QList<WId> wins = LX11::WindowList();
+ QList<WId> wins = XCB->WindowList();
wins.removeAll(this->winId()); //don't show this window
QStringList names;
for(int i=0; i<wins.length(); i++){
- names << LX11::WindowClass(wins[i])+" ("+LX11::WindowName(wins[i])+")";
+ names << XCB->WindowClass(wins[i])+" ("+XCB->WindowName(wins[i])+")";
}
bool ok = false;
QString info = QInputDialog::getItem(this, tr("Select Window"), tr("Window:"), names, 0, false, &ok);
@@ -106,7 +107,12 @@ void MainUI::getPixmap(){
cpic = scrn->grabWindow(QApplication::desktop()->winId(), geom.x(), geom.y(), geom.width(), geom.height() );
}else{
//Grab just the designated window
- cpic = scrn->grabWindow(cwin);
+ if(ui->check_frame->isChecked()){
+ QRect geom = XCB->WindowGeometry(cwin, true); //include the frame
+ cpic = scrn->grabWindow(QApplication::desktop()->winId(), geom.x(), geom.y(), geom.width(), geom.height() );
+ }else{
+ cpic = scrn->grabWindow(cwin);
+ }
}
this->show();
//Now display the pixmap on the label as well
diff --git a/lumina-screenshot/MainUI.h b/lumina-screenshot/MainUI.h
index 8c408131..0640f89b 100644
--- a/lumina-screenshot/MainUI.h
+++ b/lumina-screenshot/MainUI.h
@@ -1,6 +1,6 @@
//===========================================
// Lumina-DE source code
-// Copyright (c) 2014, Ken Moore
+// Copyright (c) 2014-2015, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
@@ -21,6 +21,7 @@
#include <LuminaXDG.h>
#include <LuminaUtils.h>
+#include <LuminaX11.h>
namespace Ui{
class MainUI;
@@ -41,6 +42,7 @@ private:
QString ppath; //previous file path
WId cwin; //current window to screenshot
QSettings *settings;
+ LXCB *XCB; //Library access to window subsystems
private slots:
//Button Slots
diff --git a/lumina-screenshot/MainUI.ui b/lumina-screenshot/MainUI.ui
index a4fe849c..1ad2f0ff 100644
--- a/lumina-screenshot/MainUI.ui
+++ b/lumina-screenshot/MainUI.ui
@@ -49,7 +49,17 @@
<property name="bottomMargin">
<number>1</number>
</property>
- <item row="0" column="3">
+ <property name="spacing">
+ <number>2</number>
+ </property>
+ <item row="3" column="1">
+ <widget class="QCheckBox" name="check_frame">
+ <property name="text">
+ <string>Include Borders</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
<widget class="QSpinBox" name="spin_delay">
<property name="suffix">
<string> Seconds</string>
@@ -62,56 +72,53 @@
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QSpinBox" name="spin_monitor">
- <property name="prefix">
- <string notr="true"># </string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
+ <item row="1" column="0">
<widget class="QRadioButton" name="radio_all">
<property name="text">
<string>Entire Session</string>
</property>
</widget>
</item>
- <item row="2" column="0">
+ <item row="3" column="0">
<widget class="QRadioButton" name="radio_window">
<property name="text">
<string>Single Window</string>
</property>
</widget>
</item>
- <item row="0" column="1">
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>0</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="1" column="0">
+ <item row="2" column="0">
<widget class="QRadioButton" name="radio_monitor">
<property name="text">
<string>Single Screen</string>
</property>
</widget>
</item>
- <item row="0" column="2" rowspan="3">
- <widget class="Line" name="line">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- </widget>
+ <item row="2" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QSpinBox" name="spin_monitor">
+ <property name="prefix">
+ <string notr="true"># </string>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
</item>
</layout>
</widget>
bgstack15