]> git.sur5r.net Git - i3/i3/commitdiff
Get outputs on start. Create dock window for every output.
authorAxel Wagner <mail@merovius.de>
Fri, 23 Jul 2010 03:04:13 +0000 (05:04 +0200)
committerAxel Wagner <mail@merovius.de>
Fri, 23 Jul 2010 03:04:13 +0000 (05:04 +0200)
i3bar/include/xcb.h
i3bar/src/ipc.c
i3bar/src/main.c
i3bar/src/xcb.c

index 69c53b8376e4d925783d260cc8bab7a92721b762..16bc2bdf09903890ee03934661d7f27ab518502d 100644 (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
index b753c0883e8e27f4bac4dfba79399a95cdb2b09a..5d7a0bab965164538376fc3a03322d021e1b37b2 100644 (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[] = {
index dbb6104c40f68345021588f16970a970689a1cbc..b42d227cb1e4d29ad39603abb838447841ff28b4 100644 (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();
index d23d114bbf1e287e45c227302e9ff93bd363057a..20cc23c1f4dbe2ec3b59f4d8b2ad957348835f80 100644 (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