get rid of xcb.c in all i3-* tools
open_input_window was slightly different for each of them, so it made no sense to generalize it (then we would end up with a thin and useless wrapper).
This commit is contained in:
parent
a58018cf66
commit
f4469eee0b
|
@ -57,6 +57,7 @@ enum { STEP_WELCOME, STEP_GENERATE } current_step = STEP_WELCOME;
|
||||||
enum { MOD_Mod1, MOD_Mod4 } modifier = MOD_Mod4;
|
enum { MOD_Mod1, MOD_Mod4 } modifier = MOD_Mod4;
|
||||||
|
|
||||||
static char *config_path;
|
static char *config_path;
|
||||||
|
static uint32_t xcb_numlock_mask;
|
||||||
xcb_connection_t *conn;
|
xcb_connection_t *conn;
|
||||||
static xcb_get_modifier_mapping_reply_t *modmap_reply;
|
static xcb_get_modifier_mapping_reply_t *modmap_reply;
|
||||||
static i3Font font;
|
static i3Font font;
|
||||||
|
@ -442,7 +443,25 @@ int main(int argc, char *argv[]) {
|
||||||
bold_font = load_font(patternbold, true);
|
bold_font = load_font(patternbold, true);
|
||||||
|
|
||||||
/* Open an input window */
|
/* Open an input window */
|
||||||
win = open_input_window(conn, 300, 205);
|
win = xcb_generate_id(conn);
|
||||||
|
xcb_create_window(
|
||||||
|
conn,
|
||||||
|
XCB_COPY_FROM_PARENT,
|
||||||
|
win, /* the window id */
|
||||||
|
root, /* parent == root */
|
||||||
|
490, 297, 300, 205, /* dimensions */
|
||||||
|
0, /* X11 border = 0, we draw our own */
|
||||||
|
XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
||||||
|
XCB_WINDOW_CLASS_COPY_FROM_PARENT, /* copy visual from parent */
|
||||||
|
XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK,
|
||||||
|
(uint32_t[]){
|
||||||
|
0, /* back pixel: black */
|
||||||
|
XCB_EVENT_MASK_EXPOSURE |
|
||||||
|
XCB_EVENT_MASK_BUTTON_PRESS
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Map the window (make it visible) */
|
||||||
|
xcb_map_window(conn, win);
|
||||||
|
|
||||||
/* Setup NetWM atoms */
|
/* Setup NetWM atoms */
|
||||||
#define xmacro(name) \
|
#define xmacro(name) \
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
/*
|
|
||||||
* vim:ts=8:expandtab
|
|
||||||
*
|
|
||||||
* i3 - an improved dynamic tiling window manager
|
|
||||||
*
|
|
||||||
* © 2009 Michael Stapelberg and contributors
|
|
||||||
*
|
|
||||||
* See file LICENSE for license information.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <err.h>
|
|
||||||
|
|
||||||
#include <xcb/xcb.h>
|
|
||||||
#include <xcb/xcb_keysyms.h>
|
|
||||||
|
|
||||||
#include <X11/keysym.h>
|
|
||||||
|
|
||||||
#include "xcb.h"
|
|
||||||
|
|
||||||
extern xcb_window_t root;
|
|
||||||
unsigned int xcb_numlock_mask;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Opens the window we use for input/output and maps it
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
xcb_window_t open_input_window(xcb_connection_t *conn, uint32_t width, uint32_t height) {
|
|
||||||
xcb_window_t win = xcb_generate_id(conn);
|
|
||||||
//xcb_cursor_t cursor_id = xcb_generate_id(conn);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* Use the default cursor (left pointer) */
|
|
||||||
if (cursor > -1) {
|
|
||||||
i3Font *cursor_font = load_font(conn, "cursor");
|
|
||||||
xcb_create_glyph_cursor(conn, cursor_id, cursor_font->id, cursor_font->id,
|
|
||||||
XCB_CURSOR_LEFT_PTR, XCB_CURSOR_LEFT_PTR + 1,
|
|
||||||
0, 0, 0, 65535, 65535, 65535);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint32_t mask = 0;
|
|
||||||
uint32_t values[3];
|
|
||||||
|
|
||||||
mask |= XCB_CW_BACK_PIXEL;
|
|
||||||
values[0] = 0;
|
|
||||||
|
|
||||||
mask |= XCB_CW_EVENT_MASK;
|
|
||||||
values[1] = XCB_EVENT_MASK_EXPOSURE |
|
|
||||||
XCB_EVENT_MASK_BUTTON_PRESS;
|
|
||||||
|
|
||||||
xcb_create_window(conn,
|
|
||||||
XCB_COPY_FROM_PARENT,
|
|
||||||
win, /* the window id */
|
|
||||||
root, /* parent == root */
|
|
||||||
490, 297, width, height, /* dimensions */
|
|
||||||
0, /* border = 0, we draw our own */
|
|
||||||
XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
XCB_WINDOW_CLASS_COPY_FROM_PARENT, /* copy visual from parent */
|
|
||||||
mask,
|
|
||||||
values);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (cursor > -1)
|
|
||||||
xcb_change_window_attributes(conn, result, XCB_CW_CURSOR, &cursor_id);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Map the window (= make it visible) */
|
|
||||||
xcb_map_window(conn, win);
|
|
||||||
|
|
||||||
return win;
|
|
||||||
}
|
|
|
@ -8,8 +8,4 @@
|
||||||
#include "atoms.xmacro"
|
#include "atoms.xmacro"
|
||||||
#undef xmacro
|
#undef xmacro
|
||||||
|
|
||||||
extern unsigned int xcb_numlock_mask;
|
|
||||||
|
|
||||||
xcb_window_t open_input_window(xcb_connection_t *conn, uint32_t width, uint32_t height);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,6 +16,5 @@ extern xcb_window_t root;
|
||||||
|
|
||||||
char *convert_ucs_to_utf8(char *input);
|
char *convert_ucs_to_utf8(char *input);
|
||||||
char *convert_utf8_to_ucs2(char *input, int *real_strlen);
|
char *convert_utf8_to_ucs2(char *input, int *real_strlen);
|
||||||
xcb_window_t open_input_window(xcb_connection_t *conn, uint32_t width, uint32_t height);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -366,7 +366,25 @@ int main(int argc, char *argv[]) {
|
||||||
font = load_font(pattern, true);
|
font = load_font(pattern, true);
|
||||||
|
|
||||||
/* Open an input window */
|
/* Open an input window */
|
||||||
win = open_input_window(conn, 500, font.height + 8);
|
win = xcb_generate_id(conn);
|
||||||
|
xcb_create_window(
|
||||||
|
conn,
|
||||||
|
XCB_COPY_FROM_PARENT,
|
||||||
|
win, /* the window id */
|
||||||
|
root, /* parent == root */
|
||||||
|
50, 50, 500, font.height + 8, /* dimensions */
|
||||||
|
0, /* X11 border = 0, we draw our own */
|
||||||
|
XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
||||||
|
XCB_WINDOW_CLASS_COPY_FROM_PARENT, /* copy visual from parent */
|
||||||
|
XCB_CW_BACK_PIXEL | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK,
|
||||||
|
(uint32_t[]){
|
||||||
|
0, /* back pixel: black */
|
||||||
|
1, /* override redirect: don’t manage this window */
|
||||||
|
XCB_EVENT_MASK_EXPOSURE
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Map the window (make it visible) */
|
||||||
|
xcb_map_window(conn, win);
|
||||||
|
|
||||||
/* Create pixmap */
|
/* Create pixmap */
|
||||||
pixmap = xcb_generate_id(conn);
|
pixmap = xcb_generate_id(conn);
|
||||||
|
|
|
@ -1,73 +0,0 @@
|
||||||
/*
|
|
||||||
* vim:ts=8:expandtab
|
|
||||||
*
|
|
||||||
* i3 - an improved dynamic tiling window manager
|
|
||||||
*
|
|
||||||
* © 2009 Michael Stapelberg and contributors
|
|
||||||
*
|
|
||||||
* See file LICENSE for license information.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <xcb/xcb.h>
|
|
||||||
#include <xcb/xcb_keysyms.h>
|
|
||||||
|
|
||||||
#include <X11/keysym.h>
|
|
||||||
|
|
||||||
#include "i3-input.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Opens the window we use for input/output and maps it
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
xcb_window_t open_input_window(xcb_connection_t *conn, uint32_t width, uint32_t height) {
|
|
||||||
xcb_window_t win = xcb_generate_id(conn);
|
|
||||||
//xcb_cursor_t cursor_id = xcb_generate_id(conn);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* Use the default cursor (left pointer) */
|
|
||||||
if (cursor > -1) {
|
|
||||||
i3Font *cursor_font = load_font(conn, "cursor");
|
|
||||||
xcb_create_glyph_cursor(conn, cursor_id, cursor_font->id, cursor_font->id,
|
|
||||||
XCB_CURSOR_LEFT_PTR, XCB_CURSOR_LEFT_PTR + 1,
|
|
||||||
0, 0, 0, 65535, 65535, 65535);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint32_t mask = 0;
|
|
||||||
uint32_t values[3];
|
|
||||||
|
|
||||||
mask |= XCB_CW_BACK_PIXEL;
|
|
||||||
values[0] = 0;
|
|
||||||
|
|
||||||
mask |= XCB_CW_OVERRIDE_REDIRECT;
|
|
||||||
values[1] = 1;
|
|
||||||
|
|
||||||
mask |= XCB_CW_EVENT_MASK;
|
|
||||||
values[2] = XCB_EVENT_MASK_EXPOSURE;
|
|
||||||
|
|
||||||
xcb_create_window(conn,
|
|
||||||
XCB_COPY_FROM_PARENT,
|
|
||||||
win, /* the window id */
|
|
||||||
root, /* parent == root */
|
|
||||||
50, 50, width, height, /* dimensions */
|
|
||||||
0, /* border = 0, we draw our own */
|
|
||||||
XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
XCB_WINDOW_CLASS_COPY_FROM_PARENT, /* copy visual from parent */
|
|
||||||
mask,
|
|
||||||
values);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (cursor > -1)
|
|
||||||
xcb_change_window_attributes(conn, result, XCB_CW_CURSOR, &cursor_id);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Map the window (= make it visible) */
|
|
||||||
xcb_map_window(conn, win);
|
|
||||||
|
|
||||||
return win;
|
|
||||||
}
|
|
|
@ -18,6 +18,4 @@ while (0)
|
||||||
|
|
||||||
extern xcb_window_t root;
|
extern xcb_window_t root;
|
||||||
|
|
||||||
xcb_window_t open_input_window(xcb_connection_t *conn, uint32_t width, uint32_t height);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -305,7 +305,28 @@ int main(int argc, char *argv[]) {
|
||||||
font = load_font(pattern, true);
|
font = load_font(pattern, true);
|
||||||
|
|
||||||
/* Open an input window */
|
/* Open an input window */
|
||||||
win = open_input_window(conn, 500, font.height + 8 + 8 /* 8px padding */);
|
win = xcb_generate_id(conn);
|
||||||
|
|
||||||
|
xcb_create_window(
|
||||||
|
conn,
|
||||||
|
XCB_COPY_FROM_PARENT,
|
||||||
|
win, /* the window id */
|
||||||
|
root, /* parent == root */
|
||||||
|
50, 50, 500, font.height + 8 + 8 /* 8 px padding */, /* dimensions */
|
||||||
|
0, /* x11 border = 0, we draw our own */
|
||||||
|
XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
||||||
|
XCB_WINDOW_CLASS_COPY_FROM_PARENT, /* copy visual from parent */
|
||||||
|
XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK,
|
||||||
|
(uint32_t[]){
|
||||||
|
0, /* back pixel: black */
|
||||||
|
XCB_EVENT_MASK_EXPOSURE |
|
||||||
|
XCB_EVENT_MASK_STRUCTURE_NOTIFY |
|
||||||
|
XCB_EVENT_MASK_BUTTON_PRESS |
|
||||||
|
XCB_EVENT_MASK_BUTTON_RELEASE
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Map the window (make it visible) */
|
||||||
|
xcb_map_window(conn, win);
|
||||||
|
|
||||||
/* Setup NetWM atoms */
|
/* Setup NetWM atoms */
|
||||||
#define xmacro(name) \
|
#define xmacro(name) \
|
||||||
|
|
|
@ -1,73 +0,0 @@
|
||||||
/*
|
|
||||||
* vim:ts=8:expandtab
|
|
||||||
*
|
|
||||||
* i3 - an improved dynamic tiling window manager
|
|
||||||
*
|
|
||||||
* © 2009 Michael Stapelberg and contributors
|
|
||||||
*
|
|
||||||
* See file LICENSE for license information.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <xcb/xcb.h>
|
|
||||||
#include <xcb/xcb_keysyms.h>
|
|
||||||
|
|
||||||
#include <X11/keysym.h>
|
|
||||||
|
|
||||||
#include "i3-nagbar.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Opens the window we use for input/output and maps it
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
xcb_window_t open_input_window(xcb_connection_t *conn, uint32_t width, uint32_t height) {
|
|
||||||
xcb_window_t win = xcb_generate_id(conn);
|
|
||||||
//xcb_cursor_t cursor_id = xcb_generate_id(conn);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* Use the default cursor (left pointer) */
|
|
||||||
if (cursor > -1) {
|
|
||||||
i3Font *cursor_font = load_font(conn, "cursor");
|
|
||||||
xcb_create_glyph_cursor(conn, cursor_id, cursor_font->id, cursor_font->id,
|
|
||||||
XCB_CURSOR_LEFT_PTR, XCB_CURSOR_LEFT_PTR + 1,
|
|
||||||
0, 0, 0, 65535, 65535, 65535);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint32_t mask = 0;
|
|
||||||
uint32_t values[3];
|
|
||||||
|
|
||||||
mask |= XCB_CW_BACK_PIXEL;
|
|
||||||
values[0] = 0;
|
|
||||||
|
|
||||||
mask |= XCB_CW_EVENT_MASK;
|
|
||||||
values[1] = XCB_EVENT_MASK_EXPOSURE |
|
|
||||||
XCB_EVENT_MASK_STRUCTURE_NOTIFY |
|
|
||||||
XCB_EVENT_MASK_BUTTON_PRESS |
|
|
||||||
XCB_EVENT_MASK_BUTTON_RELEASE;
|
|
||||||
|
|
||||||
xcb_create_window(conn,
|
|
||||||
XCB_COPY_FROM_PARENT,
|
|
||||||
win, /* the window id */
|
|
||||||
root, /* parent == root */
|
|
||||||
50, 50, width, height, /* dimensions */
|
|
||||||
0, /* border = 0, we draw our own */
|
|
||||||
XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
XCB_WINDOW_CLASS_COPY_FROM_PARENT, /* copy visual from parent */
|
|
||||||
mask,
|
|
||||||
values);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (cursor > -1)
|
|
||||||
xcb_change_window_attributes(conn, result, XCB_CW_CURSOR, &cursor_id);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Map the window (= make it visible) */
|
|
||||||
xcb_map_window(conn, win);
|
|
||||||
|
|
||||||
return win;
|
|
||||||
}
|
|
Loading…
Reference in New Issue