aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src-qt5/core-utils/lumina-config/pages/page_wallpaper.cpp2
-rw-r--r--src-qt5/core-utils/lumina-xconfig/MainUI.cpp22
-rw-r--r--src-qt5/core/libLumina/LDesktopUtils.cpp14
-rw-r--r--src-qt5/core/libLumina/LuminaX11.cpp240
-rw-r--r--src-qt5/core/libLumina/obsolete/RootSubWindow.cpp2
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h6
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Text.h2
-rw-r--r--src-qt5/core/lumina-desktop/BootSplash.cpp2
-rw-r--r--src-qt5/core/lumina-desktop/Globals.h2
-rw-r--r--src-qt5/core/lumina-desktop/LDesktop.cpp15
-rw-r--r--src-qt5/core/lumina-desktop/LSession.cpp40
-rw-r--r--src-qt5/core/lumina-desktop/SystemWindow.cpp2
-rw-r--r--src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp4
-rw-r--r--src-qt5/core/lumina-desktop/desktop-plugins/applauncher/OutlineToolButton.h4
-rw-r--r--src-qt5/core/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp4
-rw-r--r--src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.cpp6
-rw-r--r--src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp2
-rw-r--r--src-qt5/core/lumina-open/main.cpp2
-rw-r--r--src-qt5/core/lumina-theme-engine/src/lthemeengine/fontspage.cpp9
-rw-r--r--src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.cpp16
-rw-r--r--src-qt5/desktop-utils/lumina-archiver/MainUI.cpp2
-rw-r--r--src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp4
-rw-r--r--src-qt5/desktop-utils/lumina-fm/Browser.cpp2
-rw-r--r--src-qt5/desktop-utils/lumina-fm/BrowserModel.cpp2
-rw-r--r--src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp6
-rw-r--r--src-qt5/desktop-utils/lumina-fm/ScrollDialog.h2
-rw-r--r--src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp8
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp4
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp2
-rw-r--r--src-qt5/experimental/lumina-terminal/TerminalWidget.cpp4
30 files changed, 218 insertions, 214 deletions
diff --git a/src-qt5/core-utils/lumina-config/pages/page_wallpaper.cpp b/src-qt5/core-utils/lumina-config/pages/page_wallpaper.cpp
index 7dc9f8f8..639e3f47 100644
--- a/src-qt5/core-utils/lumina-config/pages/page_wallpaper.cpp
+++ b/src-qt5/core-utils/lumina-config/pages/page_wallpaper.cpp
@@ -73,7 +73,7 @@ void page_wallpaper::LoadSettings(int screennum){
else{ ui->radio_desk_single->setChecked(true); }
ui->spin_desk_min->setValue( settings.value(DPrefix+"background/minutesToChange", 5).toInt() );
desktimechanged(); //ensure the display gets updated (in case the radio selection did not change);
- QRect geom = QApplication::desktop()->screenGeometry(cScreen);
+ QRect geom = QGuiApplication::screens().at(cScreen)->availableGeometry();
ui->label_desk_res->setText( tr("Screen Resolution:")+"\n"+QString::number(geom.width())+"x"+QString::number(geom.height()) );
int tmp = ui->combo_desk_layout->findData(settings.value(DPrefix+"background/format","stretch"));
if(tmp>=0){ ui->combo_desk_layout->setCurrentIndex(tmp); }
diff --git a/src-qt5/core-utils/lumina-xconfig/MainUI.cpp b/src-qt5/core-utils/lumina-xconfig/MainUI.cpp
index cbec6443..9abc30b2 100644
--- a/src-qt5/core-utils/lumina-xconfig/MainUI.cpp
+++ b/src-qt5/core-utils/lumina-xconfig/MainUI.cpp
@@ -259,20 +259,19 @@ void MainUI::tileScreensY(bool activeonly){
while(overlap){
QRegion tmp(cur->pos().x(), newy, cur->width(), cur->height());
QRegion diff = tmp.subtracted(total);
- overlap = (diff.boundingRect()!=tmp.boundingRect() || diff.rects().length()>1);
+ overlap = (diff.boundingRect()!=tmp.boundingRect() || diff.rectCount()>1);
//qDebug() << "Check Y Overlap:" << newy << overlap << tmp.boundingRect() << diff.boundingRect();
if(overlap){
- QVector<QRect> rects = diff.rects();
QRect bound = diff.boundingRect();
//qDebug() << " - got Y overlap:" << bound << rects;
- if( bound.isNull() || rects.isEmpty() ){ newy+=cur->height(); }
+ if( bound.isNull() || diff.rectCount() == 0 ){ newy+=cur->height(); }
else{
int orig = newy;
newy = bound.top();
- for(int i=0; i<rects.length(); i++){
+ for( const QRect &rect : diff ){
//qDebug() << " - Check Rect:" << newy << rects[i] << cur->height();
- if(rects[i].height()==cur->height()){ continue; } //skip this one - just the same height
- if(rects[i].top()>newy || newy==bound.bottom()){ newy=rects[i].top(); }
+ if(rect.height()==cur->height()){ continue; } //skip this one - just the same height
+ if(rect.top()>newy || newy==bound.bottom()){ newy=rect.top(); }
}
if(orig==newy){ newy = bound.bottom()+1; } //make sure it always changes - no infinite loops!!
}
@@ -316,20 +315,19 @@ void MainUI::tileScreensX(bool activeonly){
while(overlap){
QRegion tmp(newx, cur->pos().y(), cur->width(), cur->height());
QRegion diff = tmp.subtracted(total);
- overlap = (diff.boundingRect()!=tmp.boundingRect() || diff.rects().length()>1);
+ overlap = (diff.boundingRect()!=tmp.boundingRect() || diff.rectCount()>1);
//qDebug() << "Check X Overlap:" << newx << overlap << total.rects() << tmp.boundingRect() << diff.boundingRect();
if(overlap){
- QVector<QRect> rects = diff.rects();
QRect bound = diff.boundingRect();
//qDebug() << " - got X overlap:" << bound << rects;
- if( bound.isNull() || rects.isEmpty() ){ newx+=cur->width(); }
+ if( bound.isNull() || diff.rectCount() == 0 ){ newx+=cur->width(); }
else{
int orig = newx;
newx = bound.left();
- for(int i=0; i<rects.length(); i++){
+ for( const QRect &rect : diff ) {
//qDebug() << " - Check Rect:" << newx << rects[i] << cur->width();
- if(rects[i].width()==cur->width()){ continue; } //skip this one - just the same width
- if(rects[i].left()>newx || newx==bound.right()){ newx=rects[i].left(); }
+ if(rect.width()==cur->width()){ continue; } //skip this one - just the same width
+ if(rect.left()>newx || newx==bound.right()){ newx=rect.left(); }
}
if(orig==newx){ newx = bound.right()+1; } //make sure it always changes - no infinite loops!!
}
diff --git a/src-qt5/core/libLumina/LDesktopUtils.cpp b/src-qt5/core/libLumina/LDesktopUtils.cpp
index eccba090..e47234d9 100644
--- a/src-qt5/core/libLumina/LDesktopUtils.cpp
+++ b/src-qt5/core/libLumina/LDesktopUtils.cpp
@@ -164,12 +164,14 @@ void LDesktopUtils::LoadSystemDefaults(bool skipOS){
//Find the number of the left-most desktop screen
QString screen = "0";
QRect screenGeom;
- QDesktopWidget *desk =QApplication::desktop();
- for(int i=0; i<desk->screenCount(); i++){
- if(desk->screenGeometry(i).x()==0){
- screen = QString::number(i);
- screenGeom = desk->screenGeometry(i);
- break;
+ QList<QScreen*> screens = QGuiApplication::screens();
+ QList<QScreen*>::const_iterator it;
+ int i = 0;
+ for(it = screens.constBegin(); it != screens.constEnd(); ++it, ++i) {
+ if((*it)->availableGeometry().x()==0) {
+ screen = i;
+ screenGeom = (*it)->availableGeometry();
+ break;
}
}
//Now setup the default "desktopsettings.conf" and "sessionsettings.conf" files
diff --git a/src-qt5/core/libLumina/LuminaX11.cpp b/src-qt5/core/libLumina/LuminaX11.cpp
index 563f035e..1df5a9f0 100644
--- a/src-qt5/core/libLumina/LuminaX11.cpp
+++ b/src-qt5/core/libLumina/LuminaX11.cpp
@@ -61,7 +61,7 @@ void LXCB::createWMAtoms(){
QList<xcb_intern_atom_reply_t*> reply;
for(int i=0; i<atoms.length(); i++){
reply << xcb_intern_atom_reply(QX11Info::connection(), \
- xcb_intern_atom(QX11Info::connection(), 0, atoms[i].length(), atoms[i].toLocal8Bit()), NULL);
+ xcb_intern_atom(QX11Info::connection(), 0, atoms[i].length(), atoms[i].toLocal8Bit()), NULL);
}
//Now evaluate all the requests and save the atoms
for(int i=0; i<reply.length(); i++){
@@ -135,16 +135,16 @@ WId LXCB::ActiveWindow(){
}
// === CheckDisableXinerama() ===
-bool LXCB::CheckDisableXinerama(){
+bool LXCB::CheckDisableXinerama(){
//returns true if Xinerama was initially set but now disabled
return false;
// TO-DO - not complete yet
/*xcb_query_extension_cookie_t cookie = xcb_query_extension_unchecked(QX11Info::connection(), 8, "Xinerama");
xcb_query_extension_reply_t *reply = xcb_query_extension_reply(QX11Info::connection(), cookie, NULL);
-
+
if(reply!=0){
-
+
free(reply);
}
*/
@@ -288,7 +288,7 @@ LXCB::WINDOWVISIBILITY LXCB::WindowState(WId win){
if(DEBUG){ qDebug() << "XCB: WindowState()"; }
if(win==0){ return IGNORE; }
xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_state_unchecked(&EWMH, win);
- if(cookie.sequence == 0){ return IGNORE; }
+ if(cookie.sequence == 0){ return IGNORE; }
xcb_ewmh_get_atoms_reply_t states;
WINDOWVISIBILITY cstate = IGNORE;
//First Check for special states (ATTENTION in particular);
@@ -321,7 +321,7 @@ LXCB::WINDOWVISIBILITY LXCB::WindowState(WId win){
if(attr!=0){
if(attr->map_state==XCB_MAP_STATE_VIEWABLE){ cstate = VISIBLE; }
else{ cstate = INVISIBLE; }
- free(attr);
+ free(attr);
}
}
return cstate;
@@ -333,7 +333,7 @@ QString LXCB::WindowVisibleIconName(WId win){ //_NET_WM_VISIBLE_ICON_NAME
if(win==0){ return ""; }
QString out;
xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_visible_icon_name_unchecked(&EWMH, win);
- if(cookie.sequence == 0){ return out; }
+ if(cookie.sequence == 0){ return out; }
xcb_ewmh_get_utf8_strings_reply_t data;
if( 1 == xcb_ewmh_get_wm_visible_icon_name_reply(&EWMH, cookie, &data, NULL) ){
out = QString::fromUtf8(data.strings, data.strings_len);
@@ -347,7 +347,7 @@ QString LXCB::WindowIconName(WId win){ //_NET_WM_ICON_NAME
if(win==0){ return ""; }
QString out;
xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_icon_name_unchecked(&EWMH, win);
- if(cookie.sequence == 0){ return out; }
+ if(cookie.sequence == 0){ return out; }
xcb_ewmh_get_utf8_strings_reply_t data;
if( 1 == xcb_ewmh_get_wm_icon_name_reply(&EWMH, cookie, &data, NULL) ){
out = QString::fromUtf8(data.strings, data.strings_len);
@@ -361,7 +361,7 @@ QString LXCB::WindowVisibleName(WId win){ //_NET_WM_VISIBLE_NAME
if(win==0){ return ""; }
QString out;
xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_visible_name_unchecked(&EWMH, win);
- if(cookie.sequence == 0){ return out; }
+ if(cookie.sequence == 0){ return out; }
xcb_ewmh_get_utf8_strings_reply_t data;
if( 1 == xcb_ewmh_get_wm_visible_name_reply(&EWMH, cookie, &data, NULL) ){
out = QString::fromUtf8(data.strings, data.strings_len);
@@ -375,7 +375,7 @@ QString LXCB::WindowName(WId win){ //_NET_WM_NAME
if(win==0){ return ""; }
QString out;
xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_name_unchecked(&EWMH, win);
- if(cookie.sequence == 0){ return out; }
+ if(cookie.sequence == 0){ return out; }
xcb_ewmh_get_utf8_strings_reply_t data;
if( 1 == xcb_ewmh_get_wm_name_reply(&EWMH, cookie, &data, NULL) ){
out = QString::fromUtf8(data.strings, data.strings_len);
@@ -395,7 +395,7 @@ QString LXCB::OldWindowName(WId win){ //WM_NAME (old standard)
return name;
}else{
return "";
- }
+ }
}
// === OldWindowIconName() ===
@@ -410,7 +410,7 @@ QString LXCB::OldWindowIconName(WId win){ //WM_ICON_NAME (old standard)
return name;
}else{
return "";
- }
+ }
}
// === WindowIsMaximized() ===
@@ -419,7 +419,7 @@ bool LXCB::WindowIsMaximized(WId win){
if(win==0){ return ""; }
//See if the _NET_WM_STATE_MAXIMIZED_[VERT/HORZ] flags are set on the window
xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_state_unchecked(&EWMH, win);
- if(cookie.sequence == 0){ return false; }
+ if(cookie.sequence == 0){ return false; }
xcb_ewmh_get_atoms_reply_t states;
if( 1 == xcb_ewmh_get_wm_state_reply(&EWMH, cookie, &states, NULL) ){
//Loop over the states
@@ -436,40 +436,42 @@ bool LXCB::WindowIsMaximized(WId win){
// === WindowIsFullscreen() ===
int LXCB::WindowIsFullscreen(WId win){
if(DEBUG){ qDebug() << "XCB: WindowIsFullscreen()"; }
- if(win==0){ return -1; }
+ if(win==0){ return -1; }
//bool fullS = false;
//See if the _NET_WM_STATE_FULLSCREEN flag is set on the window
/*xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_state_unchecked(&EWMH, win);
- if(cookie.sequence == 0){ return false; }
+ if(cookie.sequence == 0){ return false; }
xcb_ewmh_get_atoms_reply_t states;
if( 1 == xcb_ewmh_get_wm_state_reply(&EWMH, cookie, &states, NULL) ){
//Loop over the states
for(unsigned int i=0; i<states.atoms_len; i++){
if(states.atoms[i] == EWMH._NET_WM_STATE_FULLSCREEN){
- fullS = true;
+ fullS = true;
break;
}
}
}*/
//if(!fullS){
- //Fallback check for windows which are painted above everything else
+ //Fallback check for windows which are painted above everything else
// but don't have the FULLSCREEN flag set (even though they are technically full-screen)
int fscreen = -1;
//qDebug() << "FALLBACK FULLSCREEN CHECK:";
QRect geom = LXCB::WindowGeometry(win, false);
- QDesktopWidget *desk = QApplication::desktop();
- for(int i=0; i<desk->screenCount(); i++){
- QRect sgeom = desk->screenGeometry(i);
+ QList<QScreen*> screens = QGuiApplication::screens();
+ QList<QScreen*>::const_iterator it;
+ int i = 0;
+ for(it = screens.constBegin(); it != screens.constEnd(); ++it, ++i) {
+ QRect sgeom = (*it)->availableGeometry();
qDebug() << " -- Check Window Geom:" << sgeom << geom << this->WindowClass(win);
if( sgeom.contains(geom.center()) ){
- //Allow a 1 pixel variation in "full-screen" detection
- qDebug() << " -- Found Screen:" << i;
- if( geom.width() >= (sgeom.width()-1) && geom.height()>=(sgeom.height()-1) ){
- qDebug() << " -- Is Fullscreen!";
- //fullS = true;
- fscreen = i;
- }
- break; //found the screen which contains this window
+ //Allow a 1 pixel variation in "full-screen" detection
+ qDebug() << " -- Found Screen:" << i;
+ if( geom.width() >= (sgeom.width()-1) && geom.height()>=(sgeom.height()-1) ){
+ qDebug() << " -- Is Fullscreen!";
+ //fullS = true;
+ fscreen = i;
+ }
+ break; //found the screen which contains this window
}
}
//}
@@ -496,7 +498,7 @@ QIcon LXCB::WindowIcon(WId win){
QImage image(iter.width, iter.height, QImage::Format_ARGB32); //initial setup
uint* dat = iter.data;
//dat+=2; //remember the first 2 element offset
- for(int i=0; i<image.byteCount()/4; ++i, ++dat){
+ for(qsizetype i=0; i<image.sizeInBytes()/4; ++i, ++dat){
((uint*)image.bits())[i] = *dat;
}
icon.addPixmap(QPixmap::fromImage(image)); //layer this pixmap onto the icon
@@ -525,7 +527,7 @@ uint LXCB::GenerateDamageID(WId win){
//Now create/register the damage handler
xcb_damage_damage_t dmgID = xcb_generate_id(QX11Info::connection()); //This is a typedef for a 32-bit unsigned integer
xcb_damage_create(QX11Info::connection(), dmgID, win, XCB_DAMAGE_REPORT_LEVEL_RAW_RECTANGLES);
- return ( (uint) dmgID );
+ return ( (uint) dmgID );
}
// === paintRoot() ===
@@ -536,18 +538,18 @@ void LXCB::paintRoot(QRect area, const QPixmap *pix){
uint32_t values[1];
values[0] = screen->black_pixel;
- xcb_create_gc(QX11Info::connection(),
+ xcb_create_gc(QX11Info::connection(),
gc,
screen->root,
XCB_GC_BACKGROUND,
values );
//Convert the QPixmap to a xcb_drawable_t
- QImage qimage = pix->toImage().convertToFormat(QImage::Format_ARGB32);
+ QImage qimage = pix->toImage().convertToFormat(QImage::Format_ARGB32);
xcb_image_t *image = xcb_image_create(pix->width(), pix->height(), XCB_IMAGE_FORMAT_XY_PIXMAP,
- 32, qimage.depth(), 32, 32, XCB_IMAGE_ORDER_LSB_FIRST, XCB_IMAGE_ORDER_LSB_FIRST,
- 0, qimage.byteCount(), qimage.bits());
+ 32, qimage.depth(), 32, 32, XCB_IMAGE_ORDER_LSB_FIRST, XCB_IMAGE_ORDER_LSB_FIRST,
+ 0, qimage.sizeInBytes(), qimage.bits());
+
-
//Now paint on the root window
xcb_image_put(QX11Info::connection(),
screen->root, //where to put it
@@ -565,7 +567,7 @@ void LXCB::paintRoot(QRect area, const QPixmap *pix){
0, // y origin of picture
area.x(), //x origin of where to place it
area.y(), //y origin of where to place it
- area.width(),
+ area.width(),
area.height() );*/
//Apply the change right now
xcb_flush(QX11Info::connection());
@@ -589,8 +591,8 @@ void LXCB::SetAsSticky(WId win){
event.data.data32[4] = 0;
xcb_send_event(QX11Info::connection(), 0, QX11Info::appRootWindow(), XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *) &event);
-
- //This method changes the property on the window directly - the WM is not aware of it
+
+ //This method changes the property on the window directly - the WM is not aware of it
/*xcb_change_property( QX11Info::connection(), XCB_PROP_MODE_APPEND, win, EWMH._NET_WM_STATE, XCB_ATOM_ATOM, 32, 1, &(EWMH._NET_WM_STATE_STICKY) );
xcb_flush(QX11Info::connection()); //apply it right away*/
}
@@ -627,7 +629,7 @@ void LXCB::SetAsPanel(WId win){
xcb_intern_atom_reply_t *preply = xcb_intern_atom_reply(QX11Info::connection(), \
xcb_intern_atom(QX11Info::connection(), 0, 12, "WM_PROTOCOLS"), NULL);
xcb_intern_atom_reply_t *freply = xcb_intern_atom_reply(QX11Info::connection(), \
- xcb_intern_atom(QX11Info::connection(), 0, 13, "WM_TAKE_FOCUS"), NULL);
+ xcb_intern_atom(QX11Info::connection(), 0, 13, "WM_TAKE_FOCUS"), NULL);
bool gotatoms = false;
if(preply && freply){
WM_PROTOCOLS = preply->atom;
@@ -644,7 +646,7 @@ void LXCB::SetAsPanel(WId win){
if( 1 == xcb_icccm_get_wm_protocols_reply(QX11Info::connection(), \
xcb_icccm_get_wm_protocols_unchecked(QX11Info::connection(), win, WM_PROTOCOLS), \
&proto, NULL) ){
-
+
//Found the current protocols, see if it has the focus atom set
//remove the take focus atom and re-save them
bool needremove = false;
@@ -672,17 +674,17 @@ void LXCB::SetAsPanel(WId win){
} //end of gotatoms check
//Make sure it has the "dock" window type
// - get the current window types (Not necessary, only 1 type of window needed)
-
+
// - set the adjusted window type(s)
//qDebug() << " - Adjust window type";
- xcb_atom_t list[1];
+ xcb_atom_t list[1];
list[0] = EWMH._NET_WM_WINDOW_TYPE_DOCK;
xcb_ewmh_set_wm_window_type(&EWMH, win, 1, list);
-
+
//Make sure it is on all workspaces
//qDebug() << " - Set window as sticky";
SetAsSticky(win);
-
+
}
// === SetAsDesktop() ===
@@ -707,7 +709,7 @@ void LXCB::CloseWindow(WId win){
void LXCB::KillClient(WId win){
if(DEBUG){ qDebug() << "XCB: KillClient()"; }
if(win==0){ return; }
- //This will forcibly close the application which created WIN
+ //This will forcibly close the application which created WIN
xcb_kill_client(QX11Info::connection(), win);
}
@@ -719,7 +721,7 @@ void LXCB::MinimizeWindow(WId win){ //request that the window be unmapped/minimi
//Note: Fluxbox completely removes this window from the open list if unmapped manually
// xcb_unmap_window(QX11Info::connection(), win);
//xcb_flush(QX11Info::connection()); //make sure the command is sent out right away
-
+
//Need to send a client message event for the window so the WM picks it up
xcb_client_message_event_t event;
memset(&event, 0, sizeof(event));
@@ -741,9 +743,9 @@ void LXCB::ActivateWindow(WId win){ //request that the window become active
xcb_window_t actwin;
if(1 != xcb_ewmh_get_active_window_reply(&EWMH, cookie, &actwin, NULL) ){
actwin = 0;
- }
+ }
if(actwin == win){ return; } //requested window is already active
-
+
//Need to send a client message event for the window so the WM picks it up
xcb_client_message_event_t event;
event.response_type = XCB_CLIENT_MESSAGE;
@@ -757,7 +759,7 @@ void LXCB::ActivateWindow(WId win){ //request that the window become active
event.data.data32[4] = 0;
xcb_send_event(QX11Info::connection(), 0, QX11Info::appRootWindow(), XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *) &event);
-
+
}
// ===== RestoreWindow() =====
@@ -770,14 +772,14 @@ void LXCB::RestoreWindow(WId win){
// === MaximizeWindow() ===
void LXCB::MaximizeWindow(WId win, bool flagsonly){ //request that the window become maximized
if(DEBUG){ qDebug() << "XCB: MaximizeWindow()"; }
- if(win==0){ return; }
+ if(win==0){ return; }
if(flagsonly){
//Directly set the flags on the window (bypassing the WM)
xcb_atom_t list[2];
list[0] = EWMH._NET_WM_STATE_MAXIMIZED_VERT;
list[1] = EWMH._NET_WM_STATE_MAXIMIZED_HORZ;
xcb_ewmh_set_wm_state(&EWMH, win, 2, list);
-
+
}else{
//Need to send a client message event for the window so the WM picks it up
xcb_client_message_event_t event;
@@ -801,18 +803,18 @@ void LXCB::MoveResizeWindow(WId win, QRect geom){
if(win==0){ return; }
//NOTE: geom needs to be in root/absolute coordinates!
//qDebug() << "MoveResize Window:" << geom.x() << geom.y() << geom.width() << geom.height();
-
+
//Move the window
/*xcb_ewmh_request_moveresize_window(&EWMH, 0, win, XCB_GRAVITY_STATIC, XCB_EWMH_CLIENT_SOURCE_TYPE_OTHER, \
XCB_EWMH_MOVERESIZE_WINDOW_X | XCB_EWMH_MOVERESIZE_WINDOW_Y | XCB_MOVERESIZE_WINDOW_WIDTH | XCB_MOVERESIZE_WINDOW_HEIGHT, \
geom.x(), geom.y(), geom.width(), geom.height());*/
-
+
//Use the basic XCB functions instead of ewmh (Issues with combining the XCB_EWMH_MOVERESIZE _*flags)
uint32_t values[4];
values[0] = geom.x(); values[1] = geom.y();
values[2] = geom.width(); values[3] = geom.height();
xcb_configure_window(QX11Info::connection(), win, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, values);
-
+
}
// ===== ResizeWindow() =====
@@ -851,7 +853,7 @@ void LXCB::ReserveLocation(WId win, QRect geom, QString loc){
LOC.right_start_y = geom.y();
LOC.right_end_y = geom.y()+geom.height();
}
-
+
//Change the property
xcb_ewmh_set_wm_strut_partial(&EWMH, win, LOC); //_NET_WM_STRUT_PARTIAL (not always used)
xcb_ewmh_set_wm_strut(&EWMH, win, LOC.left, LOC.right, LOC.top, LOC.bottom); //_NET_WM_STRUT
@@ -864,7 +866,7 @@ void LXCB::ReserveLocation(WId win, QRect geom, QString loc){
//xcb_screen_t *root_screen = xcb_aux_get_screen(QX11Info::connection(), QX11Info::appScreen());
uint32_t val = XCB_GX_CLEAR;
xcb_gcontext_t graphic_context = xcb_generate_id(QX11Info::connection());
- xcb_create_gc(QX11Info::connection(), graphic_context, client, XCB_GC_BACKGROUND | XCB_GC_FOREGROUND, &val);
+ xcb_create_gc(QX11Info::connection(), graphic_context, client, XCB_GC_BACKGROUND | XCB_GC_FOREGROUND, &val);
//qDebug() << "Copy Background Area";
//Now copy the image onto the client background
xcb_copy_area(QX11Info::connection(),
@@ -890,16 +892,16 @@ uint LXCB::EmbedWindow(WId win, WId container){
//Initialize any atoms that will be needed
xcb_intern_atom_cookie_t ecookie = xcb_intern_atom_unchecked(QX11Info::connection(), 0, 7, "_XEMBED");
-
+
xcb_intern_atom_reply_t *ereply = xcb_intern_atom_reply(QX11Info::connection(), ecookie, NULL);
if(ereply==0){ return 0; } //unable to initialize the atom
xcb_atom_t emb = ereply->atom;
free(ereply); //done with this structure
-
+
//Reparent the window into the container
xcb_reparent_window(QX11Info::connection(), win, container, 0, 0);
xcb_map_window(QX11Info::connection(), win);
-
+
//Now send the embed event to the app
//qDebug() << " - send _XEMBED event";
xcb_client_message_event_t event;
@@ -907,30 +909,30 @@ uint LXCB::EmbedWindow(WId win, WId container){
event.format = 32;
event.window = win;
event.type = emb; //_XEMBED
- event.data.data32[0] = XCB_TIME_CURRENT_TIME; //CurrentTime;
+ event.data.data32[0] = XCB_TIME_CURRENT_TIME; //CurrentTime;
event.data.data32[1] = 0; //XEMBED_EMBEDDED_NOTIFY
event.data.data32[2] = 0;
event.data.data32[3] = container; //WID of the container
event.data.data32[4] = 0;
xcb_send_event(QX11Info::connection(), 0, win, XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *) &event);
-
+
//Now setup any redirects and return
this->SelectInput(win, true); //Notify of structure changes
xcb_composite_redirect_window(QX11Info::connection(), win, XCB_COMPOSITE_REDIRECT_MANUAL); //XCB_COMPOSITE_REDIRECT_[MANUAL/AUTOMATIC]);
//Now map the window (will be a transparent child of the container)
xcb_map_window(QX11Info::connection(), win);
-
+
//Now create/register the damage handler
// -- XCB (Note: The XCB damage registration is completely broken at the moment - 9/15/15, Ken Moore)
//xcb_damage_damage_t dmgID = xcb_generate_id(QX11Info::connection()); //This is a typedef for a 32-bit unsigned integer
//xcb_damage_create(QX11Info::connection(), dmgID, win, XCB_DAMAGE_REPORT_LEVEL_RAW_RECTANGLES);
// -- XLib (Note: This is only used because the XCB routine above does not work - needs to be fixed upstream in XCB itself).
Damage dmgID = XDamageCreate(QX11Info::display(), win, XDamageReportRawRectangles);
-
+
//qDebug() << " - Done";
- return ( (uint) dmgID );
+ return ( (uint) dmgID );
}
// === Unembed Window() ===
@@ -938,29 +940,29 @@ bool LXCB::UnembedWindow(WId win){
if(DEBUG){ qDebug() << "XCB: UnembedWindow()"; }
if(win==0){ return false; }
//Remove redirects
- uint32_t val[] = {XCB_EVENT_MASK_NO_EVENT};
+ uint32_t val[] = {XCB_EVENT_MASK_NO_EVENT};
xcb_change_window_attributes(QX11Info::connection(), win, XCB_CW_EVENT_MASK, val);
//Make sure it is invisible
xcb_unmap_window(QX11Info::connection(), win);
//Reparent the window back to the root window
xcb_reparent_window(QX11Info::connection(), win, QX11Info::appRootWindow(), 0, 0);
- return true;
+ return true;
}
// === TrayImage() ===
QPixmap LXCB::TrayImage(WId win){
QPixmap pix;
-
+
//Get the current QScreen (for XCB->Qt conversion)
QList<QScreen*> scrnlist = QApplication::screens();
- if(scrnlist.isEmpty()){ return pix; }
+ if(scrnlist.isEmpty()){ return pix; }
//Try to grab the given window directly with Qt
if(pix.isNull()){
pix = scrnlist[0]->grabWindow(win);
}
return pix;
-
+
//NOTE: Code below here saved for reference later (as necessary)
// -------------------------------
/*//First get the pixmap from the XCB compositing layer (since the tray images are redirected there)
@@ -970,7 +972,7 @@ QPixmap LXCB::TrayImage(WId win){
xcb_get_geometry_cookie_t Gcookie = xcb_get_geometry_unchecked(QX11Info::connection(), pixmap);
xcb_get_geometry_reply_t *Greply = xcb_get_geometry_reply(QX11Info::connection(), Gcookie, NULL);
if(Greply==0){ qDebug() << "[Tray Image] - Geom Fetch Error:"; return QPixmap(); } //Error in geometry detection
-
+
//Now convert the XCB pixmap into an XCB image
xcb_get_image_cookie_t GIcookie = xcb_get_image_unchecked(QX11Info::connection(), XCB_IMAGE_FORMAT_Z_PIXMAP, pixmap, 0, 0, Greply->width, Greply->height, 0xffffffff);
xcb_get_image_reply_t *GIreply = xcb_get_image_reply(QX11Info::connection(), GIcookie, NULL);
@@ -979,11 +981,11 @@ QPixmap LXCB::TrayImage(WId win){
uint32_t BPL = xcb_get_image_data_length(GIreply) / Greply->height; //bytes per line
//Now convert the XCB image into a Qt Image
QImage image(const_cast<uint8_t *>(GIdata), Greply->width, Greply->height, BPL, QImage::Format_ARGB32_Premultiplied);
- //Free the various data structures
+ //Free the various data structures
free(GIreply); //done with get image reply
xcb_free_pixmap(QX11Info::connection(), pixmap); //done with the raw pixmap
free(Greply); //done with geom reply*/
-
+
/* NOTE: Found these little bit in the Qt sources - not sure if it is needed, but keep it here for reference
// we may have to swap the byte order based on system type
uint8_t image_byte_order = connection->setup()->image_byte_order;
@@ -1018,27 +1020,27 @@ QPixmap LXCB::TrayImage(WId win){
WId LXCB::startSystemTray(int screen){
qDebug() << "Starting System Tray:" << screen;
//Setup the freedesktop standards compliance
-
+
//Get the appropriate atom for this screen
QString str = QString("_NET_SYSTEM_TRAY_S%1").arg(QString::number(screen));
//qDebug() << "Default Screen Atom Name:" << str;
xcb_intern_atom_reply_t *treply = xcb_intern_atom_reply(QX11Info::connection(), \
xcb_intern_atom(QX11Info::connection(), 0, str.length(), str.toLocal8Bit()), NULL);
xcb_intern_atom_reply_t *oreply = xcb_intern_atom_reply(QX11Info::connection(), \
- xcb_intern_atom(QX11Info::connection(), 0, 28, "_NET_SYSTEM_TRAY_ORIENTATION"), NULL);
+ xcb_intern_atom(QX11Info::connection(), 0, 28, "_NET_SYSTEM_TRAY_ORIENTATION"), NULL);
xcb_intern_atom_reply_t *vreply = xcb_intern_atom_reply(QX11Info::connection(), \
- xcb_intern_atom(QX11Info::connection(), 0, 23, "_NET_SYSTEM_TRAY_VISUAL"), NULL);
+ xcb_intern_atom(QX11Info::connection(), 0, 23, "_NET_SYSTEM_TRAY_VISUAL"), NULL);
if(treply==0){
qDebug() << " - ERROR: Could not initialize _NET_SYSTEM_TRAY_S<num> atom";
return 0;
}
if(oreply==0){
qDebug() << " - ERROR: Could not initialize _NET_SYSTEM_TRAY_ORIENTATION atom";
- return 0;
+ return 0;
}
if(vreply==0){
qDebug() << " - ERROR: Could not initialize _NET_SYSTEM_TRAY_VISUAL atom";
- return 0;
+ return 0;
}
xcb_atom_t _NET_SYSTEM_TRAY_S = treply->atom;
xcb_atom_t _NET_SYSTEM_TRAY_ORIENTATION = oreply->atom;
@@ -1046,7 +1048,7 @@ WId LXCB::startSystemTray(int screen){
free(treply); //done with atom generation
free(oreply);
free(vreply);
-
+
//Make sure that there is no other system tray running
xcb_get_selection_owner_reply_t *ownreply = xcb_get_selection_owner_reply(QX11Info::connection(), \
xcb_get_selection_owner_unchecked(QX11Info::connection(), _NET_SYSTEM_TRAY_S), NULL);
@@ -1060,7 +1062,7 @@ WId LXCB::startSystemTray(int screen){
return 0;
}
free(ownreply);
-
+
//Create a simple window to register as the tray (not visible - just off the screen)
xcb_screen_t *root_screen = xcb_aux_get_screen(QX11Info::connection(), QX11Info::appScreen());
uint32_t params[] = {1};
@@ -1069,13 +1071,13 @@ WId LXCB::startSystemTray(int screen){
LuminaSessionTrayID, root_screen->root, -1, -1, 1, 1, 0, \
XCB_WINDOW_CLASS_INPUT_OUTPUT, root_screen->root_visual, \
XCB_CW_OVERRIDE_REDIRECT, params);
-
+
//Now register this widget as the system tray
xcb_set_selection_owner(QX11Info::connection(), LuminaSessionTrayID, _NET_SYSTEM_TRAY_S, XCB_CURRENT_TIME);
//Make sure that it was registered properly
ownreply = xcb_get_selection_owner_reply(QX11Info::connection(), \
xcb_get_selection_owner_unchecked(QX11Info::connection(), _NET_SYSTEM_TRAY_S), NULL);
-
+
if(ownreply==0 || ownreply->owner != LuminaSessionTrayID){
if(ownreply!=0){ free(ownreply); }
qWarning() << " - Could not register the system tray";
@@ -1083,7 +1085,7 @@ WId LXCB::startSystemTray(int screen){
return 0;
}
free(ownreply); //done with structure
-
+
//Now register the orientation of the system tray
uint32_t orient = _NET_SYSTEM_TRAY_ORIENTATION_HORZ;
xcb_change_property(QX11Info::connection(), XCB_PROP_MODE_REPLACE, LuminaSessionTrayID, \
@@ -1093,25 +1095,25 @@ WId LXCB::startSystemTray(int screen){
xcb_visualtype_t *type = xcb_aux_find_visual_by_attrs(root_screen, XCB_VISUAL_CLASS_TRUE_COLOR, 32);
if(type!=0){
xcb_change_property(QX11Info::connection(), XCB_PROP_MODE_REPLACE, LuminaSessionTrayID, \
- _NET_SYSTEM_TRAY_VISUAL, XCB_ATOM_VISUALID, 32, 1, &type->visual_id);
+ _NET_SYSTEM_TRAY_VISUAL, XCB_ATOM_VISUALID, 32, 1, &type->visual_id);
}else{
qWarning() << " - Could not set TrueColor visual for system tray";
}
-
+
//Finally, send out an X event letting others know that the system tray is up and running
xcb_client_message_event_t event;
event.response_type = XCB_CLIENT_MESSAGE;
event.format = 32;
event.window = root_screen->root;
event.type = EWMH.MANAGER; //MANAGER atom
- event.data.data32[0] = XCB_TIME_CURRENT_TIME; //CurrentTime;
+ event.data.data32[0] = XCB_TIME_CURRENT_TIME; //CurrentTime;
event.data.data32[1] = _NET_SYSTEM_TRAY_S; //_NET_SYSTEM_TRAY_S atom
event.data.data32[2] = LuminaSessionTrayID;
event.data.data32[3] = 0;
event.data.data32[4] = 0;
xcb_send_event(QX11Info::connection(), 0, root_screen->root, XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *) &event);
-
+
//Success
return LuminaSessionTrayID;
}
@@ -1161,7 +1163,7 @@ void LXCB::WM_CloseWindow(WId win, bool force){
event.format = 32;
event.window = win;
event.type = ATOMS[atoms.indexOf("WM_PROTOCOLS")];
- event.data.data32[0] = ATOMS[atoms.indexOf("WM_DELETE_WINDOW")];
+ event.data.data32[0] = ATOMS[atoms.indexOf("WM_DELETE_WINDOW")];
event.data.data32[1] = XCB_TIME_CURRENT_TIME; //CurrentTime;
event.data.data32[2] = 0;
event.data.data32[3] = 0;
@@ -1189,7 +1191,7 @@ QList<WId> LXCB::WM_RootWindows(){
if(reply!=0){
int num = xcb_query_tree_children_length(reply);
xcb_window_t *children = xcb_query_tree_children(reply);
- for(int i=0; i<num; i++){
+ for(int i=0; i<num; i++){
if(!out.contains(children[i])){ out << children[i]; }
}
free(reply);
@@ -1219,11 +1221,11 @@ bool LXCB::WM_ManageWindow(WId win, bool needsmap){
xcb_get_window_attributes_reply_t *attr = xcb_get_window_attributes_reply(QX11Info::connection(), cookie, NULL);
if(attr == 0){ return false; } //could not get attributes of window
if(attr->override_redirect){ free(attr); return false; } //window has override redirect set (do not manage)
- if(!needsmap && attr->map_state != XCB_MAP_STATE_VIEWABLE){
+ if(!needsmap && attr->map_state != XCB_MAP_STATE_VIEWABLE){
//window is never supposed to be visible (lots of these)
//if( !WM_ICCCM_GetClass(win).contains("xterm") ){ //Some windows mis-set this flag
qDebug() << " - Not Viewable.." << WM_ICCCM_GetClass(win);
- free(attr); return false;
+ free(attr); return false;
//}
}
//Setup event handling on the window
@@ -1233,9 +1235,9 @@ bool LXCB::WM_ManageWindow(WId win, bool needsmap){
//Could not change event mask - did the window get deleted already?
free(attr);
qDebug() << " - Could not change event mask";
- return false;
+ return false;
}
-
+
return true;
}
@@ -1261,7 +1263,7 @@ void LXCB::setupEventsForFrame(WId frame){
XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | \
XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | \
XCB_EVENT_MASK_ENTER_WINDOW)
-
+
uint32_t value_list[1] = {FRAME_WIN_EVENT_MASK};
xcb_change_window_attributes(QX11Info::connection(), frame, XCB_CW_EVENT_MASK, value_list);
}
@@ -1276,10 +1278,10 @@ bool LXCB::setupEventsForRoot(WId root){
XCB_EVENT_MASK_PROPERTY_CHANGE | \
XCB_EVENT_MASK_FOCUS_CHANGE | \
XCB_EVENT_MASK_ENTER_WINDOW)
-
+
if(root==0){ root = QX11Info::appRootWindow(); }
uint32_t value_list[1] = {ROOT_WIN_EVENT_MASK};
- xcb_generic_error_t *status = xcb_request_check( QX11Info::connection(), xcb_change_window_attributes_checked(QX11Info::connection(), root, XCB_CW_EVENT_MASK, value_list));
+ xcb_generic_error_t *status = xcb_request_check( QX11Info::connection(), xcb_change_window_attributes_checked(QX11Info::connection(), root, XCB_CW_EVENT_MASK, value_list));
return (status==0);
}
// --------------------------------------------------
@@ -1406,7 +1408,7 @@ icccm_size_hints LXCB::WM_ICCCM_GetNormalHints(WId win){
if( (reply.flags&XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY)==XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY ){ hints.win_gravity=reply.win_gravity; }
//free(reply);
}
- return hints;
+ return hints;
}
/*void LXCB::WM_ICCCM_SetNormalHints(WId win, icccm_size_hints hints){
@@ -1414,12 +1416,12 @@ icccm_size_hints LXCB::WM_ICCCM_GetNormalHints(WId win){
xcb_size_hints_t xhints;
if(hints.x>=0 || hints.y>=0){ xcb_icccm_size_hints_set_position(&xhints, 1, hints.x, hints.y); }
//if(hints.width>=0
-
+
xcb_icccm_set_wm_normal_hints(QX11Info::connection(), win, &xhints);
}*/
// -- WM_HINTS
-
+
// -- WM_PROTOCOLS
LXCB::ICCCM_PROTOCOLS LXCB::WM_ICCCM_GetProtocols(WId win){
if(atoms.isEmpty()){ createWMAtoms(); }
@@ -1432,7 +1434,7 @@ LXCB::ICCCM_PROTOCOLS LXCB::WM_ICCCM_GetProtocols(WId win){
else if(reply.atoms[i]==ATOMS[atoms.indexOf("WM_DELETE_WINDOW")]){ flags = flags | DELETE_WINDOW; }
}
}
- return flags;
+ return flags;
}
void LXCB::WM_ICCCM_SetProtocols(WId win, LXCB::ICCCM_PROTOCOLS flags){
@@ -1457,7 +1459,7 @@ void LXCB::WM_ICCCM_SetProtocols(WId win, LXCB::ICCCM_PROTOCOLS flags){
list = new xcb_atom_t[0];
}
xcb_icccm_set_wm_protocols(QX11Info::connection(), win, EWMH.WM_PROTOCOLS, num, list);
-
+
}
// --------------------------------------------------------
@@ -1466,13 +1468,13 @@ void LXCB::WM_ICCCM_SetProtocols(WId win, LXCB::ICCCM_PROTOCOLS flags){
// _NET_SUPPORTED (Root)
void LXCB::WM_Set_Root_Supported(){
//NET_WM standards (ICCCM implied - no standard way to list those)
- xcb_atom_t list[] = {EWMH._NET_WM_NAME,
- EWMH._NET_WM_ICON,
+ xcb_atom_t list[] = {EWMH._NET_WM_NAME,
+ EWMH._NET_WM_ICON,
EWMH._NET_WM_ICON_NAME,
EWMH._NET_WM_DESKTOP,
/*_NET_WINDOW_TYPE (and all the various types)*/
- EWMH._NET_WM_WINDOW_TYPE, EWMH._NET_WM_WINDOW_TYPE_DESKTOP, EWMH._NET_WM_WINDOW_TYPE_DOCK,
- EWMH._NET_WM_WINDOW_TYPE_TOOLBAR, EWMH._NET_WM_WINDOW_TYPE_MENU, EWMH._NET_WM_WINDOW_TYPE_UTILITY,
+ EWMH._NET_WM_WINDOW_TYPE, EWMH._NET_WM_WINDOW_TYPE_DESKTOP, EWMH._NET_WM_WINDOW_TYPE_DOCK,
+ EWMH._NET_WM_WINDOW_TYPE_TOOLBAR, EWMH._NET_WM_WINDOW_TYPE_MENU, EWMH._NET_WM_WINDOW_TYPE_UTILITY,
EWMH._NET_WM_WINDOW_TYPE_SPLASH, EWMH._NET_WM_WINDOW_TYPE_DIALOG, EWMH._NET_WM_WINDOW_TYPE_NORMAL,
EWMH._NET_WM_WINDOW_TYPE_DROPDOWN_MENU, EWMH._NET_WM_WINDOW_TYPE_POPUP_MENU, EWMH._NET_WM_WINDOW_TYPE_TOOLTIP,
EWMH._NET_WM_WINDOW_TYPE_NOTIFICATION, EWMH._NET_WM_WINDOW_TYPE_COMBO, EWMH._NET_WM_WINDOW_TYPE_DND,
@@ -1624,7 +1626,7 @@ void LXCB::WM_Set_Active_Window(WId win){
event.format = 32;
event.window = win;
event.type = ATOMS[atoms.indexOf("WM_PROTOCOLS")];
- event.data.data32[0] = ATOMS[atoms.indexOf("WM_TAKE_FOCUS")];
+ event.data.data32[0] = ATOMS[atoms.indexOf("WM_TAKE_FOCUS")];
event.data.data32[1] = XCB_TIME_CURRENT_TIME; //CurrentTime;
event.data.data32[2] = 0;
event.data.data32[3] = 0;
@@ -1709,7 +1711,7 @@ bool LXCB::WM_Get_Showing_Desktop(){
void LXCB::WM_Set_Showing_Desktop(bool show){
xcb_ewmh_set_showing_desktop(&EWMH, QX11Info::appScreen(), (show ? 1 : 0) );
}
-
+
// -- ROOT WINDOW MESSAGES/REQUESTS
// _NET_CLOSE_WINDOW
void LXCB::WM_Request_Close_Window(WId win){
@@ -1725,7 +1727,7 @@ void LXCB::WM_Request_MoveResize_Window(WId win, QRect geom, bool fromuser, LXC
if(flags.testFlag(LXCB::Y)){ eflags = eflags | XCB_EWMH_MOVERESIZE_WINDOW_Y; }
if(flags.testFlag(LXCB::WIDTH)){ eflags = eflags | XCB_EWMH_MOVERESIZE_WINDOW_WIDTH; }
if(flags.testFlag(LXCB::HEIGHT)){ eflags = eflags | XCB_EWMH_MOVERESIZE_WINDOW_HEIGHT; }
-
+
xcb_ewmh_request_moveresize_window(&EWMH, QX11Info::appScreen(), win, (xcb_gravity_t) grav, \
(fromuser ? XCB_EWMH_CLIENT_SOURCE_TYPE_OTHER : XCB_EWMH_CLIENT_SOURCE_TYPE_NORMAL), \
(xcb_ewmh_moveresize_window_opt_flags_t) eflags, geom.x(), geom.y(), geom.width(), geom.height() );
@@ -1744,7 +1746,7 @@ void LXCB::WM_Request_Restack_Window(WId win, WId sibling, LXCB::STACK_FLAG flag
void LXCB::WM_Request_Frame_Extents(WId win){
xcb_ewmh_request_frame_extents(&EWMH, QX11Info::appScreen(), win);
}
-
+
// === WINDOW PROPERTIES ===
// _NET_SUPPORTED (Window)
void LXCB::WM_Set_Window_Supported(WId win){
@@ -1766,7 +1768,7 @@ QString LXCB::WM_Get_Name(WId win){
void LXCB::WM_Set_Name(WId win, QString txt){
xcb_ewmh_set_wm_name(&EWMH, win, txt.length(), txt.toUtf8().data());
}
-
+
// _NET_WM_VISIBLE_NAME
QString LXCB::WM_Get_Visible_Name(WId win){
xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_visible_name_unchecked(&EWMH, win);
@@ -1775,12 +1777,12 @@ QString LXCB::WM_Get_Visible_Name(WId win){
if(1==xcb_ewmh_get_wm_visible_name_reply(&EWMH, cookie,&reply, NULL) ){
out = QString::fromUtf8(reply.strings);
}
- return out;
+ return out;
}
void LXCB::WM_Set_Visible_Name(WId win, QString txt){
xcb_ewmh_set_wm_visible_name(&EWMH, win, txt.length(), txt.toUtf8().data());
}
-
+
// _NET_WM_ICON_NAME
QString LXCB::WM_Get_Icon_Name(WId win){
xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_icon_name_unchecked(&EWMH, win);
@@ -1794,7 +1796,7 @@ QString LXCB::WM_Get_Icon_Name(WId win){
void LXCB::WM_Set_Icon_Name(WId win, QString txt){
xcb_ewmh_set_wm_icon_name(&EWMH, win, txt.length(), txt.toUtf8().data());
}
-
+
// _NET_WM_VISIBLE_ICON_NAME
QString LXCB::WM_Get_Visible_Icon_Name(WId win){
xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_visible_icon_name_unchecked(&EWMH, win);
@@ -1806,9 +1808,9 @@ QString LXCB::WM_Get_Visible_Icon_Name(WId win){
return out;
}
void LXCB::WM_Set_Visible_Icon_Name(WId win, QString txt){
- xcb_ewmh_set_wm_visible_icon_name(&EWMH, win, txt.length(), txt.toUtf8().data());
+ xcb_ewmh_set_wm_visible_icon_name(&EWMH, win, txt.length(), txt.toUtf8().data());
}
-
+
// _NET_WM_DESKTOP
int LXCB::WM_Get_Desktop(WId win){
//returns -1 if window on all desktops
@@ -1957,7 +1959,7 @@ void LXCB::WM_Set_Window_States(WId win, QList<LXCB::WINDOWSTATE> list){
}
}
//Now set the property
- xcb_ewmh_set_wm_state(&EWMH, win, list.length(), array);
+ xcb_ewmh_set_wm_state(&EWMH, win, list.length(), array);
}
// _NET_WM_ALLOWED_ACTIONS
@@ -1981,7 +1983,7 @@ QList<LXCB::WINDOWACTION> LXCB::WM_Get_Window_Actions(WId win){
else if(reply.atoms[i]==EWMH._NET_WM_ACTION_BELOW){ out << LXCB::A_BELOW; }
}
}
- return out;
+ return out;
}
void LXCB::WM_Set_Window_Actions(WId win, QList<LXCB::WINDOWACTION> list){
@@ -2184,9 +2186,9 @@ void LXCB::WM_Set_Frame_Extents(WId win, QList<unsigned int> margins){
}
// _NET_WM_OPAQUE_REGION
-
+
// _NET_WM_BYPASS_COMPOSITOR
-
+
// === SPECIAL WM PROTOCOLS (EWMH) ===
// _NET_WM_PING
void LXCB::WM_Send_Ping(WId win){
@@ -2202,7 +2204,7 @@ uint64_t LXCB::WM_Get_Sync_Request_Counter(WId win){
}
/*void LXCB::WM_Set_Sync_Request_Counter(WId win, uint64_t count){
-
+
}*/
// _NET_WM_FULLSCREEN_MONITORS
diff --git a/src-qt5/core/libLumina/obsolete/RootSubWindow.cpp b/src-qt5/core/libLumina/obsolete/RootSubWindow.cpp
index 5040f2f9..dfc26516 100644
--- a/src-qt5/core/libLumina/obsolete/RootSubWindow.cpp
+++ b/src-qt5/core/libLumina/obsolete/RootSubWindow.cpp
@@ -417,7 +417,7 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList
if(vals[i].toSize().isValid()){
//Just larger than titlebar, with enough space for 8 characters in the titlebar (+4 buttons)
//qDebug() << "Got invalid Min Size: Set a reasonable default minimum";
- WinWidget->setMinimumSize( QSize( this->fontMetrics().height()*4 + this->fontMetrics().width("O")*10, this->fontMetrics().height()*10) );
+ WinWidget->setMinimumSize( QSize( this->fontMetrics().height()*4 + this->fontMetrics().horizontalAdvance("O")*10, this->fontMetrics().height()*10) );
WIN->setProperty(NativeWindow::MinSize, WinWidget->minimumSize());
}else{
WinWidget->setMinimumSize(vals[i].toSize());
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h
index 95b6c1cb..6a33605c 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/plugins/ClockPlugin.h
@@ -33,8 +33,8 @@ private slots:
//Note: This is horribly inefficient, but due to the inherently short length of textL it is acceptable
int min = -1; int index = -1;
for(int i=1; i<textL.length(); i++){
- int combined = button->fontMetrics().width(textL[i-1]+" "+textL[i]);
- int tmp = button->fontMetrics().width(textL[i]);
+ int combined = button->fontMetrics().horizontalAdvance(textL[i-1]+" "+textL[i]);
+ int tmp = button->fontMetrics().horizontalAdvance(textL[i]);
if( max>combined && (min<0 || tmp<min)){ min = tmp; index = i; }
}
if(index>0){ textL[index-1] = textL[index-1]+" "+textL[index]; textL.removeAt(index); }
@@ -43,7 +43,7 @@ private slots:
//Need to get a lot more complicated - need to break up sections mid-word based on widget width
// NOT WORKING - can cause infinite loop somehow (perhaps max is 0 on init?)
/*for(int i=0; i<textL.length(); i++){
- int tmp = button->fontMetrics().width(textL[i]);
+ int tmp = button->fontMetrics().horizontalAdvance(textL[i]);
if(tmp>max){
//qDebug() << "CLOCK:" << i << tmp << max << textL[i];
QString tmps = button->fontMetrics().elidedText(textL[i], Qt::ElideRight, max).section("...",0,-2); //remove the three dots at end
diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Text.h b/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Text.h
index 6ba18b22..bdde5ba2 100644
--- a/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Text.h
+++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/Text.h
@@ -50,7 +50,7 @@ public:
text->setFont(QFont("Courier", 24, QFont::Bold));
text->setText(display);
QFontMetrics metrics(text->font());
- text->setMinimumSize(QSize( metrics.width(text->text())+10, metrics.height()*text->text().count("\n") +10));
+ text->setMinimumSize(QSize( metrics.horizontalAdvance(text->text())+10, metrics.height()*text->text().count("\n") +10));
movement = new QPropertyAnimation(text);
movement->setPropertyName("pos");
diff --git a/src-qt5/core/lumina-desktop/BootSplash.cpp b/src-qt5/core/lumina-desktop/BootSplash.cpp
index cdf1a3c2..f3befeaf 100644
--- a/src-qt5/core/lumina-desktop/BootSplash.cpp
+++ b/src-qt5/core/lumina-desktop/BootSplash.cpp
@@ -11,7 +11,7 @@ BootSplash::BootSplash() : QWidget(0, Qt::SplashScreen | Qt::X11BypassWindowMana
this->setMinimumWidth( this->minimumHeight() * 1.5);
this->setObjectName("LuminaBootSplash"); //for theme styling
//Center the window on the primary screen
- QPoint ctr = QApplication::desktop()->screenGeometry().center();
+ QPoint ctr = QGuiApplication::primaryScreen()->geometry().center();
this->move( ctr.x()-(this->width()/2), ctr.y()-(this->height()/2) );
generateTipOfTheDay();
ui->label_version->setText( QString(tr("Version %1")).arg(LDesktopUtils::LuminaDesktopVersion()) );
diff --git a/src-qt5/core/lumina-desktop/Globals.h b/src-qt5/core/lumina-desktop/Globals.h
index 43ea3a87..f7821466 100644
--- a/src-qt5/core/lumina-desktop/Globals.h
+++ b/src-qt5/core/lumina-desktop/Globals.h
@@ -41,7 +41,7 @@ public:
char name[BUFSIZ];
int count = gethostname(name,sizeof(name));
if (count < 0) {
- return QString::null;
+ return QString();
}
return QString::fromLocal8Bit(name,count);
}
diff --git a/src-qt5/core/lumina-desktop/LDesktop.cpp b/src-qt5/core/lumina-desktop/LDesktop.cpp
index e4706498..d4650433 100644
--- a/src-qt5/core/lumina-desktop/LDesktop.cpp
+++ b/src-qt5/core/lumina-desktop/LDesktop.cpp
@@ -208,7 +208,7 @@ void LDesktop::InitDesktop(){
checkResolution(); //Adjust the desktop config file first (if necessary)
if(DEBUG){ qDebug() << "Init Desktop:" << Screen(); }
//connect(desktop, SIGNAL(resized(int)), this, SLOT(UpdateGeometry(int)));
- if(DEBUG){ qDebug() << "Desktop #"<<Screen()<<" -> "<< LSession::desktop()->screenGeometry(Screen()) << LSession::handle()->screenGeom(Screen()); }
+ if(DEBUG){ qDebug() << "Desktop #"<<Screen()<<" -> "<< QGuiApplication::screens().at(Screen())->availableGeometry() << LSession::handle()->screenGeom(Screen()); }
deskMenu = new QMenu(0);
connect(deskMenu, SIGNAL(triggered(QAction*)), this, SLOT(SystemApplication(QAction*)) );
winMenu = new QMenu(0);
@@ -241,7 +241,7 @@ void LDesktop::InitDesktop(){
if(DEBUG){ qDebug() << "Create bgDesktop"; }
bgDesktop = new LDesktopPluginSpace();
int grid = settings->value(DPREFIX+"GridSize",-1).toInt();
- if(grid<0 && LSession::desktop()->screenGeometry(Screen()).height() > 2000){ grid = 200; }
+ if(grid<0 && QGuiApplication::screens().at(Screen())->availableGeometry().height() > 2000){ grid = 200; }
else if(grid<0){ grid = 100; }
bgDesktop->SetIconSize( grid );
bgDesktop->setContextMenuPolicy(Qt::CustomContextMenu);
@@ -423,7 +423,7 @@ void LDesktop::RemoveDeskPlugin(QString ID){
void LDesktop::IncreaseDesktopPluginIcons(){
int cur = settings->value(DPREFIX+"GridSize",-1).toInt();
- if(cur<0 &&LSession::desktop()->screenGeometry(Screen()).height() > 2000){ cur = 200; }
+ if(cur<0 && QGuiApplication::screens().at(Screen())->availableGeometry().height() > 2000){ cur = 200; }
else if(cur<0){ cur = 100; }
cur+=16;
issyncing=true; //don't let the change cause a refresh
@@ -435,7 +435,7 @@ void LDesktop::IncreaseDesktopPluginIcons(){
void LDesktop::DecreaseDesktopPluginIcons(){
int cur = settings->value(DPREFIX+"GridSize",-1).toInt();
- if(cur<0 &&LSession::desktop()->screenGeometry(Screen()).height() > 2000){ cur = 200; }
+ if(cur<0 && QGuiApplication::screens().at(Screen())->availableGeometry().height() > 2000){ cur = 200; }
else if(cur<0){ cur = 100; }
if(cur<32){ return; } //cannot get smaller than 16x16
cur-=16;
@@ -483,7 +483,7 @@ void LDesktop::UpdatePanels(){
}
void LDesktop::UpdateDesktopPluginArea(){
- QRegion visReg(LSession::desktop()->screenGeometry(Screen()) ); //visible region (not hidden behind a panel)
+ QRegion visReg(QGuiApplication::screens().at(Screen())->availableGeometry() ); //visible region (not hidden behind a panel)
QRect rawRect = visReg.boundingRect(); //initial value (screen size)
//qDebug() << "Update Desktop Plugin Area:" << bgWindow->geometry();
for(int i=0; i<PANELS.length(); i++){
@@ -514,11 +514,12 @@ void LDesktop::UpdateDesktopPluginArea(){
//LSession::handle()->XCB->SetScreenWorkArea((unsigned int) Screen(), rec);
//Now remove the X offset to place it on the current screen (needs widget-coords, not global)
globalWorkRect = rec; //save this for later
- rec.moveTopLeft( QPoint( rec.x()-LSession::desktop()->screenGeometry(Screen()).x() , rec.y()-LSession::desktop()->screenGeometry(Screen()).y() ) );
+ rec.moveTopLeft( QPoint( rec.x()-QGuiApplication::screens().at(Screen())->availableGeometry().x() , rec.y()-QGuiApplication::screens().at(Screen())->availableGeometry().y() ) );
//qDebug() << "DPlug Area:" << rec << bgDesktop->geometry() << LSession::handle()->desktop()->availableGeometry(bgDesktop);
if(rec.size().isNull() ){ return; } //|| rec == bgDesktop->geometry()){return; } //nothing changed
//bgDesktop->show(); //make sure Fluxbox is aware of it *before* we start moving it
- bgDesktop->setGeometry( LSession::desktop()->screenGeometry(Screen()));
+
+ bgDesktop->setGeometry( QGuiApplication::screens().at(Screen())->availableGeometry());
//bgDesktop->resize(LSession::desktop()->screenGeometry(Screen()).size());
//bgDesktop->move(LSession::desktop()->screenGeometry(Screen()).topLeft());
bgDesktop->setDesktopArea( rec );
diff --git a/src-qt5/core/lumina-desktop/LSession.cpp b/src-qt5/core/lumina-desktop/LSession.cpp
index 7f7cc443..2495e336 100644
--- a/src-qt5/core/lumina-desktop/LSession.cpp
+++ b/src-qt5/core/lumina-desktop/LSession.cpp
@@ -486,19 +486,20 @@ void LSession::refreshWindowManager(){
void LSession::updateDesktops(){
qDebug() << " - Update Desktops";
- QDesktopWidget *DW = this->desktop();
- int sC = DW->screenCount();
+ QList<QScreen*> screens = QGuiApplication::screens();
+ int sC = screens.count();
qDebug() << " Screen Count:" << sC;
qDebug() << " DESKTOPS Length:" << DESKTOPS.length();
if(sC<1){ return; } //stop here - no screens available temporarily (displayport/4K issue)
screenRect = QRect(); //clear it
- for(int i=0; i<sC; i++){
- screenRect = screenRect.united(DW->screenGeometry(i));
- qDebug() << " -- Screen["+QString::number(i)+"]:" << DW->screenGeometry(i);
+ QList<QScreen*>::const_iterator it;
+ int i = 0;
+ for(it = screens.constBegin(); it != screens.constEnd(); ++it, ++i) {
+ screenRect = screenRect.united((*it)->availableGeometry());
+ qDebug() << " -- Screen["+QString::number(i)+"]:" << (*it)->availableGeometry();
}
bool firstrun = (DESKTOPS.length()==0);
- bool numchange = DESKTOPS.length()!=sC;
QSettings dset("lumina-desktop", "desktopsettings");
if(firstrun && sC==1){
//Sanity check - ensure the monitor ID did not change between sessions for single-monitor setups
@@ -519,7 +520,7 @@ void LSession::updateDesktops(){
}
// If the screen count is changing on us
- if ( sC != DW->screenCount() ) {
+ if ( sC != QGuiApplication::screens().count() ) {
qDebug() << "Screen Count changed while running";
return;
}
@@ -528,7 +529,7 @@ void LSession::updateDesktops(){
QList<int> dnums; //keep track of which screens are already managed
QList<QRect> geoms;
for(int i=0; i<DESKTOPS.length(); i++){
- if ( DESKTOPS[i]->Screen() < 0 || DESKTOPS[i]->Screen() >= sC || geoms.contains(DW->screenGeometry(DESKTOPS[i]->Screen())) ) {
+ if ( DESKTOPS[i]->Screen() < 0 || DESKTOPS[i]->Screen() >= sC || geoms.contains(screens.at(i)->availableGeometry())) {
//qDebug() << " - Close desktop:" << i;
qDebug() << " - Close desktop on screen:" << DESKTOPS[i]->Screen();
DESKTOPS[i]->prepareToClose();
@@ -540,7 +541,7 @@ void LSession::updateDesktops(){
DESKTOPS[i]->UpdateGeometry();
DESKTOPS[i]->show();
dnums << DESKTOPS[i]->Screen();
- geoms << DW->screenGeometry(DESKTOPS[i]->Screen());
+ geoms << screens.at(i)->availableGeometry();
}
}
@@ -549,11 +550,11 @@ void LSession::updateDesktops(){
QList<QScreen*> scrns = QApplication::screens();
for(int i=0; i<sC; i++){
allNames << scrns.at(i)->name();
- if(!dnums.contains(i) && !geoms.contains(DW->screenGeometry(i)) ){
+ if(!dnums.contains(i) && !geoms.contains(screens.at(i)->availableGeometry()) ){
//Start the desktop on this screen
qDebug() << " - Start desktop on screen:" << i;
DESKTOPS << new LDesktop(i);
- geoms << DW->screenGeometry(i);
+ geoms << screens.at(i)->availableGeometry();
}
}
dset.setValue("last_used_screens", allNames);
@@ -605,8 +606,9 @@ void LSession::adjustWindowGeom(WId win, bool maximize){
if(geom.isNull()){ return; } //Could not get geometry for some reason
//Get the available geometry for the screen the window is on
QRect desk;
+ QList<QScreen *> screens = QGuiApplication::screens();
for(int i=0; i<DESKTOPS.length(); i++){
- if( this->desktop()->screenGeometry(DESKTOPS[i]->Screen()).contains(geom.center()) ){
+ if( screens.at(i)->availableGeometry().contains(geom.center()) ){
//Window is on this screen
if(DEBUG){ qDebug() << " - On Screen:" << DESKTOPS[i]->Screen(); }
desk = DESKTOPS[i]->availableScreenGeom();
@@ -695,8 +697,9 @@ QFileInfoList LSession::DesktopFiles(){
}
QRect LSession::screenGeom(int num){
- if(num < 0 || num >= this->desktop()->screenCount() ){ return QRect(); }
- QRect geom = this->desktop()->screenGeometry(num);
+ QList<QScreen *> screens = QGuiApplication::screens();
+ if(num < 0 || num >= screens.count() ){ return QRect(); }
+ QRect geom = screens.at(num)->availableGeometry();
return geom;
}
@@ -776,10 +779,13 @@ void LSession::playAudioFile(QString filepath){
// =======================
void LSession::RootSizeChange(){
if(DESKTOPS.isEmpty() || screenRect.isNull()){ return; } //Initial setup not run yet
- QDesktopWidget *DW = this->desktop();
- int sC = DW->screenCount();
+
QRect tmp;
- for(int i=0; i<sC; i++){ tmp = tmp.united(DW->screenGeometry(i)); }
+ QList<QScreen*> screens = QGuiApplication::screens();
+ QList<QScreen*>::const_iterator it;
+ for(it = screens.constBegin(); it != screens.constEnd(); ++it) {
+ tmp = tmp.united( (*it)->availableGeometry() );
+ }
if(tmp == screenRect){ return; } //false event - session size did not change
qDebug() << "Got Root Size Change";
xchange = true;
diff --git a/src-qt5/core/lumina-desktop/SystemWindow.cpp b/src-qt5/core/lumina-desktop/SystemWindow.cpp
index af9188bc..bfad961d 100644
--- a/src-qt5/core/lumina-desktop/SystemWindow.cpp
+++ b/src-qt5/core/lumina-desktop/SystemWindow.cpp
@@ -49,7 +49,7 @@ void SystemWindow::updateWindow(){
ui->tool_shutdown->setEnabled(ok);
ui->frame_update->setVisible( !LOS::systemPendingUpdates().isEmpty() );
//Center this window on the current screen
- QPoint center = QApplication::desktop()->screenGeometry(QCursor::pos()).center(); //get the center of the current screen
+ QPoint center = QGuiApplication::screenAt(QCursor::pos())->availableGeometry().center(); //get the center of the current screen
this->move(center.x() - this->width()/2, center.y() - this->height()/2);
}
diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp b/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp
index 88f535de..f954ec4f 100644
--- a/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp
+++ b/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp
@@ -168,7 +168,7 @@ void AppLauncherPlugin::loadButton(){
//Now adjust the visible text as necessary based on font/grid sizing
if(button->toolTip().isEmpty()){ button->setToolTip(txt); }
//Double check that the visual icon size matches the requested size - otherwise upscale the icon
- if(button->fontMetrics().width(txt) > (button->width()-OUTMARGIN) ){
+ if(button->fontMetrics().horizontalAdvance(txt) > (button->width()-OUTMARGIN) ){
//Text too long, try to show it on two lines
//txt = button->fontMetrics().elidedText(txt, Qt::ElideRight, 2*(button->width()-OUTMARGIN), Qt::TextWordWrap);
txt =txt.section(" ",0,2).replace(" ","\n"); //First take care of any natural breaks
@@ -177,7 +177,7 @@ void AppLauncherPlugin::loadButton(){
//need to check each line
QStringList txtL = txt.split("\n");
for(int i=0; i<txtL.length(); i++){
- if(( i+1<txtL.length()) && (button->fontMetrics().width(txtL[i]) < button->width()/2) ){
+ if(( i+1<txtL.length()) && (button->fontMetrics().horizontalAdvance(txtL[i]) < button->width()/2) ){
txtL[i] = txtL[i]+" "+txtL[i+1];
txtL.removeAt(i+1);
}
diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/OutlineToolButton.h b/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/OutlineToolButton.h
index 24410e75..0febe40f 100644
--- a/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/OutlineToolButton.h
+++ b/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/OutlineToolButton.h
@@ -76,13 +76,13 @@ protected:
else{outC.setHsl(textC.hue(), textC.hslSaturation(), 255, 50); }
//qDebug() << "Outline Color Values:" << outC;
//Now get the size of the outline border (need to scale for high-res monitors)
- qreal OWidth = opt.fontMetrics.width("o")/2.0;
+ qreal OWidth = opt.fontMetrics.horizontalAdvance("o")/2.0;
//qDebug() << "Outline Width:" << OWidth;
//Now generate a QPainterPath for the text
QPainterPath path;
QStringList txt = this->text().split("\n"); //need each line independently, the newline actually gets painted otherwise
for(int i=0; i<txt.length(); i++){
- path.addText(box.center().x() - (opt.fontMetrics.width(txt[i])/2), box.y()+((i+1)*(box.height()/txt.length()))-opt.fontMetrics.descent(), opt.font, txt[i] );
+ path.addText(box.center().x() - (opt.fontMetrics.horizontalAdvance(txt[i])/2), box.y()+((i+1)*(box.height()/txt.length()))-opt.fontMetrics.descent(), opt.font, txt[i] );
}
path.setFillRule(Qt::WindingFill);
//Now paint the text
diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp b/src-qt5/core/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp
index 90f3374b..6f4d62d6 100644
--- a/src-qt5/core/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp
+++ b/src-qt5/core/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp
@@ -180,8 +180,8 @@ void DesktopViewPlugin::updateContents(){
}
//Now adjust the visible text as necessary based on font/grid sizing
it->setToolTip(txt);
- if(this->fontMetrics().width(txt) > (gridSZ.width()-4) ){
- //int dash = this->fontMetrics().width("-");
+ if(this->fontMetrics().horizontalAdvance(txt) > (gridSZ.width()-4) ){
+ //int dash = this->fontMetrics().horizontalAdvance("-");
//Text too long, try to show it on two lines
txt = txt.section(" ",0,2).replace(" ","\n"); //First take care of any natural breaks
if(txt.contains("\n")){
diff --git a/src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.cpp b/src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.cpp
index 2972ea86..d45853d1 100644
--- a/src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.cpp
+++ b/src-qt5/core/lumina-desktop/panel-plugins/clock/LClock.cpp
@@ -79,7 +79,7 @@ void LClock::updateTime(bool adjustformat){
if( this->layout()->direction() == QBoxLayout::TopToBottom ){
//different routine for vertical text (need newlines instead of spaces)
for(int i=0; i<label.count("\n")+1; i++){
- if(this->size().width() < (this->fontMetrics().width(label.section("\n",i,i))+10 )&& label.section("\n",i,i).contains(" ")){
+ if(this->size().width() < (this->fontMetrics().horizontalAdvance(label.section("\n",i,i))+10 )&& label.section("\n",i,i).contains(" ")){
label.replace(label.section("\n",i,i), label.section("\n",i,i).replace(" ", "\n"));
i--;
}
@@ -100,12 +100,12 @@ void LClock::updateTime(bool adjustformat){
int wid = 0;
int lwid = 0;
for(int i=0; i<lines.length(); i++){
- lwid = metrics.width(lines[i]);
+ lwid = metrics.horizontalAdvance(lines[i]);
if(lwid>wid){ wid = lwid; }
}
qDebug() << "Verify Clock width:" << lines.length() << wid << lines;
this->setMinimumWidth(wid);
- this->setMaximumWidth(wid + (4*metrics.width("O")));
+ this->setMaximumWidth(wid + (4*metrics.horizontalAdvance("O")));
}else{
//vertical layout
this->setMinimumHeight(metrics.lineSpacing() * lines.length());
diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp
index 5acd9721..49fdeeaf 100644
--- a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp
+++ b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp
@@ -30,7 +30,7 @@ LStartButtonPlugin::LStartButtonPlugin(QWidget *parent, QString id, bool horizon
connect(startmenu, SIGNAL(UpdateQuickLaunch(QStringList)), this, SLOT(updateQuickLaunch(QStringList)));
QRect screenSize = QApplication::desktop()->availableGeometry(this);
- QSize saved = LSession::handle()->DesktopPluginSettings()->value("panelPlugs/"+this->type()+"/MenuSize",QSize(this->fontMetrics().width("x")*30 ,screenSize.height()/1.8)).toSize();
+ QSize saved = LSession::handle()->DesktopPluginSettings()->value("panelPlugs/"+this->type()+"/MenuSize",QSize(this->fontMetrics().horizontalAdvance("x")*30 ,screenSize.height()/1.8)).toSize();
//qDebug() << "Got Start Menu Saved Size:" << saved;
if(!saved.isNull() && saved.isValid()){ startmenu->setFixedSize(saved); } //re-load the previously saved value
menu->setContents(startmenu);
diff --git a/src-qt5/core/lumina-open/main.cpp b/src-qt5/core/lumina-open/main.cpp
index e53181f9..f152d6f7 100644
--- a/src-qt5/core/lumina-open/main.cpp
+++ b/src-qt5/core/lumina-open/main.cpp
@@ -72,7 +72,7 @@ void showOSD(int argc, char **argv, QString message){
if(DEBUG) qDebug() << "Display OSD";
splash.setText(message);
//Make sure it is centered on the current screen
- QPoint center = App.desktop()->screenGeometry(QCursor::pos()).center();
+ QPoint center = App.screenAt(QCursor::pos())->availableGeometry().center();
splash.move(center.x()-(splash.sizeHint().width()/2), center.y()-(splash.sizeHint().height()/2));
splash.show();
//qDebug() << " - show message";
diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontspage.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontspage.cpp
index 8d1ed1ab..15a0ef3d 100644
--- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontspage.cpp
+++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontspage.cpp
@@ -1,4 +1,3 @@
-#include <QSignalMapper>
#include <QMessageBox>
#include <QSettings>
#include <QApplication>
@@ -13,12 +12,8 @@
FontsPage::FontsPage(QWidget *parent) : TabPage(parent), m_ui(new Ui::FontsPage){
m_ui->setupUi(this);
- QSignalMapper *mapper = new QSignalMapper(this);
- mapper->setMapping(m_ui->changeGeneralFontButton, m_ui->generalFontLabel);
- mapper->setMapping(m_ui->changeFixedWidthFontButton, m_ui->fixedFontLabel);
- connect(m_ui->changeGeneralFontButton, SIGNAL(clicked()), mapper, SLOT(map()));
- connect(m_ui->changeFixedWidthFontButton, SIGNAL(clicked()), mapper, SLOT(map()));
- connect(mapper, SIGNAL(mapped(QWidget*)), SLOT(onFontChangeRequested(QWidget*)));
+ connect(m_ui->changeGeneralFontButton, &QToolButton::clicked, [this](){onFontChangeRequested(m_ui->generalFontLabel);});
+ connect(m_ui->changeFixedWidthFontButton, &QToolButton::clicked, [this](){onFontChangeRequested(m_ui->fixedFontLabel);});
readSettings();
//icons
diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.cpp
index 6c5b0665..1c377965 100644
--- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.cpp
+++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.cpp
@@ -28,9 +28,9 @@ PaletteEditDialog::~PaletteEditDialog(){
QPalette PaletteEditDialog::selectedPalette() const{
QPalette palette;
for(int i = 0; i < QPalette::NColorRoles; i++){
- palette.setBrush(QPalette::Active, QPalette::ColorRole(i), m_ui->tableWidget->item(i,0)->backgroundColor());
- palette.setBrush(QPalette::Inactive, QPalette::ColorRole(i), m_ui->tableWidget->item(i,1)->backgroundColor());
- palette.setBrush(QPalette::Disabled, QPalette::ColorRole(i), m_ui->tableWidget->item(i,2)->backgroundColor());
+ palette.setBrush(QPalette::Active, QPalette::ColorRole(i), m_ui->tableWidget->item(i,0)->background().color());
+ palette.setBrush(QPalette::Inactive, QPalette::ColorRole(i), m_ui->tableWidget->item(i,1)->background().color());
+ palette.setBrush(QPalette::Disabled, QPalette::ColorRole(i), m_ui->tableWidget->item(i,2)->background().color());
}
return palette;
}
@@ -40,9 +40,9 @@ void PaletteEditDialog::setPalette(const QPalette &palette){
if(!m_ui->tableWidget->item(i,0)){ m_ui->tableWidget->setItem(i, 0, new QTableWidgetItem()); }
if(!m_ui->tableWidget->item(i,1)){ m_ui->tableWidget->setItem(i, 1, new QTableWidgetItem()); }
if(!m_ui->tableWidget->item(i,2)){ m_ui->tableWidget->setItem(i, 2, new QTableWidgetItem()); }
- m_ui->tableWidget->item(i,0)->setBackgroundColor(palette.color(QPalette::Active, QPalette::ColorRole(i)));
- m_ui->tableWidget->item(i,1)->setBackgroundColor(palette.color(QPalette::Inactive, QPalette::ColorRole(i)));
- m_ui->tableWidget->item(i,2)->setBackgroundColor(palette.color(QPalette::Disabled, QPalette::ColorRole(i)));
+ m_ui->tableWidget->item(i,0)->setBackground(QBrush(palette.color(QPalette::Active, QPalette::ColorRole(i))));
+ m_ui->tableWidget->item(i,1)->setBackground(QBrush(palette.color(QPalette::Inactive, QPalette::ColorRole(i))));
+ m_ui->tableWidget->item(i,2)->setBackground(QBrush(palette.color(QPalette::Disabled, QPalette::ColorRole(i))));
}
QStringList labels;
labels << tr("Window text") << tr("Button background") << tr("Bright") << tr("Less bright") << tr("Dark") << tr("Less dark") << tr("Normal text") << tr("Bright text") << tr("Button text") << tr("Normal background") << tr("Window") << tr("Shadow") << tr("Highlight") << tr("Highlighted text") << tr("Link") << tr("Visited link") << tr("Alternate background") << tr("Default") << tr("Tooltip background") << tr("Tooltip text") << tr("Placeholder text");
@@ -55,9 +55,9 @@ void PaletteEditDialog::hideEvent(QHideEvent *){
}
void PaletteEditDialog::on_tableWidget_itemClicked(QTableWidgetItem *item){
- QColor color = QColorDialog::getColor(item->backgroundColor(), this, tr("Select Color"));
+ QColor color = QColorDialog::getColor(item->background().color(), this, tr("Select Color"));
if(color.isValid()){
- item->setBackgroundColor(color);
+ item->setBackground(QBrush(color));
emit paletteChanged(selectedPalette());
}
}
diff --git a/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp b/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp
index eeb0f507..f67fc058 100644
--- a/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp
@@ -367,7 +367,7 @@ void MainUI::UpdateTree(){
}
if(changed){
- int wid = ui->tree_contents->fontMetrics().width("W")*5;
+ int wid = ui->tree_contents->fontMetrics().horizontalAdvance("W")*5;
ui->tree_contents->setColumnWidth(2, wid);
for(int i=1; i<2; i++){ui->tree_contents->resizeColumnToContents(i); QApplication::processEvents(); wid+= ui->tree_contents->columnWidth(i); }
//qDebug() << "Set column 0 width:" << wid << ui->tree_contents->viewport()->width();
diff --git a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp
index c99a781e..df5b1170 100644
--- a/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-fileinfo/MainUI.cpp
@@ -143,7 +143,7 @@ void MainUI::SyncFileInfo(){
}
ui->label_file_owner->setText(INFO->owner());
ui->label_file_group->setText(INFO->group());
- ui->label_file_created->setText( INFO->created().toString(Qt::SystemLocaleLongDate) );
+ ui->label_file_created->setText( INFO->birthTime().toString(Qt::SystemLocaleLongDate) );
ui->label_file_modified->setText( INFO->lastModified().toString(Qt::SystemLocaleLongDate) );
//Get the file permissions
QString perms;
@@ -220,7 +220,7 @@ void MainUI::SyncZfsInfo(){
ui->tree_zfs_snaps->clear();
for(int i=0; i<snaps.length(); i++){
QFileInfo finfo(snaps[i].section("::::",1,-1));
- ui->tree_zfs_snaps->addTopLevelItem( new QTreeWidgetItem(QStringList() << snaps[i].section("::::",0,0) << finfo.created().toString(Qt::SystemLocaleShortDate) << finfo.lastModified().toString(Qt::SystemLocaleShortDate) ) );
+ ui->tree_zfs_snaps->addTopLevelItem( new QTreeWidgetItem(QStringList() << snaps[i].section("::::",0,0) << finfo.birthTime().toString(Qt::SystemLocaleShortDate) << finfo.lastModified().toString(Qt::SystemLocaleShortDate) ) );
ui->tree_zfs_snaps->resizeColumnToContents(0);
}
ui->tree_zfs_snaps->setVisible(!snaps.isEmpty());
diff --git a/src-qt5/desktop-utils/lumina-fm/Browser.cpp b/src-qt5/desktop-utils/lumina-fm/Browser.cpp
index 26d95faa..6974208a 100644
--- a/src-qt5/desktop-utils/lumina-fm/Browser.cpp
+++ b/src-qt5/desktop-utils/lumina-fm/Browser.cpp
@@ -210,7 +210,7 @@ void Browser::loadDirectory(QString dir, bool force){
watcher->addPath(directory.absoluteFilePath(files[i]));
QString path = directory.absoluteFilePath(files[i]);
oldFiles << path; //add to list for next time
- bool reloaditem = !dirupdate || lastcheck.isNull() || (QFileInfo(path).lastModified() > lastcheck || QFileInfo(path).created() > lastcheck);
+ bool reloaditem = !dirupdate || lastcheck.isNull() || (QFileInfo(path).lastModified() > lastcheck || QFileInfo(path).birthTime() > lastcheck);
//if(dirupdate){ qDebug() << "Reload Item:" << reloaditem << path.section("/",-1); }
//reloaditem = true;
if(old.contains(path)){ old.removeAll(path); } //still in existance
diff --git a/src-qt5/desktop-utils/lumina-fm/BrowserModel.cpp b/src-qt5/desktop-utils/lumina-fm/BrowserModel.cpp
index d79da006..aeb65bae 100644
--- a/src-qt5/desktop-utils/lumina-fm/BrowserModel.cpp
+++ b/src-qt5/desktop-utils/lumina-fm/BrowserModel.cpp
@@ -75,7 +75,7 @@ QVariant BrowserModel::data(const QModelIndex &index, int role) const{
else if(index.column()==1){ return QVariant(info->fileSize()); }
else if(index.column()==2){ return QVariant(info->mimetype()); }
else if(index.column()==3){ return QVariant(info->lastModified()->toString(Qt::DefaultLocaleShortDate)); }
- else if(index.column()==4){ return QVariant(info->created()->toString(Qt::DefaultLocaleShortDate)); }
+ else if(index.column()==4){ return QVariant(info->birthTime()->toString(Qt::DefaultLocaleShortDate)); }
case Qt::ToolTipRole:
return QVariant(info->absoluteFilePath());
case Qt::StatusTipRole:
diff --git a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp
index 65dbdb16..45f3d3e1 100644
--- a/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp
+++ b/src-qt5/desktop-utils/lumina-fm/BrowserWidget.cpp
@@ -103,7 +103,7 @@ void BrowserWidget::showDetails(bool show){
connect(treeWidget, SIGNAL(sortColumnChanged(int)), this, SIGNAL(setTreeWidgetSortColumn(int, bool)) );
retranslate();
treeWidget->sortItems(treeSortColumn, Qt::AscendingOrder);
- treeWidget->setColumnWidth(0, treeWidget->fontMetrics().width("W")*20);
+ treeWidget->setColumnWidth(0, treeWidget->fontMetrics().horizontalAdvance("W")*20);
if(!BROWSER->currentDirectory().isEmpty()){ emit dirChange("", true); }
}else if(!show && listWidget==0){
listWidget = new DDListWidget(this);
@@ -405,11 +405,11 @@ void BrowserWidget::itemDataAvailable(const QIcon* ico, LFileInfo *info){
it->setText(1, info->isDir() ? "" : LUtils::BytesToDisplaySize(info->size()) ); //size (1)
it->setText(2, info->mimetype() ); //type (2)
it->setText(3, DTtoString(info->lastModified() )); //modification date (3)
- it->setText(4, DTtoString(info->created()) ); //creation date (4)
+ it->setText(4, DTtoString(info->birthTime()) ); //creation date (4)
//Now all the hidden data
it->setWhatsThis(0, info->absoluteFilePath());
it->setWhatsThis(3, info->lastModified().toString("yyyyMMddhhmmsszzz") ); //sorts by this actually
- it->setWhatsThis(4, info->created().toString("yyyyMMddhhmmsszzz") ); //sorts by this actually
+ it->setWhatsThis(4, info->birthTime().toString("yyyyMMddhhmmsszzz") ); //sorts by this actually
num = treeWidget->topLevelItemCount();
}
if(num < numItems){
diff --git a/src-qt5/desktop-utils/lumina-fm/ScrollDialog.h b/src-qt5/desktop-utils/lumina-fm/ScrollDialog.h
index eefe62f4..27f40c24 100644
--- a/src-qt5/desktop-utils/lumina-fm/ScrollDialog.h
+++ b/src-qt5/desktop-utils/lumina-fm/ScrollDialog.h
@@ -48,7 +48,7 @@ public:
void setText(QString txt){
label->setPlainText(txt);
- //this->resize( label->fontMetrics().width(txt.section("\n",0,0))+30, this->height());
+ //this->resize( label->fontMetrics().horizontalAdvance(txt.section("\n",0,0))+30, this->height());
}
};
diff --git a/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp b/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp
index 88192943..5e859f73 100644
--- a/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-screenshot/MainUI.cpp
@@ -22,9 +22,9 @@ MainUI::MainUI()
IMG = new ImageEditor(this);
ui->scrollArea->setWidget(IMG);
areaOverlay = 0;
- ui->label_zoom_percent->setMinimumWidth( ui->label_zoom_percent->fontMetrics().width("200%") );
+ ui->label_zoom_percent->setMinimumWidth( ui->label_zoom_percent->fontMetrics().horizontalAdvance("200%") );
setupIcons();
- ui->spin_monitor->setMaximum(QApplication::desktop()->screenCount());
+ ui->spin_monitor->setMaximum(QGuiApplication::screens().count());
if(ui->spin_monitor->maximum()<2){
ui->spin_monitor->setEnabled(false);
ui->radio_monitor->setEnabled(false);
@@ -241,7 +241,7 @@ void MainUI::getPixmap(){
//Grab the whole screen
cpic = scrn->grabWindow(QApplication::desktop()->winId());
}else if(cwin==0 && ui->radio_monitor->isChecked()){
- QRect geom = QApplication::desktop()->screenGeometry(ui->spin_monitor->value()-1);
+ QRect geom = QGuiApplication::screens().at(ui->spin_monitor->value()-1)->availableGeometry();
cpic = scrn->grabWindow(QApplication::desktop()->winId(), geom.x(), geom.y(), geom.width(), geom.height() );
}else if(cwin==0 && ui->radio_area->isChecked()){
//Grab the section of the screen which was selected
@@ -329,7 +329,7 @@ void MainUI::closeEvent(QCloseEvent *ev){
//qDebug() << "Close Event:" << ui->check_show_popups->isChecked() << picSaved;
if(ui->check_show_popups->isChecked() && !picSaved){
//Ask what to do about the unsaved changed
- QMessageBox dialog( QMessageBox::Warning, tr("Unsaved Screenshot"),
+ QMessageBox dialog( QMessageBox::Warning, tr("Unsaved Screenshot"),
tr("The current screenshot has not been saved yet. Do you want to save or discard your changes?"),
QMessageBox::Discard | QMessageBox::Save | QMessageBox::Cancel, this);
dialog.setDefaultButton(QMessageBox::Cancel);
diff --git a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
index 07b99f27..0aedb1a0 100644
--- a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
+++ b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
@@ -30,7 +30,7 @@ PlainTextEditor::PlainTextEditor(QSettings *set, QWidget *parent) : QPlainTextEd
hasChanges = readonly = false;
lastSaveContents.clear();
matchleft = matchright = -1;
- this->setTabStopWidth( 8 * this->fontMetrics().width(" ") ); //8 character spaces per tab (UNIX standard)
+ this->setTabStopDistance( 8 * QFontMetricsF(this->font()).width(' ') ); //8 character spaces per tab (UNIX standard)
//this->setObjectName("PlainTextEditor");
//this->setStyleSheet("QPlainTextEdit#PlainTextEditor{ }");
SYNTAX = new Custom_Syntax(settings, this->document());
@@ -171,7 +171,7 @@ int PlainTextEditor::LNWWidth(){
//qDebug() << "point 1" << this->document()->defaultFont();
while(lines>=10){ chars++; lines/=10; }
QFontMetrics metrics(this->document()->defaultFont());
- return (metrics.width("9")*chars); //make sure to add a tiny bit of padding
+ return (metrics.horizontalAdvance("9")*chars); //make sure to add a tiny bit of padding
}
void PlainTextEditor::paintLNW(QPaintEvent *ev){
diff --git a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp
index 6a3acfed..fa6ed8f4 100644
--- a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp
+++ b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp
@@ -75,7 +75,7 @@ void SyntaxFile::SetupDocument(QPlainTextEdit* editor){
if(formatObj.contains("tab_width")){
int num = formatObj.value("tab_width").toInt();
if(num<=0){ num = 8; } //UNIX Standard of 8 characters per tab
- editor->setTabStopWidth( num * QFontMetrics(editor->document()->defaultFont()).width(" ") );
+ editor->setTabStopDistance( num * QFontMetricsF(editor->document()->defaultFont() ).width(" ") );
}
}
diff --git a/src-qt5/experimental/lumina-terminal/TerminalWidget.cpp b/src-qt5/experimental/lumina-terminal/TerminalWidget.cpp
index 9fe4f15e..43523f15 100644
--- a/src-qt5/experimental/lumina-terminal/TerminalWidget.cpp
+++ b/src-qt5/experimental/lumina-terminal/TerminalWidget.cpp
@@ -29,7 +29,7 @@ TerminalWidget::TerminalWidget(QWidget *parent, QString dir) : QTextEdit(parent)
this->setAcceptRichText(false);
this->setOverwriteMode(true);
this->setFocusPolicy(Qt::StrongFocus);
- this->setTabStopWidth( 8 * this->fontMetrics().width(" ") ); //8 character spaces per tab (UNIX standard)
+ this->setTabStopWidth( 8 * this->fontMetrics().horizontalAdvance(" ") ); //8 character spaces per tab (UNIX standard)
this->setTabChangesFocus(false);
//this->setWordWrapMode(QTextOption::NoWrap);
this->setContextMenuPolicy(Qt::CustomContextMenu);
@@ -537,7 +537,7 @@ void TerminalWidget::updateTermSize(){
if(!PROC->isOpen()){ return; }
QSize pix = this->size(); //pixels
QSize chars;
- chars.setWidth( pix.width()/this->fontMetrics().width("W") );
+ chars.setWidth( pix.width()/this->fontMetrics().horizontalAdvance("W") );
chars.setHeight( pix.height()/this->fontMetrics().lineSpacing() );
//qDebug() << "Set Terminal Size:" << chars << pix;
if(chars.width() <2 || chars.height() <2){ return; } //skip this - cannot go less than 2 characters wide/high
bgstack15