Пример #1
0
static void
set_fullscreen(struct window *window, int fullscreen)
{
	struct wl_callback *callback;

	window->fullscreen = fullscreen;
	window->configured = 0;

	if (fullscreen) {
		wl_shell_surface_set_fullscreen(window->shell_surface,
						WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
						0, NULL);
		callback = wl_display_sync(window->display->display);
		wl_callback_add_listener(callback,
					 &configure_callback_listener,
					 window);

	} else {
		wl_shell_surface_set_toplevel(window->shell_surface);
		handle_configure(window, window->shell_surface, 0,
				 window->window_size.width,
				 window->window_size.height);
		window->configured = 1;
	}
}
Пример #2
0
void handle(int fd) {
    char buf[200];
    ssize_t n_read;
    while((n_read = read(fd, buf, sizeof(buf))) > 0) {
        buf[n_read-1] = '\0';
        
        char* bufp = buf;
        char* cursor;
        while((cursor = strsep(&bufp, "\n")) != NULL) {
            int fdd = dup(fd);
            FILE* f = fdopen(fdd, "a");

            char command[20];
            char const* const remainder = flatjson_next(chomp(buf), command, sizeof(command), NULL);
            if(strcmp(command, "list") == 0) {
                handle_list(f, true);
            } else if(strcmp(command, "configure") == 0) {
                handle_configure(f, remainder);
            } else if(strcmp(command, "connect") == 0) {
                handle_connect(f, remainder);
            } else if(strcmp(command, "disconnect") == 0) {
                handle_disconnect(f, remainder);
            } else {
                warn("Unknown command");
            }

            fclose(f);
        }
    }
}
Пример #3
0
//
// Fish-out any configure events
//
void handle_configure_event(XEvent e, int screen, StateMachine *state)
{
	if (e.type == CreateNotify) {
		printf("EVENT: CreateNotify\n");
		if (e.xcreatewindow.parent == RootWindow(e.xany.display, screen)) {
			printf("Create for upper window\n");
			handle_configure(e.xany.display, e.xany.window, screen, state); // some client's don't call configure, so we need to capture them here
		} else {
			printf("ignoring creation for sub-window\n");
		}
	}
	
	else if (e.type == ConfigureNotify) {
		printf("EVENT: ConfigureNotify\n");
		handle_configure(e.xconfigure.display, e.xconfigure.event, screen, state);
	}
}
Пример #4
0
static void
toggle_fullscreen(bool fullscreen)
{
	GLWin.fullscreen = fullscreen;

	if (fullscreen) {
		wl_shell_surface_set_fullscreen(GLWin.wl_shell_surface,
						WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
						0, nullptr);
	} else {
		wl_shell_surface_set_toplevel(GLWin.wl_shell_surface);
		handle_configure(nullptr, GLWin.wl_shell_surface, 0,
				 GLWin.window_size.width,
				 GLWin.window_size.height);
	}
}
Пример #5
0
static void
toggle_fullscreen(bool fullscreen)
{
	GLWin.fullscreen = fullscreen;
	GLWin.configured = false;

	if (fullscreen) {
		wl_shell_surface_set_fullscreen(GLWin.wl_shell_surface,
						WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
						0, NULL);
	} else {
		wl_shell_surface_set_toplevel(GLWin.wl_shell_surface);
		handle_configure(NULL, GLWin.wl_shell_surface, 0,
				 GLWin.window_size.width,
				 GLWin.window_size.height);
	}

	setup_callback_listener();
}