Get outputs on start. Create dock window for every output.

This commit is contained in:
Axel Wagner 2010-07-23 05:04:13 +02:00
parent a3a7a2ca52
commit 72b55fdd4f
4 changed files with 19 additions and 42 deletions

View File

@ -19,6 +19,7 @@ xcb_window_t xcb_root;
void init_xcb();
void clean_xcb();
void get_atoms();
void destroy_windows();
void create_windows();
#endif

View File

@ -9,6 +9,7 @@
#include "common.h"
#include "outputs.h"
#include "workspaces.h"
#include "xcb.h"
#include "ipc.h"
ev_io* i3_connection;
@ -42,12 +43,16 @@ void got_workspace_reply(char *reply) {
}
void got_subscribe_reply(char *reply) {
printf("Got Subscribe Reply: %s\n", reply);
printf("Got Subscribe Reply: %s\n", reply);
}
void got_output_reply(char *reply) {
printf("Got Outputs-Data!\nDestroying Windows...\n");
destroy_windows();
printf("Parsing JSON...\n");
parse_outputs_json(reply);
printf("Got Outputs-Data!\n");
printf("Creating_Windows,,,\n");
create_windows();
}
handler_t reply_handlers[] = {

View File

@ -1,4 +1,5 @@
#include <stdio.h>
#include <i3/ipc.h>
#include <string.h>
#include <unistd.h>
#include <ev.h>
@ -17,6 +18,8 @@ int main(int argc, char **argv) {
subscribe_events();
i3_send_msg(I3_IPC_MESSAGE_TYPE_GET_OUTPUTS, NULL);
ev_loop(main_loop, 0);
ev_default_destroy();

View File

@ -42,6 +42,14 @@ void get_atoms() {
printf("Got Atoms\n");
}
void destroy_windows() {
i3_output *walk = outputs;
while(walk != NULL) {
xcb_destroy_window(xcb_connection, walk->win);
walk->win = XCB_NONE;
}
}
void create_windows() {
uint32_t mask;
uint32_t values[2];
@ -83,43 +91,3 @@ void create_windows() {
}
xcb_flush(xcb_connection);
}
#if 0
xcb_screen_t* screens = xcb_setup_roots_iterator(xcb_get_setup(xcb_connection)).data;
xcb_gcontext_t ctx = xcb_generate_id(xcb_connection);
xcb_window_t win = screens->root;
uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
uint32_t values[2];
values[0] = screens->black_pixel;
values[1] = 0;
xcb_create_gc(xcb_connection, ctx, win, mask, values);
request_atoms();
/* Fenster erzeugen */
win = xcb_generate_id(xcb_connection);
mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;
values[0] = screens->white_pixel;
values[1] = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_KEY_PRESS;
xcb_create_window(xcb_connection, screens->root_depth, win, screens->root,
10, 10, 20, 20, 1,
XCB_WINDOW_CLASS_INPUT_OUTPUT, screens->root_visual,
mask, values);
get_atoms();
xcb_change_property(xcb_connection,
XCB_PROP_MODE_REPLACE,
win,
atoms[_NET_WM_WINDOW_TYPE],
atoms[ATOM],
32,
1,
(unsigned char *) &atoms[_NET_WM_WINDOW_TYPE_DOCK]);
xcb_map_window(xcb_connection, win);
xcb_flush(xcb_connection);
#endif