aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/session/session.c8
-rw-r--r--backend/x11/output.c23
-rw-r--r--include/backend/drm/drm.h4
-rw-r--r--include/wlr/backend/drm.h6
-rw-r--r--include/wlr/types/wlr_xdg_shell.h7
-rw-r--r--rootston/keyboard.c42
-rw-r--r--rootston/output.c2
7 files changed, 58 insertions, 34 deletions
diff --git a/backend/session/session.c b/backend/session/session.c
index 8d74bafe..f1cce8bc 100644
--- a/backend/session/session.c
+++ b/backend/session/session.c
@@ -220,17 +220,9 @@ static int open_if_kms(struct wlr_session *restrict session, const char *restric
goto out_fd;
}
- if (res->count_crtcs <= 0 || res->count_connectors <= 0 ||
- res->count_encoders <= 0) {
-
- goto out_res;
- }
-
drmModeFreeResources(res);
return fd;
-out_res:
- drmModeFreeResources(res);
out_fd:
wlr_session_close_file(session, fd);
return -1;
diff --git a/backend/x11/output.c b/backend/x11/output.c
index 151807dd..b678296d 100644
--- a/backend/x11/output.c
+++ b/backend/x11/output.c
@@ -121,6 +121,9 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) {
struct wlr_output *wlr_output = &output->wlr_output;
wlr_output_init(wlr_output, &x11->backend, &output_impl, x11->wl_display);
+ wlr_output->width = 1024;
+ wlr_output->height = 768;
+
output_set_refresh(&output->wlr_output, 0);
snprintf(wlr_output->name, sizeof(wlr_output->name), "X11-%d",
@@ -137,8 +140,8 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) {
};
output->win = xcb_generate_id(x11->xcb_conn);
xcb_create_window(x11->xcb_conn, XCB_COPY_FROM_PARENT, output->win,
- x11->screen->root, 0, 0, 1024, 768, 1, XCB_WINDOW_CLASS_INPUT_OUTPUT,
- x11->screen->root_visual, mask, values);
+ x11->screen->root, 0, 0, wlr_output->width, wlr_output->height, 1,
+ XCB_WINDOW_CLASS_INPUT_OUTPUT, x11->screen->root_visual, mask, values);
output->surf = wlr_egl_create_surface(&x11->egl, &output->win);
if (!output->surf) {
@@ -187,11 +190,17 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) {
void handle_x11_configure_notify(struct wlr_x11_output *output,
xcb_configure_notify_event_t *ev) {
- wlr_output_update_custom_mode(&output->wlr_output, ev->width,
- ev->height, output->wlr_output.refresh);
-
- // Move the pointer to its new location
- update_x11_pointer_position(output, output->x11->time);
+ // ignore events that set an invalid size:
+ if (ev->width > 0 && ev->height > 0) {
+ wlr_output_update_custom_mode(&output->wlr_output, ev->width,
+ ev->height, output->wlr_output.refresh);
+
+ // Move the pointer to its new location
+ update_x11_pointer_position(output, output->x11->time);
+ } else {
+ wlr_log(WLR_DEBUG,"Ignoring X11 configure event for height=%d, width=%d",
+ ev->width, ev->height);
+ }
}
bool wlr_output_is_x11(struct wlr_output *wlr_output) {
diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h
index 416507ea..5d6ff231 100644
--- a/include/backend/drm/drm.h
+++ b/include/backend/drm/drm.h
@@ -143,9 +143,5 @@ void restore_drm_outputs(struct wlr_drm_backend *drm);
void scan_drm_connectors(struct wlr_drm_backend *state);
int handle_drm_event(int fd, uint32_t mask, void *data);
void enable_drm_connector(struct wlr_output *output, bool enable);
-/**
- * Add mode to the list of available modes
- */
-bool wlr_drm_connector_add_mode(struct wlr_output *output, const drmModeModeInfo *mode);
#endif
diff --git a/include/wlr/backend/drm.h b/include/wlr/backend/drm.h
index a8a5525e..5d47647d 100644
--- a/include/wlr/backend/drm.h
+++ b/include/wlr/backend/drm.h
@@ -28,6 +28,12 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
bool wlr_backend_is_drm(struct wlr_backend *backend);
bool wlr_output_is_drm(struct wlr_output *output);
+/**
+ * Add mode to the list of available modes
+ */
+typedef struct _drmModeModeInfo drmModeModeInfo;
+bool wlr_drm_connector_add_mode(struct wlr_output *output, const drmModeModeInfo *mode);
+
struct wlr_session *wlr_drm_backend_get_session(struct wlr_backend *backend);
#endif
diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h
index a067c62e..6304bfc1 100644
--- a/include/wlr/types/wlr_xdg_shell.h
+++ b/include/wlr/types/wlr_xdg_shell.h
@@ -300,13 +300,6 @@ uint32_t wlr_xdg_toplevel_set_tiled(struct wlr_xdg_surface *surface,
void wlr_xdg_surface_send_close(struct wlr_xdg_surface *surface);
/**
- * Compute the popup position in its parent's surface-local coordinate system.
- * This aborts if called for popups whose parent is not an xdg_surface.
- */
-void wlr_xdg_surface_popup_get_position(struct wlr_xdg_surface *surface,
- double *popup_sx, double *popup_sy);
-
-/**
* Get the geometry for this positioner based on the anchor rect, gravity, and
* size of this positioner.
*/
diff --git a/rootston/keyboard.c b/rootston/keyboard.c
index 40d4a7c7..b5a8093b 100644
--- a/rootston/keyboard.c
+++ b/rootston/keyboard.c
@@ -2,6 +2,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
+#include <sys/wait.h>
#include <unistd.h>
#include <wayland-server.h>
#include <wlr/backend/multi.h>
@@ -84,6 +85,39 @@ static void pressed_keysyms_update(xkb_keysym_t *pressed_keysyms,
}
}
+static void double_fork_shell_cmd(const char *shell_cmd) {
+ pid_t pid = fork();
+ if (pid < 0) {
+ wlr_log(WLR_ERROR, "cannot execute binding command: fork() failed");
+ return;
+ }
+
+ if (pid == 0) {
+ pid = fork();
+ if (pid == 0) {
+ execl("/bin/sh", "/bin/sh", "-c", shell_cmd, NULL);
+ _exit(EXIT_FAILURE);
+ } else {
+ _exit(pid == -1);
+ }
+ }
+
+ int status;
+ while (waitpid(pid, &status, 0) < 0) {
+ if (errno == EINTR) {
+ continue;
+ }
+ wlr_log_errno(WLR_ERROR, "waitpid() on first child failed");
+ return;
+ }
+
+ if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
+ return;
+ }
+
+ wlr_log(WLR_ERROR, "first child failed to fork command");
+}
+
static const char *exec_prefix = "exec ";
static bool outputs_enabled = true;
@@ -113,13 +147,7 @@ static void keyboard_binding_execute(struct roots_keyboard *keyboard,
}
} else if (strncmp(exec_prefix, command, strlen(exec_prefix)) == 0) {
const char *shell_cmd = command + strlen(exec_prefix);
- pid_t pid = fork();
- if (pid < 0) {
- wlr_log(WLR_ERROR, "cannot execute binding command: fork() failed");
- return;
- } else if (pid == 0) {
- execl("/bin/sh", "/bin/sh", "-c", shell_cmd, (void *)NULL);
- }
+ double_fork_shell_cmd(shell_cmd);
} else if (strcmp(command, "maximize") == 0) {
struct roots_view *focus = roots_seat_get_focus(seat);
if (focus != NULL) {
diff --git a/rootston/output.c b/rootston/output.c
index 71ccf8bc..d8edf1c2 100644
--- a/rootston/output.c
+++ b/rootston/output.c
@@ -3,6 +3,7 @@
#include <stdbool.h>
#include <stdlib.h>
#include <time.h>
+#include <wlr/backend/drm.h>
#include <wlr/config.h>
#include <wlr/types/wlr_matrix.h>
#include <wlr/types/wlr_compositor.h>
@@ -16,7 +17,6 @@
#include "rootston/layers.h"
#include "rootston/output.h"
#include "rootston/server.h"
-#include "backend/drm/drm.h"
/**
* Rotate a child's position relative to a parent. The parent size is (pw, ph),