*
* i3 - an improved dynamic tiling window manager
*
- * © 2009 Michael Stapelberg and contributors
+ * © 2009-2010 Michael Stapelberg and contributors
*
* See file LICENSE for license information.
*
* because they are quite large.
*
*/
-#include <stdio.h>
-#include <assert.h>
-#include <string.h>
-#include <stdlib.h>
#include <time.h>
-#include <stdbool.h>
#include <math.h>
-#include <xcb/xcb.h>
#include <xcb/xcb_atom.h>
#include <xcb/xcb_icccm.h>
#include <X11/XKBlib.h>
-#include "i3.h"
-#include "queue.h"
-#include "table.h"
-#include "config.h"
-#include "util.h"
-#include "xcb.h"
-#include "client.h"
-#include "workspace.h"
-#include "commands.h"
-#include "floating.h"
-#include "resize.h"
-#include "log.h"
+#include "all.h"
+#if 0
static struct Stack_Window *get_stack_window(xcb_window_t window_id) {
struct Stack_Window *current;
*
*/
static bool button_press_bar(xcb_connection_t *conn, xcb_button_press_event_t *event) {
- i3Screen *screen;
- TAILQ_FOREACH(screen, virtual_screens, screens) {
- if (screen->bar != event->event)
+ Output *output;
+ TAILQ_FOREACH(output, &outputs, outputs) {
+ if (output->bar != event->event)
continue;
DLOG("Click on a bar\n");
Workspace *ws = c_ws;
if (event->detail == XCB_BUTTON_INDEX_5) {
while ((ws = TAILQ_NEXT(ws, workspaces)) != TAILQ_END(workspaces_head)) {
- if (ws->screen == screen) {
+ if (ws->output == output) {
workspace_show(conn, ws->num + 1);
return true;
}
}
} else {
while ((ws = TAILQ_PREV(ws, workspaces_head, workspaces)) != TAILQ_END(workspaces)) {
- if (ws->screen == screen) {
+ if (ws->output == output) {
workspace_show(conn, ws->num + 1);
return true;
}
return true;
}
int drawn = 0;
- /* Because workspaces can be on different screens, we need to loop
- through all of them and decide to count it based on its ->screen */
+ /* Because workspaces can be on different outputs, we need to loop
+ through all of them and decide to count it based on its ->output */
Workspace *ws;
TAILQ_FOREACH(ws, workspaces, workspaces) {
- if (ws->screen != screen)
+ if (ws->output != output)
continue;
DLOG("Checking if click was on workspace %d with drawn = %d, tw = %d\n",
ws->num, drawn, ws->text_width);
return resize_graphical_handler(conn, ws, first, second, orientation, event);
}
+#endif
int handle_button_press(void *ignored, xcb_connection_t *conn, xcb_button_press_event_t *event) {
- DLOG("Button %d pressed\n", event->state);
- /* This was either a focus for a client’s parent (= titlebar)… */
- Client *client = table_get(&by_child, event->event);
+ Con *con;
+ LOG("Button %d pressed\n", event->state);
+
+ con = con_by_window_id(event->event);
bool border_click = false;
- if (client == NULL) {
- client = table_get(&by_parent, event->event);
+ if (con == NULL) {
+ con = con_by_frame_id(event->event);
border_click = true;
}
+ //if (con && con->type == CT_FLOATING_CON)
+ //con = TAILQ_FIRST(&(con->nodes_head));
+
/* See if this was a click with the configured modifier. If so, we need
* to move around the client if it was floating. if not, we just process
* as usual. */
- if (config.floating_modifier != 0 &&
- (event->state & config.floating_modifier) != 0) {
- if (client == NULL) {
- DLOG("Not handling, floating_modifier was pressed and no client found\n");
+ //if (config.floating_modifier != 0 &&
+ //(event->state & config.floating_modifier) == config.floating_modifier) {
+ if (con == NULL) {
+ LOG("Not handling, floating_modifier was pressed and no client found\n");
return 1;
}
- if (client->fullscreen) {
- DLOG("Not handling, client is in fullscreen mode\n");
+#if 0
+ if (con->fullscreen) {
+ LOG("Not handling, client is in fullscreen mode\n");
return 1;
}
- if (client_is_floating(client)) {
- DLOG("button %d pressed\n", event->detail);
+#endif
+ if (con->type == CT_FLOATING_CON) {
+ LOG("button %d pressed\n", event->detail);
if (event->detail == 1) {
- DLOG("left mouse button, dragging\n");
- floating_drag_window(conn, client, event);
- } else if (event->detail == 3) {
+ LOG("left mouse button, dragging\n");
+ floating_drag_window(con, event);
+ }
+#if 0
+ else if (event->detail == 3) {
+ bool proportional = (event->state & BIND_SHIFT);
DLOG("right mouse button\n");
- floating_resize_window(conn, client, event);
+ floating_resize_window(conn, client, proportional, event);
}
+#endif
return 1;
}
+#if 0
if (!floating_mod_on_tiled_client(conn, client, event)) {
xcb_allow_events(conn, XCB_ALLOW_REPLAY_POINTER, event->time);
xcb_flush(conn);
}
+#endif
return 1;
- }
+ //}
+#if 0
if (client == NULL) {
/* The client was neither on a client’s titlebar nor on a client itself, maybe on a stack_window? */
if (button_press_stackwin(conn, event))
}
return resize_graphical_handler(conn, ws, first, second, orientation, event);
+#endif
}