Starting resize support.
This commit is contained in:
parent
cea3d2c39f
commit
9ade0e2d4b
26 changed files with 197 additions and 44 deletions
|
@ -7,17 +7,20 @@
|
|||
#include <xcb/xcb.h>
|
||||
|
||||
#include "PaintEvent.h"
|
||||
#include "ResizeEvent.h"
|
||||
#include "Screen.h"
|
||||
#include "XcbScreen.h"
|
||||
#include "Color.h"
|
||||
#include "UiEvent.h"
|
||||
#include "VisualLayer.h"
|
||||
#include "XcbKeyboard.h"
|
||||
#include "XcbWindow.h"
|
||||
#include "XcbLayerInterface.h"
|
||||
#include "XcbEventInterface.h"
|
||||
#include "XcbGlInterface.h"
|
||||
#include "FileLogger.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
||||
XcbInterface::XcbInterface(DesktopManager* desktopManager, bool useHardware)
|
||||
: AbstractUIInterface(desktopManager, useHardware),
|
||||
|
@ -120,7 +123,8 @@ void XcbInterface::createGraphicsContext()
|
|||
auto gc = xcb_generate_id(mConnection);
|
||||
xcb_drawable_t window = xcb_screen->GetNativeScreen()->root;
|
||||
uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
|
||||
uint32_t values[2] = {XcbLayerInterface::getColor(240, 240, 240), 0};
|
||||
auto color = Color(240, 240, 240);
|
||||
uint32_t values[2] = {color.getAsUInt32(), 0};
|
||||
xcb_create_gc(mConnection, gc, window, mask, values);
|
||||
xcb_screen->SetGraphicsContext(gc);
|
||||
}
|
||||
|
@ -140,7 +144,8 @@ uint32_t XcbInterface::getEventMask()
|
|||
return XCB_EVENT_MASK_KEY_RELEASE |
|
||||
XCB_EVENT_MASK_BUTTON_PRESS |
|
||||
XCB_EVENT_MASK_BUTTON_RELEASE |
|
||||
XCB_EVENT_MASK_EXPOSURE;
|
||||
XCB_EVENT_MASK_EXPOSURE |
|
||||
XCB_EVENT_MASK_RESIZE_REDIRECT;
|
||||
}
|
||||
|
||||
void XcbInterface::addWindow(mt::Window* window)
|
||||
|
@ -205,6 +210,23 @@ void XcbInterface::loop()
|
|||
mDesktopManager->onUiEvent(std::move(ui_event));
|
||||
break;
|
||||
}
|
||||
case XCB_RESIZE_REQUEST:
|
||||
{
|
||||
auto resize = (xcb_resize_request_event_t*) event;
|
||||
int width = 1;
|
||||
int height = 1;
|
||||
if (resize->width > 0)
|
||||
{
|
||||
width = resize->width;
|
||||
}
|
||||
if (resize->height > 0)
|
||||
{
|
||||
height = resize->height;
|
||||
}
|
||||
auto ui_event = std::make_unique<ResizeEvent>(width, height);
|
||||
mDesktopManager->onUiEvent(std::move(ui_event));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
/* Unknown event type, ignore it */
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue