Implement Xinerama (workspaces have a specific screen)

This commit is contained in:
Michael Stapelberg
2009-02-15 01:58:09 +01:00
parent feaef42694
commit 09cd7bd2d0
11 changed files with 319 additions and 107 deletions

View File

@ -26,6 +26,8 @@ typedef struct Container Container;
typedef struct Client Client;
typedef struct Binding Binding;
typedef struct Workspace Workspace;
typedef struct Rect Rect;
typedef struct Screen i3Screen;
/* Helper types */
typedef enum { D_LEFT, D_RIGHT, D_UP, D_DOWN } direction_t;
@ -42,13 +44,14 @@ enum {
BIND_MODE_SWITCH = (1 << 8)
};
struct Rect {
uint32_t x, y;
uint32_t width, height;
};
struct Workspace {
int x;
int y;
int width;
int height;
int screen_num;
int num;
/* x, y, width, height */
Rect rect;
/* table dimensions */
int cols;
@ -60,6 +63,9 @@ struct Workspace {
Client *fullscreen_client;
/* Backpointer to the screen this workspace is on */
i3Screen *screen;
/* This is a two-dimensional dynamic array of Container-pointers. Ive always wanted
* to be a three-star programmer :) */
Container ***table;
@ -114,8 +120,8 @@ struct Client {
/* Backpointer. A client is inside a container */
Container *container;
uint32_t x, y;
uint32_t width, height;
/* x, y, width, height */
Rect rect;
/* Name */
char *name;
@ -170,4 +176,17 @@ struct Container {
CIRCLEQ_HEAD(client_head, Client) clients;
};
struct Screen {
/* Virtual screen number */
int num;
/* Current workspace selected on this virtual screen */
int current_workspace;
/* x, y, width, height */
Rect rect;
TAILQ_ENTRY(Screen) screens;
};
#endif

View File

@ -9,6 +9,7 @@
*
*/
#include <stdbool.h>
#include "data.h"
#ifndef _TABLE_H

View File

@ -15,9 +15,12 @@
#ifndef _UTIL_H
#define _UTIL_H
int min(int a, int b);
int max(int a, int b);
void start_application(const char *command);
void check_error(xcb_connection_t *connection, xcb_void_cookie_t cookie, char *err_message);
void set_focus(xcb_connection_t *conn, Client *client);
void warp_pointer_into(xcb_connection_t *connection, Client *client);
void toggle_fullscreen(xcb_connection_t *conn, Client *client);
#endif

23
include/xinerama.h Normal file
View File

@ -0,0 +1,23 @@
/*
* vim:ts=8:expandtab
*
* i3 - an improved dynamic tiling window manager
*
* (c) 2009 Michael Stapelberg and contributors
*
* See file LICENSE for license information.
*
*/
#include "data.h"
#ifndef _XINERAMA_H
#define _XINERAMA_H
TAILQ_HEAD(screens_head, Screen);
extern struct screens_head virtual_screens;
void initialize_xinerama(xcb_connection_t *conn);
i3Screen *get_screen_at(int x, int y);
i3Screen *get_screen_containing(int x, int y);
#endif