Skip to content

Commit 7163f14

Browse files
committed
(#18) Updated Linux implementation
1 parent fe7dbb1 commit 7163f14

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

src/linux/window_manager.cc

+20-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <X11/Xlib.h>
22
#include <X11/Xutil.h>
33
#include "../window_manager.h"
4+
#include <iostream>
45
extern "C" {
56
#include "../xdisplay.h"
67
}
@@ -82,23 +83,28 @@ bool focusWindow(const WindowHandle windowHandle) {
8283
return false;
8384
}
8485

85-
bool resizeWindow(const WindowHandle windowHandle, const MMRect& rect) {
86+
bool resizeWindow(const WindowHandle windowHandle, const MMSize newSize) {
87+
std::cout << "resizing" << std::endl;
8688
Display* display = XGetMainDisplay();
8789
if (display != NULL && windowHandle >= 0) {
88-
XWindowChanges changes;
89-
90-
//size
91-
changes.width = rect.size.width;
92-
changes.height = rect.size.height;
93-
94-
//origin
95-
changes.x = rect.origin.x;
96-
changes.y = rect.origin.y;
97-
98-
// Resize and move the window
99-
XConfigureWindow(display, windowHandle, CWX | CWY | CWWidth | CWHeight, &changes);
90+
XResizeWindow(display, windowHandle, newSize.width, newSize.height);
10091
XFlush(display);
101-
92+
std::cout << "resized" << std::endl;
93+
94+
return true;
95+
}
96+
return false;
97+
}
98+
99+
bool moveWindow(const WindowHandle windowHandle, const MMPoint newOrigin) {
100+
std::cout << "moving" << std::endl;
101+
102+
Display* display = XGetMainDisplay();
103+
if (display != NULL && windowHandle >= 0) {
104+
XMoveWindow(display, windowHandle, newOrigin.x, newOrigin.y);
105+
XFlush(display);
106+
std::cout << "moved" << std::endl;
107+
102108
return true;
103109
}
104110
return false;

0 commit comments

Comments
 (0)