XCB variant for displayWidth/Height and update after RandR event
DisplayWidth and height provide proper values though internally things are wrong as QDesktopWidget seems to not emit the signal.
This commit is contained in:
parent
cf48719802
commit
16df417cc6
3 changed files with 14 additions and 12 deletions
17
events.cpp
17
events.cpp
|
@ -424,10 +424,19 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e)
|
|||
}
|
||||
default:
|
||||
if (eventType == Xcb::Extensions::self()->randrNotifyEvent() && Xcb::Extensions::self()->isRandrAvailable()) {
|
||||
#warning Need an XCB replacement for XRRUpdateConfiguration
|
||||
#if KWIN_QT5_PORTING
|
||||
XRRUpdateConfiguration(e);
|
||||
#endif
|
||||
auto *event = reinterpret_cast<xcb_randr_screen_change_notify_event_t*>(e);
|
||||
xcb_screen_t *screen = defaultScreen();
|
||||
if (event->rotation & (XCB_RANDR_ROTATION_ROTATE_90 | XCB_RANDR_ROTATION_ROTATE_270)) {
|
||||
screen->width_in_pixels = event->height;
|
||||
screen->height_in_pixels = event->width;
|
||||
screen->width_in_millimeters = event->mheight;
|
||||
screen->height_in_millimeters = event->mwidth;
|
||||
} else {
|
||||
screen->width_in_pixels = event->width;
|
||||
screen->height_in_pixels = event->height;
|
||||
screen->width_in_millimeters = event->mwidth;
|
||||
screen->height_in_millimeters = event->mheight;
|
||||
}
|
||||
if (compositing()) {
|
||||
// desktopResized() should take care of when the size or
|
||||
// shape of the desktop has changed, but we also want to
|
||||
|
|
|
@ -172,23 +172,15 @@ KWIN_EXPORT xcb_screen_t *defaultScreen()
|
|||
inline
|
||||
KWIN_EXPORT int displayWidth()
|
||||
{
|
||||
#if 0
|
||||
xcb_screen_t *screen = defaultScreen();
|
||||
return screen ? screen->width_in_pixels : 0;
|
||||
#else
|
||||
return XDisplayWidth(display(), DefaultScreen(display()));
|
||||
#endif
|
||||
}
|
||||
|
||||
inline
|
||||
KWIN_EXPORT int displayHeight()
|
||||
{
|
||||
#if 0
|
||||
xcb_screen_t *screen = defaultScreen();
|
||||
return screen ? screen->height_in_pixels : 0;
|
||||
#else
|
||||
return XDisplayHeight(display(), DefaultScreen(display()));
|
||||
#endif
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
|
|
|
@ -129,6 +129,7 @@ void Extensions::init()
|
|||
}
|
||||
if (m_randr.present) {
|
||||
randrVersion = xcb_randr_query_version_unchecked(c, RANDR_MAX_MAJOR, RANDR_MAX_MINOR);
|
||||
xcb_randr_select_input(connection(), rootWindow(), XCB_RANDR_NOTIFY_MASK_SCREEN_CHANGE);
|
||||
}
|
||||
if (m_damage.present) {
|
||||
damageVersion = xcb_damage_query_version_unchecked(c, DAMAGE_MAX_MAJOR, DAMAGE_MIN_MAJOR);
|
||||
|
|
Loading…
Reference in a new issue