Changeset 4d19595


Ignore:
Timestamp:
07/18/14 13:50:11 (14 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, enter/10, releng/10.0.3, releng/10.1, releng/10.1.1, releng/10.1.2, releng/10.2
Children:
9c181ae, 94ddfcac
Parents:
a584991
Message:

Fix up the transparent panel system, by fixing a bug in the desktop placement system.
NOTE: Screen 0 is not always the left-most screen. Instead, make sure to use the desktopGeometry() system for determining the desktop placement locations.

Location:
lumina/lumina-desktop
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • lumina/lumina-desktop/LDesktop.cpp

    ra584991 r4d19595  
    1212  desktopnumber = deskNum; 
    1313  desktop = new QDesktopWidget(); 
     14    connect(desktop, SIGNAL(resized(int)), this, SLOT(UpdateGeometry(int))); 
    1415  defaultdesktop = (deskNum== desktop->primaryScreen()); 
    1516  desktoplocked = true; 
     
    1819    xoffset += desktop->screenGeometry(i).width(); 
    1920  } 
     21  qDebug() << "Desktop #"<<deskNum<<" -> "<< desktop->screenGeometry(desktopnumber).x() << desktop->screenGeometry(desktopnumber).y() << desktop->screenGeometry(desktopnumber).width() << desktop->screenGeometry(desktopnumber).height(); 
    2022  deskMenu = new QMenu(0); 
    2123    connect(deskMenu, SIGNAL(triggered(QAction*)), this, SLOT(SystemApplication(QAction*)) ); 
     
    4042        bgWindow->setContextMenuPolicy(Qt::CustomContextMenu); 
    4143        LX11::SetAsDesktop(bgWindow->winId()); 
    42         bgWindow->setGeometry(xoffset,0,desktop->screenGeometry().width(), desktop->screenGeometry().height()); 
     44        //bgWindow->setGeometry(xoffset,0,desktop->screenGeometry().width(), desktop->screenGeometry().height()); 
     45        bgWindow->setGeometry(desktop->screenGeometry(desktopnumber)); 
    4346        connect(bgWindow, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowMenu()) ); 
    4447  bgDesktop = new QMdiArea(bgWindow); 
  • lumina/lumina-desktop/LDesktop.h

    rb74ce79 r4d19595  
    8484 
    8585        void UpdateBackground(); 
    86  
     86        void UpdateGeometry(int screen){ 
     87          if(screen==desktopnumber){ 
     88            bgWindow->setGeometry(desktop->screenGeometry(desktopnumber)); 
     89            QTimer::singleShot(0, this, SLOT(UpdatePanels())); 
     90          } 
     91        } 
    8792}; 
    8893#endif 
  • lumina/lumina-desktop/LPanel.cpp

    ra584991 r4d19595  
    2121  screen = new QDesktopWidget(); 
    2222  PPREFIX = "panel"+QString::number(screennum)+"."+QString::number(num)+"/"; 
    23   if(settings->value("defaultpanel",QString::number(screen->primaryScreen())+".0").toString()==QString::number(screennum)+"."+QString::number(num) ){ defaultpanel=true;} 
     23  if(settings->value("defaultpanel","0.0").toString()==QString::number(screennum)+"."+QString::number(num) ){ defaultpanel=true;} 
    2424  else{defaultpanel=false; } 
    2525  horizontal=true; //use this by default initially 
     
    7070  } 
    7171  int ht = settings->value(PPREFIX+"height", 22).toInt(); //this is technically the distance into the screen from the edge 
    72   int xoffset=0; 
     72  /*int xoffset=0; 
    7373  for(int i=0; i<screennum; i++){ 
    7474    xoffset = xoffset + screen->screenGeometry(i).width(); 
    75   } 
     75  }*/ 
    7676  qDebug() << " - set Geometry"; 
    7777  int xwid = screen->screenGeometry(screennum).width(); 
    7878  int xhi = screen->screenGeometry(screennum).height(); 
     79  int xloc = screen->screenGeometry(screennum).x(); 
     80  //xloc=xoffset; 
    7981  if(loc=="top"){ //top of screen 
    8082    QSize sz = QSize(xwid, ht); 
    8183    this->setMinimumSize(sz); 
    8284    this->setMaximumSize(sz); 
    83     this->setGeometry(xoffset,0,xwid, ht ); 
    84     LX11::ReservePanelLocation(this->winId(), xoffset, 0, this->width(), ht, "top"); 
     85    this->setGeometry(xloc,0,xwid, ht ); 
     86    LX11::ReservePanelLocation(this->winId(), xloc, 0, this->width(), ht, "top"); 
    8587  }else if(loc=="bottom"){ //bottom of screen 
    8688    QSize sz = QSize(xwid, ht); 
    8789    this->setMinimumSize(sz); 
    8890    this->setMaximumSize(sz); 
    89     this->setGeometry(xoffset,xhi-ht,xwid, ht ); 
    90     LX11::ReservePanelLocation(this->winId(), xoffset, xhi-ht, this->width(), ht, "bottom"); 
     91    this->setGeometry(xloc,xhi-ht,xwid, ht ); 
     92    LX11::ReservePanelLocation(this->winId(), xloc, xhi-ht, this->width(), ht, "bottom"); 
    9193  }else if(loc=="left"){ //left side of screen 
    9294    QSize sz = QSize(ht, xhi); 
    9395    this->setMinimumSize(sz); 
    9496    this->setMaximumSize(sz); 
    95     this->setGeometry(xoffset,0, ht, xhi); 
    96     LX11::ReservePanelLocation(this->winId(), xoffset, 0, ht, xhi, "left"); 
     97    this->setGeometry(xloc,0, ht, xhi); 
     98    LX11::ReservePanelLocation(this->winId(), xloc, 0, ht, xhi, "left"); 
    9799  }else{ //right side of screen 
    98100    QSize sz = QSize(ht, xhi); 
    99101    this->setMinimumSize(sz); 
    100102    this->setMaximumSize(sz); 
    101     this->setGeometry(xoffset+xwid-ht,0,ht, xhi); 
    102     LX11::ReservePanelLocation(this->winId(), xoffset+xwid-ht, 0, ht, xhi, "right");       
     103    this->setGeometry(xloc+xwid-ht,0,ht, xhi); 
     104    LX11::ReservePanelLocation(this->winId(), xloc+xwid-ht, 0, ht, xhi, "right");          
    103105  } 
    104106  //Now update the appearance of the toolbar 
    105   QString color = settings->value(PPREFIX+"color", "qlineargradient(spread:pad, x1:0.291182, y1:0, x2:0.693, y2:1, stop:0 rgb(255, 253, 250), stop:1 rgb(210, 210, 210))").toString(); 
    106   QString style = "QWidget#LuminaPanelPluginWidget{ background: %1; border-radius: 5px; border: 1px solid grey; }"; 
     107  QString color = settings->value(PPREFIX+"color", "qlineargradient(spread:pad, x1:0.291182, y1:0, x2:0.693, y2:1, stop:0 rgb(255, 253, 250,100), stop:1 rgba(210, 210, 210,100))").toString(); 
     108  QString style = "QWidget#LuminaPanelPluginWidget{ background: %1; border-radius: 3px; border: 1px solid transparent; }"; 
    107109  style = style.arg(color); 
    108110  panelArea->setStyleSheet(style); 
     
    190192  QPainter *painter = new QPainter(this); 
    191193  //Make sure the base background of the event rectangle is the associated rectangle from the BGWindow 
    192   QRect rec = event->rect(); //already in global coords? (translating to bgWindow coords crashes Lumina) 
    193   //painter->setBackground( QBrush( QPixmap::grabWidget(bgWindow, rec)) ); //DOES NOT WORK!! 
     194  QRect rec(event->rect().x(), event->rect().y(), event->rect().width(), event->rect().height()); //already in global coords? (translating to bgWindow coords crashes Lumina) 
     195  //Need to translate that rectangle to the background image coordinates 
     196  qDebug() << "Rec:" << rec.x() << rec.y(); 
     197  rec.moveTo( this->mapToGlobal(rec.topLeft()) ); //Need to change to global coords for the main window 
     198  qDebug() << "Global Rec:" << rec.x() << rec.y() << screennum; 
     199  rec.moveTo( rec.x()-screen->screenGeometry(screennum).x(), rec.y() ); 
     200  qDebug() << "Adjusted Global Rec:" << rec.x() << rec.y(); 
    194201  painter->drawPixmap(event->rect(), QPixmap::grabWidget(bgWindow, rec) ); 
    195202  QWidget::paintEvent(event); //now pass the event along to the normal painting event 
Note: See TracChangeset for help on using the changeset viewer.