mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-11 13:50:48 -05:00
Move more to xcb.
This commit is contained in:
parent
305829fcc8
commit
a02cb83a98
7 changed files with 134 additions and 78 deletions
|
@ -83,9 +83,8 @@ dnl ---------------------------------------------------------------------
|
||||||
dnl X11, Glib, Xinerama, Pango, Cairo, libstartup notification
|
dnl X11, Glib, Xinerama, Pango, Cairo, libstartup notification
|
||||||
dnl ---------------------------------------------------------------------
|
dnl ---------------------------------------------------------------------
|
||||||
PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.40])
|
PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.40])
|
||||||
GW_CHECK_XCB([xcb-aux xcb-xkb xkbcommon xkbcommon-x11 xcb-ewmh])
|
GW_CHECK_XCB([xcb-aux xcb-xkb xkbcommon xkbcommon-x11 xcb-ewmh xcb-xinerama])
|
||||||
PKG_CHECK_MODULES([x11], [x11 x11-xcb])
|
PKG_CHECK_MODULES([x11], [x11 x11-xcb])
|
||||||
PKG_CHECK_MODULES([xinerama], [xinerama])
|
|
||||||
PKG_CHECK_MODULES([pango], [pango pangocairo])
|
PKG_CHECK_MODULES([pango], [pango pangocairo])
|
||||||
PKG_CHECK_MODULES([cairo], [cairo cairo-xcb])
|
PKG_CHECK_MODULES([cairo], [cairo cairo-xcb])
|
||||||
PKG_CHECK_MODULES([libsn], [libstartup-notification-1.0])
|
PKG_CHECK_MODULES([libsn], [libstartup-notification-1.0])
|
||||||
|
|
|
@ -73,17 +73,17 @@ typedef struct
|
||||||
int l, r, t, b;
|
int l, r, t, b;
|
||||||
} workarea;
|
} workarea;
|
||||||
|
|
||||||
void monitor_active ( Display *display, workarea *mon );
|
void monitor_active ( xcb_connection_t *xcb_connection, workarea *mon );
|
||||||
|
|
||||||
int window_send_message ( Display *display, Window target, Window subject,
|
int window_send_message ( Display *display, Window target, Window subject,
|
||||||
Atom atom, unsigned long protocol,
|
Atom atom, unsigned long protocol,
|
||||||
unsigned long mask, Time time );
|
unsigned long mask, Time time );
|
||||||
|
|
||||||
// find the dimensions of the monitor displaying point x,y
|
// find the dimensions of the monitor displaying point x,y
|
||||||
void monitor_dimensions ( Display *display, Screen *screen, int x, int y, workarea *mon );
|
void monitor_dimensions ( xcb_connection_t *xcb_connection, xcb_screen_t *screen, int x, int y, workarea *mon );
|
||||||
// Find the dimensions of the monitor specified by user.
|
// Find the dimensions of the monitor specified by user.
|
||||||
int monitor_get_dimension ( Display *display, Screen *screen, int monitor, workarea *mon );
|
int monitor_get_dimension ( xcb_connection_t *xcb_connection, xcb_screen_t *screen, int monitor, workarea *mon );
|
||||||
int monitor_get_smallest_size ( Display *display );
|
int monitor_get_smallest_size ( xcb_connection_t *xcb_connection );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param display The display.
|
* @param display The display.
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <xcb/xcb.h>
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
@ -55,6 +56,7 @@
|
||||||
#define CLIENTWINDOWTYPE 10
|
#define CLIENTWINDOWTYPE 10
|
||||||
#define CLIENTROLE 50
|
#define CLIENTROLE 50
|
||||||
|
|
||||||
|
extern xcb_screen_t *xcb_screen;
|
||||||
// a manageable window
|
// a manageable window
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -306,7 +308,7 @@ static client* window_client ( Display *display, Window win )
|
||||||
XFree ( wh );
|
XFree ( wh );
|
||||||
}
|
}
|
||||||
|
|
||||||
monitor_dimensions ( display, c->xattr.screen, c->xattr.x, c->xattr.y, &c->monitor );
|
monitor_dimensions ( xcb_connection, xcb_screen, c->xattr.x, c->xattr.y, &c->monitor );
|
||||||
winlist_append ( cache_client, c->window, c );
|
winlist_append ( cache_client, c->window, c );
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,12 +39,15 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <xcb/xcb.h>
|
||||||
#include "helper.h"
|
#include "helper.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "x11-helper.h"
|
#include "x11-helper.h"
|
||||||
#include "rofi.h"
|
#include "rofi.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
|
|
||||||
|
extern xcb_connection_t *xcb_connection;
|
||||||
|
extern xcb_screen_t *xcb_screen;
|
||||||
static int stored_argc = 0;
|
static int stored_argc = 0;
|
||||||
static char **stored_argv = NULL;
|
static char **stored_argv = NULL;
|
||||||
|
|
||||||
|
@ -559,10 +562,10 @@ int config_sanity_check ( Display *display )
|
||||||
|
|
||||||
// Check size
|
// Check size
|
||||||
{
|
{
|
||||||
int ssize = monitor_get_smallest_size ( display );
|
int ssize = monitor_get_smallest_size ( xcb_connection );
|
||||||
if ( config.monitor >= 0 ) {
|
if ( config.monitor >= 0 ) {
|
||||||
workarea mon;
|
workarea mon;
|
||||||
if ( monitor_get_dimension ( display, DefaultScreenOfDisplay ( display ), config.monitor, &mon ) ) {
|
if ( monitor_get_dimension ( xcb_connection, xcb_screen, config.monitor, &mon ) ) {
|
||||||
ssize = MIN ( mon.w, mon.h );
|
ssize = MIN ( mon.w, mon.h );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
|
@ -79,6 +79,7 @@ SnLauncheeContext *sncontext = NULL;
|
||||||
xcb_connection_t *xcb_connection = NULL;
|
xcb_connection_t *xcb_connection = NULL;
|
||||||
xcb_ewmh_connection_t xcb_ewmh;
|
xcb_ewmh_connection_t xcb_ewmh;
|
||||||
xcb_screen_t *xcb_screen = NULL;
|
xcb_screen_t *xcb_screen = NULL;
|
||||||
|
int xcb_screen_nbr = -1;
|
||||||
struct xkb_stuff xkb = { NULL };
|
struct xkb_stuff xkb = { NULL };
|
||||||
Display *display = NULL;
|
Display *display = NULL;
|
||||||
char *display_str = NULL;
|
char *display_str = NULL;
|
||||||
|
@ -658,6 +659,7 @@ int main ( int argc, char *argv[] )
|
||||||
|
|
||||||
xcb_connection = XGetXCBConnection ( display );
|
xcb_connection = XGetXCBConnection ( display );
|
||||||
xcb_screen = xcb_aux_get_screen ( xcb_connection, DefaultScreen ( display ) );
|
xcb_screen = xcb_aux_get_screen ( xcb_connection, DefaultScreen ( display ) );
|
||||||
|
xcb_screen_nbr = DefaultScreen (display);
|
||||||
|
|
||||||
xcb_intern_atom_cookie_t *ac = xcb_ewmh_init_atoms(xcb_connection, &xcb_ewmh);
|
xcb_intern_atom_cookie_t *ac = xcb_ewmh_init_atoms(xcb_connection, &xcb_ewmh);
|
||||||
xcb_generic_error_t **errors = NULL;
|
xcb_generic_error_t **errors = NULL;
|
||||||
|
|
|
@ -1553,7 +1553,7 @@ RofiViewState *rofi_view_create ( Mode *sw,
|
||||||
}
|
}
|
||||||
TICK_N ( "Startup notification" );
|
TICK_N ( "Startup notification" );
|
||||||
// Get active monitor size.
|
// Get active monitor size.
|
||||||
monitor_active ( display, &( state->mon ) );
|
monitor_active ( xcb_connection, &( state->mon ) );
|
||||||
TICK_N ( "Get active monitor" );
|
TICK_N ( "Get active monitor" );
|
||||||
if ( config.fake_transparency ) {
|
if ( config.fake_transparency ) {
|
||||||
rofi_view_setup_fake_transparency ( xcb_connection, xcb_screen, state );
|
rofi_view_setup_fake_transparency ( xcb_connection, xcb_screen, state );
|
||||||
|
@ -1707,7 +1707,7 @@ void rofi_view_error_dialog ( const char *msg, int markup )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Get active monitor size.
|
// Get active monitor size.
|
||||||
monitor_active ( display, &( state->mon ) );
|
monitor_active ( xcb_connection, &( state->mon ) );
|
||||||
if ( config.fake_transparency ) {
|
if ( config.fake_transparency ) {
|
||||||
rofi_view_setup_fake_transparency ( xcb_connection, xcb_screen, state );
|
rofi_view_setup_fake_transparency ( xcb_connection, xcb_screen, state );
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include <cairo.h>
|
#include <cairo.h>
|
||||||
|
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
|
#include <xcb/xinerama.h>
|
||||||
#include <xcb/xcb_ewmh.h>
|
#include <xcb/xcb_ewmh.h>
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
|
@ -44,7 +45,6 @@
|
||||||
#include <X11/Xproto.h>
|
#include <X11/Xproto.h>
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
#include <X11/XKBlib.h>
|
#include <X11/XKBlib.h>
|
||||||
#include <X11/extensions/Xinerama.h>
|
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
#include <rofi.h>
|
#include <rofi.h>
|
||||||
|
@ -164,75 +164,126 @@ int window_get_cardinal_prop ( Display *display, Window w, Atom atom, unsigned l
|
||||||
Atom type; int items;
|
Atom type; int items;
|
||||||
return window_get_prop ( display, w, atom, &type, &items, list, count * sizeof ( unsigned long ) ) && type == XA_CARDINAL ? items : 0;
|
return window_get_prop ( display, w, atom, &type, &items, list, count * sizeof ( unsigned long ) ) && type == XA_CARDINAL ? items : 0;
|
||||||
}
|
}
|
||||||
int monitor_get_smallest_size ( Display *display )
|
extern xcb_screen_t *xcb_screen;
|
||||||
|
extern int xcb_screen_nbr;
|
||||||
|
int monitor_get_smallest_size ( xcb_connection_t *xcb_connection )
|
||||||
{
|
{
|
||||||
int size = MIN ( WidthOfScreen ( DefaultScreenOfDisplay ( display ) ),
|
xcb_generic_error_t *error;
|
||||||
HeightOfScreen ( DefaultScreenOfDisplay ( display ) ) );
|
int size = MIN (xcb_screen->width_in_pixels, xcb_screen->height_in_pixels);
|
||||||
// locate the current monitor
|
xcb_xinerama_is_active_cookie_t is_active_req = xcb_xinerama_is_active(xcb_connection);
|
||||||
if ( XineramaIsActive ( display ) ) {
|
xcb_xinerama_is_active_reply_t *is_active = xcb_xinerama_is_active_reply(xcb_connection, is_active_req, &error);
|
||||||
int monitors;
|
if (error) {
|
||||||
XineramaScreenInfo *info = XineramaQueryScreens ( display, &monitors );
|
fprintf(stderr, "Couldn't query Xinerama\n");
|
||||||
|
return size;
|
||||||
if ( info ) {
|
|
||||||
for ( int i = 0; i < monitors; i++ ) {
|
|
||||||
size = MIN ( info[i].width, size );
|
|
||||||
size = MIN ( info[i].height, size );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
XFree ( info );
|
|
||||||
}
|
}
|
||||||
|
if (!is_active->state) {
|
||||||
|
free ( is_active );
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
free ( is_active );
|
||||||
|
|
||||||
|
xcb_xinerama_query_screens_cookie_t cookie_screen;
|
||||||
|
cookie_screen = xcb_xinerama_query_screens(xcb_connection);
|
||||||
|
xcb_xinerama_query_screens_reply_t *query_screens;
|
||||||
|
query_screens = xcb_xinerama_query_screens_reply(xcb_connection, cookie_screen, &error);
|
||||||
|
if (error) {
|
||||||
|
fprintf(stderr, "Error getting screen info\n");
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
xcb_xinerama_screen_info_t *screens = xcb_xinerama_query_screens_screen_info(query_screens);
|
||||||
|
int len = xcb_xinerama_query_screens_screen_info_length(query_screens);
|
||||||
|
for (int i = 0; i < len; i++) {
|
||||||
|
xcb_xinerama_screen_info_t *info = &screens[i];
|
||||||
|
size = MIN ( info->width, size );
|
||||||
|
size = MIN ( info->height, size );
|
||||||
|
}
|
||||||
|
free(query_screens);
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
int monitor_get_dimension ( Display *display, Screen *screen, int monitor, workarea *mon )
|
int monitor_get_dimension ( xcb_connection_t *xcb_connection, xcb_screen_t *screen, int monitor, workarea *mon )
|
||||||
{
|
{
|
||||||
|
xcb_generic_error_t *error = NULL;
|
||||||
memset ( mon, 0, sizeof ( workarea ) );
|
memset ( mon, 0, sizeof ( workarea ) );
|
||||||
mon->w = WidthOfScreen ( screen );
|
mon->w = screen->width_in_pixels;
|
||||||
mon->h = HeightOfScreen ( screen );
|
mon->h = screen->height_in_pixels;
|
||||||
// locate the current monitor
|
|
||||||
if ( XineramaIsActive ( display ) ) {
|
|
||||||
int monitors;
|
|
||||||
XineramaScreenInfo *info = XineramaQueryScreens ( display, &monitors );
|
|
||||||
|
|
||||||
if ( info ) {
|
xcb_xinerama_is_active_cookie_t is_active_req = xcb_xinerama_is_active(xcb_connection);
|
||||||
if ( monitor >= 0 && monitor < monitors ) {
|
xcb_xinerama_is_active_reply_t *is_active = xcb_xinerama_is_active_reply(xcb_connection, is_active_req, &error);
|
||||||
mon->x = info[monitor].x_org;
|
if (error) {
|
||||||
mon->y = info[monitor].y_org;
|
fprintf(stderr, "Error getting screen info\n");
|
||||||
mon->w = info[monitor].width;
|
return FALSE;
|
||||||
mon->h = info[monitor].height;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
XFree ( info );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (!is_active->state) {
|
||||||
|
free ( is_active );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
free ( is_active );
|
||||||
|
|
||||||
|
xcb_xinerama_query_screens_cookie_t cookie_screen;
|
||||||
|
cookie_screen = xcb_xinerama_query_screens(xcb_connection);
|
||||||
|
xcb_xinerama_query_screens_reply_t *query_screens;
|
||||||
|
query_screens = xcb_xinerama_query_screens_reply(xcb_connection, cookie_screen, &error);
|
||||||
|
if (error) {
|
||||||
|
fprintf(stderr, "Error getting screen info\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
xcb_xinerama_screen_info_t *screens = xcb_xinerama_query_screens_screen_info(query_screens);
|
||||||
|
int len = xcb_xinerama_query_screens_screen_info_length(query_screens);
|
||||||
|
if ( monitor < len ) {
|
||||||
|
xcb_xinerama_screen_info_t *info = &screens[monitor];
|
||||||
|
mon->w = info->width;
|
||||||
|
mon->h = info->height;
|
||||||
|
mon->x = info->x_org;
|
||||||
|
mon->y = info->y_org;
|
||||||
|
free(query_screens);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
free(query_screens);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
// find the dimensions of the monitor displaying point x,y
|
// find the dimensions of the monitor displaying point x,y
|
||||||
void monitor_dimensions ( Display *display, Screen *screen, int x, int y, workarea *mon )
|
void monitor_dimensions ( xcb_connection_t *xcb_connection, xcb_screen_t *screen, int x, int y, workarea *mon )
|
||||||
{
|
{
|
||||||
|
xcb_generic_error_t *error = NULL;
|
||||||
memset ( mon, 0, sizeof ( workarea ) );
|
memset ( mon, 0, sizeof ( workarea ) );
|
||||||
mon->w = WidthOfScreen ( screen );
|
mon->w = screen->width_in_pixels;
|
||||||
mon->h = HeightOfScreen ( screen );
|
mon->h = screen->height_in_pixels;
|
||||||
|
|
||||||
// locate the current monitor
|
xcb_xinerama_is_active_cookie_t is_active_req = xcb_xinerama_is_active(xcb_connection);
|
||||||
if ( XineramaIsActive ( display ) ) {
|
xcb_xinerama_is_active_reply_t *is_active = xcb_xinerama_is_active_reply(xcb_connection, is_active_req, &error);
|
||||||
int monitors;
|
if (error) {
|
||||||
XineramaScreenInfo *info = XineramaQueryScreens ( display, &monitors );
|
fprintf(stderr, "Couldn't query Xinerama\n");
|
||||||
|
return ;
|
||||||
if ( info ) {
|
|
||||||
for ( int i = 0; i < monitors; i++ ) {
|
|
||||||
if ( INTERSECT ( x, y, 1, 1, info[i].x_org, info[i].y_org, info[i].width, info[i].height ) ) {
|
|
||||||
mon->x = info[i].x_org;
|
|
||||||
mon->y = info[i].y_org;
|
|
||||||
mon->w = info[i].width;
|
|
||||||
mon->h = info[i].height;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
XFree ( info );
|
|
||||||
}
|
}
|
||||||
|
if (!is_active->state) {
|
||||||
|
free ( is_active );
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
free ( is_active );
|
||||||
|
|
||||||
|
xcb_xinerama_query_screens_cookie_t cookie_screen;
|
||||||
|
cookie_screen = xcb_xinerama_query_screens(xcb_connection);
|
||||||
|
xcb_xinerama_query_screens_reply_t *query_screens;
|
||||||
|
query_screens = xcb_xinerama_query_screens_reply(xcb_connection, cookie_screen, &error);
|
||||||
|
if (error) {
|
||||||
|
fprintf(stderr, "Error getting screen info\n");
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
xcb_xinerama_screen_info_t *screens = xcb_xinerama_query_screens_screen_info(query_screens);
|
||||||
|
int len = xcb_xinerama_query_screens_screen_info_length(query_screens);
|
||||||
|
for ( int i = 0; i < len; i++){
|
||||||
|
xcb_xinerama_screen_info_t *info = &screens[i];
|
||||||
|
if ( INTERSECT ( x, y, 1, 1, info->x_org, info->y_org, info->width, info->height ) ) {
|
||||||
|
mon->w = info->width;
|
||||||
|
mon->h = info->height;
|
||||||
|
mon->x = info->x_org;
|
||||||
|
mon->y = info->y_org;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(query_screens);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -243,7 +294,7 @@ void monitor_dimensions ( Display *display, Screen *screen, int x, int y, workar
|
||||||
*
|
*
|
||||||
* @returns 1 when found
|
* @returns 1 when found
|
||||||
*/
|
*/
|
||||||
static int pointer_get ( Display *display, Window root, int *x, int *y )
|
static int pointer_get ( xcb_connection_t *xcb_connection, Window root, int *x, int *y )
|
||||||
{
|
{
|
||||||
*x = 0;
|
*x = 0;
|
||||||
*y = 0;
|
*y = 0;
|
||||||
|
@ -260,14 +311,13 @@ static int pointer_get ( Display *display, Window root, int *x, int *y )
|
||||||
}
|
}
|
||||||
|
|
||||||
// determine which monitor holds the active window, or failing that the mouse pointer
|
// determine which monitor holds the active window, or failing that the mouse pointer
|
||||||
void monitor_active ( Display *display, workarea *mon )
|
void monitor_active ( xcb_connection_t *xcb_connection, workarea *mon )
|
||||||
{
|
{
|
||||||
Screen *screen = DefaultScreenOfDisplay ( display );
|
xcb_window_t root = xcb_screen->root;
|
||||||
Window root = RootWindow ( display, XScreenNumberOfScreen ( screen ) );
|
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
if ( config.monitor >= 0 ) {
|
if ( config.monitor >= 0 ) {
|
||||||
if ( monitor_get_dimension ( display, screen, config.monitor, mon ) ) {
|
if ( monitor_get_dimension ( xcb_connection, xcb_screen, config.monitor, mon ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fprintf ( stderr, "Failed to find selected monitor.\n" );
|
fprintf ( stderr, "Failed to find selected monitor.\n" );
|
||||||
|
@ -275,13 +325,13 @@ void monitor_active ( Display *display, workarea *mon )
|
||||||
// Get the current desktop.
|
// Get the current desktop.
|
||||||
unsigned int current_desktop = 0;
|
unsigned int current_desktop = 0;
|
||||||
if ( config.monitor != -2 && xcb_ewmh_get_current_desktop_reply ( &xcb_ewmh,
|
if ( config.monitor != -2 && xcb_ewmh_get_current_desktop_reply ( &xcb_ewmh,
|
||||||
xcb_ewmh_get_current_desktop( &xcb_ewmh, XScreenNumberOfScreen ( screen )), ¤t_desktop, NULL )) {
|
xcb_ewmh_get_current_desktop( &xcb_ewmh, xcb_screen_nbr), ¤t_desktop, NULL )) {
|
||||||
xcb_ewmh_get_desktop_viewport_reply_t vp;
|
xcb_ewmh_get_desktop_viewport_reply_t vp;
|
||||||
if ( xcb_ewmh_get_desktop_viewport_reply ( &xcb_ewmh,
|
if ( xcb_ewmh_get_desktop_viewport_reply ( &xcb_ewmh,
|
||||||
xcb_ewmh_get_desktop_viewport(&xcb_ewmh, XScreenNumberOfScreen ( screen ) ),
|
xcb_ewmh_get_desktop_viewport(&xcb_ewmh, xcb_screen_nbr),
|
||||||
&vp, NULL)){
|
&vp, NULL)){
|
||||||
if ( current_desktop < vp.desktop_viewport_len) {
|
if ( current_desktop < vp.desktop_viewport_len) {
|
||||||
monitor_dimensions ( display, screen, vp.desktop_viewport[current_desktop].x,
|
monitor_dimensions ( xcb_connection, xcb_screen, vp.desktop_viewport[current_desktop].x,
|
||||||
vp.desktop_viewport[current_desktop].y, mon );
|
vp.desktop_viewport[current_desktop].y, mon );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -290,7 +340,7 @@ void monitor_active ( Display *display, workarea *mon )
|
||||||
|
|
||||||
xcb_window_t active_window;
|
xcb_window_t active_window;
|
||||||
if ( xcb_ewmh_get_active_window_reply ( &xcb_ewmh,
|
if ( xcb_ewmh_get_active_window_reply ( &xcb_ewmh,
|
||||||
xcb_ewmh_get_active_window( &xcb_ewmh, XScreenNumberOfScreen ( screen )), &active_window, NULL )) {
|
xcb_ewmh_get_active_window( &xcb_ewmh, xcb_screen_nbr), &active_window, NULL )) {
|
||||||
// get geometry.
|
// get geometry.
|
||||||
xcb_get_geometry_cookie_t c = xcb_get_geometry ( xcb_connection, active_window);
|
xcb_get_geometry_cookie_t c = xcb_get_geometry ( xcb_connection, active_window);
|
||||||
xcb_get_geometry_reply_t *r = xcb_get_geometry_reply ( xcb_connection, c, NULL);
|
xcb_get_geometry_reply_t *r = xcb_get_geometry_reply ( xcb_connection, c, NULL);
|
||||||
|
@ -315,17 +365,17 @@ void monitor_active ( Display *display, workarea *mon )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
monitor_dimensions ( display, screen, r->x, r->y, mon );
|
monitor_dimensions ( xcb_connection, xcb_screen, r->x, r->y, mon );
|
||||||
free(r);
|
free(r);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( pointer_get ( display, root, &x, &y ) ) {
|
if ( pointer_get ( xcb_connection, root, &x, &y ) ) {
|
||||||
monitor_dimensions ( display, screen, x, y, mon );
|
monitor_dimensions ( xcb_connection, xcb_screen, x, y, mon );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
monitor_dimensions ( display, screen, 0, 0, mon );
|
monitor_dimensions ( xcb_connection, xcb_screen, 0, 0, mon );
|
||||||
}
|
}
|
||||||
|
|
||||||
int window_send_message ( Display *display, Window trg, Window subject, Atom atom, unsigned long protocol, unsigned long mask, Time time )
|
int window_send_message ( Display *display, Window trg, Window subject, Atom atom, unsigned long protocol, unsigned long mask, Time time )
|
||||||
|
|
Loading…
Reference in a new issue