summaryrefslogtreecommitdiff
path: root/kmscube
diff options
context:
space:
mode:
Diffstat (limited to 'kmscube')
-rw-r--r--kmscube/cube-x11.cpp43
-rw-r--r--kmscube/cube.cpp6
-rw-r--r--kmscube/cube.h1
3 files changed, 40 insertions, 10 deletions
diff --git a/kmscube/cube-x11.cpp b/kmscube/cube-x11.cpp
index 7f01ae8..648384d 100644
--- a/kmscube/cube-x11.cpp
+++ b/kmscube/cube-x11.cpp
@@ -1,6 +1,7 @@
#include <X11/Xlib-xcb.h>
+#include "cube.h"
#include "cube-egl.h"
#include "cube-gles2.h"
@@ -12,24 +13,32 @@ void main_x11()
{
Display* display = XOpenDisplay(NULL);
- xcb_connection_t *connection = XGetXCBConnection(display);
+ xcb_connection_t *c = XGetXCBConnection(display);
/* Get the first screen */
- const xcb_setup_t *setup = xcb_get_setup (connection);
+ const xcb_setup_t *setup = xcb_get_setup (c);
xcb_screen_t *screen = xcb_setup_roots_iterator (setup).data;
/* Create the window */
- uint32_t width = 600;
- uint32_t height = 600;
+ uint32_t width;
+ uint32_t height;
+
+ if (s_fullscreen) {
+ width = screen->width_in_pixels;
+ height = screen->height_in_pixels;
+ } else {
+ width = 600;
+ height = 600;
+ }
const uint32_t xcb_window_attrib_mask = XCB_CW_EVENT_MASK;
const uint32_t xcb_window_attrib_list[] = {
XCB_EVENT_MASK_EXPOSURE,
};
- xcb_window_t window = xcb_generate_id (connection);
- xcb_create_window (connection, /* Connection */
+ xcb_window_t window = xcb_generate_id (c);
+ xcb_create_window (c, /* Connection */
XCB_COPY_FROM_PARENT, /* depth (same as root)*/
window, /* window Id */
screen->root, /* parent window */
@@ -41,8 +50,22 @@ void main_x11()
xcb_window_attrib_mask,
xcb_window_attrib_list);
- xcb_map_window (connection, window);
- xcb_flush (connection);
+
+#if 0 // Doesn't work
+ if (s_fullscreen) {
+
+ xcb_intern_atom_cookie_t cookie = xcb_intern_atom(c, 0, 12, "_NET_WM_STATE");
+ xcb_intern_atom_reply_t* reply = xcb_intern_atom_reply(c, cookie, 0);
+
+ xcb_intern_atom_cookie_t cookie2 = xcb_intern_atom(c, 0, 24, "_NET_WM_STATE_FULLSCREEN");
+ xcb_intern_atom_reply_t* reply2 = xcb_intern_atom_reply(c, cookie2, 0);
+
+ xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, reply->atom, XCB_ATOM_ATOM , 32, 1, (void*)&reply2->atom);
+ }
+#endif
+
+ xcb_map_window (c, window);
+ xcb_flush (c);
EglState egl(display);
EglSurface surface(egl, (void*)(uintptr_t)window);
@@ -56,12 +79,12 @@ void main_x11()
surface.swap_buffers();
xcb_generic_event_t *event;
- while ( (event = xcb_poll_for_event (connection)) ) {
+ while ( (event = xcb_poll_for_event (c)) ) {
surface.make_current();
scene.draw(framenum++);
surface.swap_buffers();
}
- xcb_disconnect (connection);
+ xcb_disconnect (c);
}
diff --git a/kmscube/cube.cpp b/kmscube/cube.cpp
index 14c340a..eb2f613 100644
--- a/kmscube/cube.cpp
+++ b/kmscube/cube.cpp
@@ -32,6 +32,7 @@
using namespace std;
bool s_verbose;
+bool s_fullscreen;
int main(int argc, char *argv[])
{
@@ -41,6 +42,11 @@ int main(int argc, char *argv[])
{
s_verbose = true;
}),
+ Option("f|fullscreen",
+ [&]()
+ {
+ s_fullscreen = true;
+ }),
};
optionset.parse(argc, argv);
diff --git a/kmscube/cube.h b/kmscube/cube.h
index 8245f0b..9a2acb7 100644
--- a/kmscube/cube.h
+++ b/kmscube/cube.h
@@ -1,6 +1,7 @@
#pragma once
extern bool s_verbose;
+extern bool s_fullscreen;
void main_null();
void main_gbm();