$(LIBINTL) \
render/libobrender.la \
parser/libobparser.la
+# $(XFT_LIBS) \
+# $(PANGO_LIBS) \
openbox_openbox_LDFLAGS = -export-dynamic
openbox_openbox_SOURCES = \
gettext.h \
openbox/actions/shade.c \
openbox/actions/showdesktop.c \
openbox/actions/showmenu.c \
+ openbox/actions/toggledebug.c \
openbox/actions/unfocus.c \
openbox/actions.c \
openbox/actions.h \
#
# Check if the user has requested a debug build.
# Sets the DEBUG or NDEBUG variables as appropriate
-# Sets the CVS environment variable when building CVS sources.
AC_DEFUN([OB_DEBUG],
[
AC_MSG_CHECKING([build type])
action_growtoedge_startup();
action_if_startup();
action_focustobottom_startup();
+ action_toggledebug_startup();
}
void action_growtoedge_startup();
void action_if_startup();
void action_focustobottom_startup();
+void action_toggledebug_startup();
#endif
#include "openbox/client.h"
static gboolean run_func(ObActionsData *data, gpointer options);
+static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
void action_iconify_startup()
{
actions_register("Iconify",
- NULL, NULL,
+ setup_func,
+ NULL,
run_func,
NULL, NULL);
}
+static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
+{
+ xmlNodePtr n;
+
+ if ((n = parse_find_node("de", node)))
+ return parse_bool(doc, n);
+}
+
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
if (data->client) {
actions_client_move(data, TRUE);
- client_iconify(data->client, TRUE, TRUE, FALSE);
+ client_iconify(data->client, !options, TRUE, FALSE);
actions_client_move(data, FALSE);
}
--- /dev/null
+#include "openbox/actions.h"
+#include "openbox/stacking.h"
+
+static gboolean run_func(ObActionsData *data, gpointer options);
+extern gboolean debug_show;
+
+void action_toggledebug_startup()
+{
+ actions_register("toggledebug",
+ NULL, NULL,
+ run_func,
+ NULL, NULL);
+}
+
+/* Always return FALSE because its not interactive */
+static gboolean run_func(ObActionsData *data, gpointer options)
+{
+ ob_debug_show_output(!debug_show);
+ g_message("Debug output turned %s", debug_show ? "on" : "off");
+
+ return FALSE;
+}
#include <glib.h>
#include <X11/Xutil.h>
+#include <unistd.h>
/*! The event mask to grab on client windows */
#define CLIENT_EVENTMASK (PropertyChangeMask | StructureNotifyMask | \
GList *client_list = NULL;
+extern ObDock *dock;
+
static GSList *client_destroy_notifies = NULL;
static void client_get_all(ObClient *self, gboolean real);
static void client_get_desktop(ObClient *self);
static void client_get_state(ObClient *self);
static void client_get_shaped(ObClient *self);
-static void client_get_mwm_hints(ObClient *self);
static void client_get_colormap(ObClient *self);
static void client_change_allowed_actions(ObClient *self);
static void client_change_state(ObClient *self);
}
}
-static void client_get_mwm_hints(ObClient *self)
+void client_get_mwm_hints(ObClient *self)
{
guint num;
guint32 *hints;
if (self->nicons == 0 && !self->parents) {
RrPixel32 *icon = ob_rr_theme->def_win_icon;
gulong *data;
+ gint32 r,g,b;
+ r = g_random_int_range(0,255);
+ g = g_random_int_range(0,255);
+ b = g_random_int_range(0,255);
data = g_new(gulong, 48*48+2);
data[0] = data[1] = 48;
for (i = 0; i < 48*48; ++i)
data[i+2] = (((icon[i] >> RrDefaultAlphaOffset) & 0xff) << 24) +
- (((icon[i] >> RrDefaultRedOffset) & 0xff) << 16) +
- (((icon[i] >> RrDefaultGreenOffset) & 0xff) << 8) +
- (((icon[i] >> RrDefaultBlueOffset) & 0xff) << 0);
+ ((((icon[i] >> RrDefaultRedOffset) & 0xff)*r/255) << 16) +
+ ((((icon[i] >> RrDefaultGreenOffset) & 0xff)*g/255) << 8) +
+ ((((icon[i] >> RrDefaultBlueOffset) & 0xff)*b/255) << 0);
PROP_SETA32(self->window, net_wm_icon, cardinal, data, 48*48+2);
g_free(data);
} else if (self->frame)
}
}
+/* dir: 0 = both
+ * 1 = horizontal
+ * 2 = vertical
+ */
void client_maximize(ObClient *self, gboolean max, gint dir)
{
gint x, y, w, h;
gboolean client_focus(ObClient *self)
{
+ {
+ XkbStateRec state;
+ XkbGetState(ob_display, XkbUseCoreKbd, &state);
+ if (state.locked_mods & 128)
+ return FALSE;
+ }
+
/* we might not focus this window, so if we have modal children which would
be focused instead, bring them to this desktop */
client_bring_modal_windows(self);
*/
void client_setup_decor_and_functions(ObClient *self, gboolean reconfig);
+/*! Retrieves the window's motif hints */
+void client_get_mwm_hints(ObClient *self);
/*! Sets the window's type and transient flag */
void client_get_type_and_transientness(ObClient *self);
for (desktop = 0; desktop < screen_num_desktops; desktop++) {
gboolean empty = TRUE;
gboolean onlyiconic = TRUE;
+ gboolean noicons = TRUE;
menu_add_separator(menu, CLIENT, screen_desktop_names[desktop]);
for (it = focus_order; it; it = g_list_next(it)) {
empty = FALSE;
if (c->iconic) {
- gchar *title = g_strdup_printf("(%s)", c->icon_title);
- e = menu_add_normal(menu, CLIENT, title, NULL, FALSE);
- g_free(title);
+ if (noicons) {
+ menu_add_separator(menu, -1, NULL);
+ noicons = FALSE;
+ }
+ e = menu_add_normal(menu, CLIENT, c->icon_title, NULL, FALSE);
} else {
onlyiconic = FALSE;
e = menu_add_normal(menu, CLIENT, c->title, NULL, FALSE);
if (!reconfig)
client_add_destroy_notify(client_dest, NULL);
- combined_menu = menu_new(MENU_NAME, _("Windows"), TRUE, NULL);
+ combined_menu = menu_new(MENU_NAME, "ウィンドウ", TRUE, NULL);
menu_set_update_func(combined_menu, self_update);
menu_set_execute_func(combined_menu, menu_execute);
}
GList *it;
gboolean empty = TRUE;
gboolean onlyiconic = TRUE;
+ gboolean noicons = TRUE;
menu_clear_entries(menu);
empty = FALSE;
if (c->iconic) {
- gchar *title = g_strdup_printf("(%s)", c->icon_title);
- e = menu_add_normal(menu, CLIENT, title, NULL, FALSE);
- g_free(title);
+ if (noicons) {
+ menu_add_separator(menu, -1, NULL);
+ noicons = FALSE;
+ }
+ e = menu_add_normal(menu, CLIENT, c->icon_title, NULL, FALSE);
} else {
onlyiconic = FALSE;
e = menu_add_normal(menu, CLIENT, c->title, NULL, FALSE);
static void client_dest(ObClient *client, gpointer data)
{
- /* This concise function removes all references to a closed
- * client in the client_list_menu, so we don't have to check
- * in client.c */
GSList *it;
for (it = desktop_menus; it; it = g_slist_next(it)) {
ObMenu *mit = it->data;
if (!reconfig)
client_add_destroy_notify(client_dest, NULL);
- menu = menu_new(MENU_NAME, _("Desktops"), TRUE, NULL);
+ menu = menu_new(MENU_NAME, "作æ¥é ˜åŸŸ", FALSE, NULL);
menu_set_update_func(menu, self_update);
menu_set_execute_func(menu, self_execute);
}
menu_add_submenu(menu, CLIENT_LAYER, LAYER_MENU_NAME);
+ menu_add_separator(menu, -1, NULL);
+ menu_add_submenu(menu, 0, "client-list-menu");
menu_add_separator(menu, -1, NULL);
e = menu_add_normal(menu, CLIENT_CLOSE, _("_Close"), NULL, TRUE);
gint config_desktops_num;
GSList *config_desktops_names;
guint config_screen_firstdesk;
+gint config_emulate_xinerama;
gboolean config_resize_redraw;
gboolean config_resize_four_corners;
gint config_resist_win;
gint config_resist_edge;
+gboolean config_stacking_dialogbringparent;
+
GSList *config_per_app_settings;
ObAppSettings* config_create_app_settings()
gchar *key;
xmlNodePtr n;
gboolean is_chroot = FALSE;
+ gboolean grab = TRUE;
if (!parse_attr_string("key", node, &key))
return;
parse_attr_bool("chroot", node, &is_chroot);
+ parse_attr_bool("grab", node, &grab);
keylist = g_list_append(keylist, key);
action = actions_parse(i, doc, n);
if (action)
- keyboard_bind(keylist, action);
+ keyboard_bind(keylist, action, grab);
n = parse_find_node("action", n->next);
}
}
config_focus_raise = parse_bool(doc, n);
if ((n = parse_find_node("focusLast", node)))
config_focus_last = parse_bool(doc, n);
+ if ((n = parse_find_node("dialogParentRaise", node)))
+ config_stacking_dialogbringparent = parse_bool(doc, n);
if ((n = parse_find_node("underMouse", node)))
config_focus_under_mouse = parse_bool(doc, n);
}
node = node->children;
- if ((n = parse_find_node("policy", node)))
+ if ((n = parse_find_node("policy", node))) {
if (parse_contains("UnderMouse", doc, n))
config_place_policy = OB_PLACE_POLICY_MOUSE;
+ if (parse_contains("Random", doc, n))
+ config_place_policy = OB_PLACE_POLICY_RANDOM;
+ }
if ((n = parse_find_node("center", node)))
config_place_center = parse_bool(doc, n);
}
if (d > 0)
config_screen_firstdesk = (unsigned) d;
}
+ if ((n = parse_find_node("emulatexinerama", node)))
+ config_emulate_xinerama = parse_bool(doc, n);
if ((n = parse_find_node("names", node))) {
GSList *it;
xmlNodePtr nname;
config_focus_raise = FALSE;
config_focus_last = TRUE;
config_focus_under_mouse = FALSE;
+ config_stacking_dialogbringparent = TRUE;
parse_register(i, "focus", parse_focus, NULL);
config_desktops_num = 4;
config_screen_firstdesk = 1;
+ config_emulate_xinerama = FALSE;
config_desktops_names = NULL;
parse_register(i, "desktops", parse_desktops, NULL);
extern gboolean config_theme_keepborder;
/*! Titlebar button layout */
extern gchar *config_title_layout;
+/* Windows bring their parents along when raising */
+extern gboolean config_stacking_dialogbringparent;
/*! Animate windows iconifying and restoring */
extern gboolean config_animate_iconify;
extern gint config_desktops_num;
/*! Desktop to start on, put 5 to start in the center of a 3x3 grid */
extern guint config_screen_firstdesk;
+/*! Emulate xinerama by dividing screen in two halves, left and right. */
+extern gboolean config_emulate_xinerama;
/*! Names for the desktops */
extern GSList *config_desktops_names;
#include <stdarg.h>
#include <stdio.h>
-static gboolean show;
+gboolean debug_show;
void ob_debug_show_output(gboolean enable)
{
- show = enable;
+ debug_show = enable;
}
void ob_debug(const gchar *a, ...)
{
va_list vl;
- if (show) {
+ if (debug_show) {
fprintf(stderr, "DEBUG: ");
va_start(vl, a);
vfprintf(stderr, a, vl);
g_assert(type < OB_DEBUG_TYPE_NUM);
- if (show && enabled_types[type]) {
+ if (debug_show && enabled_types[type]) {
switch (type) {
case OB_DEBUG_FOCUS:
fprintf(stderr, "FOCUS: ");
EnterWindowMask | LeaveWindowMask)
#define DOCKAPP_EVENT_MASK (StructureNotifyMask)
-static ObDock *dock;
+ObDock *dock;
StrutPartial dock_strut;
{
g_assert(config_focus_follow);
- if (client_enter_focusable(client) && client_can_focus(client)) {
+ if (!moveresize_in_progress /*XXX fix this or finishing a move???*/
+ && client_enter_focusable(client) && client_can_focus(client)) {
if (config_focus_delay) {
ObFocusDelayData *data;
"_NET_ACTIVE_WINDOW message for window %s is "
"missing source indication\n");
client_activate(client, FALSE, TRUE, TRUE,
- (e->xclient.data.l[0] == 0 ||
+ /*stealing*/ /*1 || */(e->xclient.data.l[0] == 0 ||
e->xclient.data.l[0] == 2));
+ } else if (msgtype == prop_atoms.ob_focus) {
+ client_focus(client);
} else if (msgtype == prop_atoms.net_wm_moveresize) {
ob_debug("net_wm_moveresize for 0x%lx direction %d\n",
client->window, e->xclient.data.l[2]);
"with invalid detail %d\n",
client->title, e->xclient.data.l[2]);
}
+/*
+ } else if (msgtype == prop_atoms.ob_client_menu) {
+ gint x = e->xclient.data.l[0];
+ gint y = e->xclient.data.l[1];
+ gint button = e->xclient.data.l[2];
+ ObAction *a = action_from_string("showmenu", OB_USER_ACTION_MOUSE_PRESS);
+ GSList *l = g_slist_append(NULL, a);
+ action_run_list(l, client, OB_FRAME_CONTEXT_NONE, 0, button, x, y, CurrentTime, 0, 0);
+// menu_show("client-menu", x, y, button, client);*/
}
break;
case PropertyNotify:
client_update_sync_request_counter(client);
}
#endif
+ else if (msgtype == prop_atoms.motif_wm_hints) {
+ ob_debug("getting mwm hints!!!\n");
+ client_get_mwm_hints(client);
+ client_get_type_and_transientness(client);
+ client_calc_layer(client);
+ client_setup_decor_and_functions(client, TRUE);
+ }
break;
case ColormapNotify:
client_update_colormap(client, e->xcolormap.colormap);
break;
default:
+#if 0
+ {
+ char *msgname = XGetAtomName(ob_display, msgtype);
+ ob_debug("got a property notify \"%s\" from client \"%s\" with title \"%s\"\n", msgname, client->name, client->title);
+ fflush(stdout);
+ XFree(msgname);
+ }
+#else
;
+#endif
#ifdef SHAPE
if (extensions_shape && e->type == extensions_shape_event_basep) {
client->shaped = ((XShapeEvent*)e)->shaped;
{
switch (e->type) {
case ButtonPress:
- if (e->xbutton.button == 1)
- stacking_raise(DOCK_AS_WINDOW(s));
- else if (e->xbutton.button == 2)
- stacking_lower(DOCK_AS_WINDOW(s));
+ switch (e->xbutton.button) {
+ case 1:
+ stacking_raise(DOCK_AS_WINDOW(s));
+ break;
+ case 2:
+ stacking_lower(DOCK_AS_WINDOW(s));
+ break;
+ case 4:
+ screen_cycle_desktop(OB_DIRECTION_WEST, TRUE, TRUE, FALSE, TRUE, FALSE);
+ break;
+ case 5:
+ screen_cycle_desktop(OB_DIRECTION_EAST, TRUE, TRUE, FALSE, TRUE, FALSE);
+ break;
+ }
break;
case EnterNotify:
dock_hide(FALSE);
#include "geom.h"
#include "extensions.h"
#include "screen.h"
+#include "config.h"
#include "debug.h"
gboolean extensions_xkb = FALSE;
{
guint i;
gint l, r, t, b;
+ /*
#ifdef XINERAMA
if (extensions_xinerama) {
guint i;
XFree(info);
} else
#endif
- if (ob_debug_xinerama) {
- gint w = WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen));
- gint h = HeightOfScreen(ScreenOfDisplay(ob_display, ob_screen));
- *nxin = 2;
- *xin_areas = g_new(Rect, *nxin + 1);
- RECT_SET((*xin_areas)[0], 0, 0, w/2, h);
- RECT_SET((*xin_areas)[1], w/2, 0, w-(w/2), h);
- }
- else {
+ */
+ if (config_emulate_xinerama) {
+ *nxin = 2;
+ *xin_areas = g_new(Rect, *nxin + 1);
+ RECT_SET((*xin_areas)[0], 0, 0,
+ WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen)) / 2,
+ HeightOfScreen(ScreenOfDisplay(ob_display, ob_screen)));
+ RECT_SET((*xin_areas)[1],
+ WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen)) / 2,
+ 0,
+ WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen)) / 2,
+ HeightOfScreen(ScreenOfDisplay(ob_display, ob_screen)));
+ RECT_SET((*xin_areas)[*nxin], 0, 0,
+ WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen)),
+ HeightOfScreen(ScreenOfDisplay(ob_display, ob_screen)));
+ } else {
*nxin = 1;
*xin_areas = g_new(Rect, *nxin + 1);
RECT_SET((*xin_areas)[0], 0, 0,
WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen)),
HeightOfScreen(ScreenOfDisplay(ob_display, ob_screen)));
- }
-
/* returns one extra with the total area in it */
l = (*xin_areas)[0].x;
t = (*xin_areas)[0].y;
b = MAX(b, (*xin_areas)[i].y + (*xin_areas)[i].height - 1);
}
RECT_SET((*xin_areas)[*nxin], l, t, r - l + 1, b - t + 1);
+ }
}
stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.right));
stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.bottom));
- color_white = RrColorNew(ob_rr_inst, 0xff, 0xff, 0xff);
+ color_white = RrColorNew(ob_rr_inst, 0x00, 0x00, 0xff);
a_focus_indicator = RrAppearanceNew(ob_rr_inst, 4);
a_focus_indicator->surface.grad = RR_SURFACE_SOLID;
a_focus_indicator->surface.relief = RR_RELIEF_FLAT;
a_focus_indicator->surface.primary = RrColorNew(ob_rr_inst,
- 0, 0, 0);
+ 0xA6, 0xCA, 0xF4);
a_focus_indicator->texture[0].type = RR_TEXTURE_LINE_ART;
a_focus_indicator->texture[0].data.lineart.color = color_white;
a_focus_indicator->texture[1].type = RR_TEXTURE_LINE_ART;
if (grab) {
p = curpos ? curpos->first_child : keyboard_firstnode;
while (p) {
- grab_key(p->key, p->state, RootWindow(ob_display, ob_screen),
- GrabModeAsync);
+ if (p->grab)
+ grab_key(p->key, p->state, RootWindow(ob_display, ob_screen),
+ GrabModeAsync);
p = p->next_sibling;
}
if (curpos)
chroot binding. so add it to the tree then. */
if (!tree_chroot(keyboard_firstnode, keylist)) {
KeyBindingTree *tree;
- if (!(tree = tree_build(keylist)))
+ if (!(tree = tree_build(keylist, TRUE)))
return;
tree_chroot(tree, keylist);
tree_assimilate(tree);
}
}
-gboolean keyboard_bind(GList *keylist, ObActionsAct *action)
+gboolean keyboard_bind(GList *keylist, ObActionsAct *action, gboolean grab)
{
KeyBindingTree *tree, *t;
gboolean conflict;
g_assert(keylist != NULL);
g_assert(action != NULL);
- if (!(tree = tree_build(keylist)))
+ if (!(tree = tree_build(keylist, grab)))
return FALSE;
if ((t = tree_find(tree, &conflict)) != NULL) {
void keyboard_shutdown(gboolean reconfig);
void keyboard_chroot(GList *keylist);
-gboolean keyboard_bind(GList *keylist, struct _ObActionsAct *action);
+gboolean keyboard_bind(GList *keylist, struct _ObActionsAct *action, gboolean grab);
void keyboard_unbind_all();
void keyboard_event(struct _ObClient *client, const XEvent *e);
}
}
-KeyBindingTree *tree_build(GList *keylist)
+KeyBindingTree *tree_build(GList *keylist, gboolean grab)
{
GList *it;
KeyBindingTree *ret = NULL, *p;
ret->keylist = g_list_prepend(ret->keylist,
g_strdup(kit->data)); /* deep copy */
ret->first_child = p;
+ ret->grab = grab;
if (p != NULL) p->parent = ret;
if (!translate_key(it->data, &ret->state, &ret->key)) {
tree_destroy(ret);
typedef struct KeyBindingTree {
guint state;
guint key;
+ gboolean grab;
GList *keylist;
GSList *actions; /* list of Action pointers */
gboolean chroot;
} KeyBindingTree;
void tree_destroy(KeyBindingTree *tree);
-KeyBindingTree *tree_build(GList *keylist);
+KeyBindingTree *tree_build(GList *keylist, gboolean grab);
void tree_assimilate(KeyBindingTree *node);
KeyBindingTree *tree_find(KeyBindingTree *search, gboolean *conflict);
gboolean tree_chroot(KeyBindingTree *tree, GList *keylist);
#include "config.h"
#include "render/theme.h"
-#define PADDING 2
+#define PADDING 0
#define SEPARATOR_HEIGHT 3
#define MAX_MENU_WIDTH 400
gint dx, dy;
if (config_menu_middle) {
- gint myx;
- myx = *x;
- *y -= self->area.height / 2;
+ *x -= self->area.width / 2;
- /* try to the right of the cursor */
- menu_frame_move_on_screen(self, myx, *y, &dx, &dy);
+ /* try below the cursor */
+ menu_frame_move_on_screen(self, *x, *y, &dx, &dy);
self->direction_right = TRUE;
- if (dx != 0) {
- /* try to the left of the cursor */
- myx = *x - self->area.width;
- menu_frame_move_on_screen(self, myx, *y, &dx, &dy);
- self->direction_right = FALSE;
- }
- if (dx != 0) {
- /* if didnt fit on either side so just use what it says */
- myx = *x;
- menu_frame_move_on_screen(self, myx, *y, &dx, &dy);
- self->direction_right = TRUE;
- }
- *x = myx + dx;
+ *x += dx;
*y += dy;
} else {
gint myx, myy;
h += th;
}
+ w += 20;
+
/* if the last entry is a labeled separator, then make its border
overlap with the menu's outside border */
it = g_list_last(self->entries);
static void parse_args(gint *argc, gchar **argv);
static Cursor load_cursor(const gchar *name, guint fontval);
+gboolean haxxor_func(gpointer data)
+{
+ int *foo = data;
+ static int dir = 1;
+ *foo += dir;
+ if (*foo >= 200 || *foo <= 0)
+ dir = -dir;
+
+ Colormap cm = RrColormap(ob_rr_inst);
+ static XColor xcb, xcg;
+ xcg.red = *foo << 8;
+ xcg.blue = (*foo / 4) << 8;
+ xcg.green = *foo / 2 << 8;
+
+ xcb.red = 0;
+ xcb.blue = (196 - *foo / 4) << 8;
+ xcb.green = 0;
+ XAllocColor(ob_display, cm, &xcg);
+ XAllocColor(ob_display, cm, &xcb);
+// XAllocNamedColor(ob_display, cm, "dark blue", &xcb, &xcb);
+ static int i;
+ for (i = 1; i <= OB_CURSOR_NORTHWEST; i++)
+ XRecolorCursor(ob_display, cursors[i], &xcb, &xcg);
+
+ return TRUE;
+}
+
gint main(gint argc, gchar **argv)
{
gchar *program_name;
cursors[OB_CURSOR_WEST] = load_cursor("left_side", XC_left_side);
cursors[OB_CURSOR_NORTHWEST] = load_cursor("top_left_corner",
XC_top_left_corner);
-
+/*
+ int color = 0;
+ ob_main_loop_timeout_add(ob_main_loop,
+ 25000,
+ haxxor_func,
+ &color, NULL);
+*/
prop_startup(); /* get atoms values for the display */
extensions_query_all(); /* find which extensions are present */
return TRUE;
}
-static GSList* area_add(GSList *list, Rect *a)
+GSList* area_add(GSList *list, Rect *a)
{
Rect *r = g_new(Rect, 1);
*r = *a;
return g_slist_prepend(list, r);
}
-static GSList* area_remove(GSList *list, Rect *a)
+GSList* area_remove(GSList *list, Rect *a)
{
GSList *sit;
GSList *result = NULL;
typedef enum
{
OB_PLACE_POLICY_SMART,
+ OB_PLACE_POLICY_RANDOM,
OB_PLACE_POLICY_MOUSE
} ObPlacePolicy;
/* get the height, which is also used for the icon width */
emptyy = t + b + ob_rr_theme->paddingy * 2;
- if (self->h)
- texth = self->h - emptyy;
- h = texth * self->iconhm + emptyy;
+ if (self->hasicon) {
+ if (self->h)
+ h = self->h - emptyy;
+ h = h * self->iconhm + emptyy;
+ } else {
+ if (self->h)
+ texth = self->h - emptyy;
+ h = texth * self->iconhm + emptyy;
+ }
if (self->textw)
textw = self->textw;
emptyx = l + r + ob_rr_theme->paddingx * 2;
if (self->hasicon) {
- iconw = texth * self->iconwm;
- iconh = texth * self->iconhm;
+ iconw = h * self->iconwm;
+ iconh = h * self->iconhm;
textx += iconw + ob_rr_theme->paddingx;
if (textw)
emptyx += ob_rr_theme->paddingx; /* between the icon and text */
break;
default:
g_assert_not_reached();
+ return;
}
break;
case OB_ORIENTATION_VERT:
break;
default:
g_assert_not_reached();
+ return;
}
break;
default:
g_assert_not_reached();
+ return;
}
rown = n;
*/
CREATE(openbox_pid, "_OPENBOX_PID");
+ CREATE(ob_focus, "_OB_FOCUS");
CREATE(ob_theme, "_OB_THEME");
CREATE(ob_wm_action_undecorate, "_OB_WM_ACTION_UNDECORATE");
CREATE(ob_wm_state_undecorated, "_OB_WM_STATE_UNDECORATED");
CREATE(ob_control, "_OB_CONTROL");
+ CREATE(ob_client_menu, "_OB_CLIENT_MENU");
}
#include <X11/Xutil.h>
/* Openbox specific atoms */
+ Atom ob_focus;
Atom ob_wm_action_undecorate;
Atom ob_wm_state_undecorated;
- Atom openbox_pid; /* this is depreecated in favour of ob_control */
+ Atom openbox_pid; /* this is deprecated in favour of ob_control */
Atom ob_theme;
Atom ob_control;
+ Atom ob_client_menu;
} Atoms;
Atoms prop_atoms;
#include "stacking.h"
#include "screen.h"
#include "config.h"
+#include "dock.h"
#include "parser/parse.h"
#include <glib.h>
/* don't snap to self or non-visibles */
if (!target->frame->visible || target == c) continue;
- /* don't snap to windows set to below and skip_taskbar (desklets) */
- if (target->below && !c->below && target->skip_taskbar) continue;
tl = RECT_LEFT(target->frame->area) - 1;
tt = RECT_TOP(target->frame->area) - 1;
*x = tr - w, snapx = target;
}
}
+ if (snapx && snapy) break;
}
- if (snapx && snapy) break;
+ extern ObDock *dock;
+ gint dl, dt, dr, db;
+ dl = dock->x - 1;
+ dt = dock->y - 1;
+ dr = dl + dock->w + 1;
+ db = dt + dock->h + 1;
+ snapx = snapy = NULL;
+ if (ct < db && cb > dt) {
+ if (cl >= dr && l < dr && l >= dr - config_resist_win)
+ *x = dr, snapx = dock;
+ else if (cr <= dl && r > dl &&
+ r <= dl + config_resist_win)
+ *x = dl - w + 1, snapx = dock;
+ if (snapx != NULL) {
+ if (ct > dt && t <= dt &&
+ t > dt - config_resist_win)
+ *y = dt + 1;
+ else if (cb < db && b >= db &&
+ b < db + config_resist_win)
+ *y = db - h;
+ }
+ }
+ if (cl < dr && cr > dl) {
+ if (ct >= db && t < db && t >= db - config_resist_win)
+ *y = db, snapy = dock;
+ else if (cb <= dt && b > dt &&
+ b <= dt + config_resist_win)
+ *y = dt - h + 1, snapy = dock;
+ if (snapy != NULL) {
+ if (cl > dl && l <= dl &&
+ l > dl - config_resist_win)
+ *x = dl + 1;
+ else if (cr < dr && r >= dr &&
+ r < dr + config_resist_win)
+ *x = dr - w;
+ }
+ }
}
frame_frame_gravity(c->frame, x, y);
/* don't snap to invisibles or ourself */
if (!target->frame->visible || target == c) continue;
- /* don't snap to windows set to below and skip_taskbar (desklets) */
- if (target->below && !c->below && target->skip_taskbar) continue;
tl = RECT_LEFT(target->frame->area);
tr = RECT_RIGHT(target->frame->area);
}
}
}
-
/* snapped both ways */
if (snapx && snapy) break;
+
+ }{
+ extern ObDock *dock;
+ int dl, dt, dr, db;
+ dl = dock->x;
+ dt = dock->y;
+ dr = dl + dock->w - 1;
+ db = dt + dock->h - 1;
+ if (t < db && b > dt) {
+ switch (corn) {
+ case OB_CORNER_TOPLEFT:
+ case OB_CORNER_BOTTOMLEFT:
+ dlt = l;
+ drb = r + *w - c->frame->area.width;
+ if (r < dl && drb >= dl &&
+ drb < dl + config_resist_win)
+ *w = dl - l;
+ break;
+ case OB_CORNER_TOPRIGHT:
+ case OB_CORNER_BOTTOMRIGHT:
+ dlt = l - *w + c->frame->area.width;
+ drb = r;
+ if (l > dr && dlt <= dr &&
+ dlt > dr - config_resist_win)
+ *w = r - dr;
+ break;
+ }
+ }
+ if (l < dr && r > dl) {
+ switch (corn) {
+ case OB_CORNER_TOPLEFT:
+ case OB_CORNER_TOPRIGHT:
+ dlt = t;
+ drb = b + *h - c->frame->area.height;
+ if (b < dt && drb >= dt &&
+ drb < dt + config_resist_win)
+ *h = dt - t;
+ break;
+ case OB_CORNER_BOTTOMLEFT:
+ case OB_CORNER_BOTTOMRIGHT:
+ dlt = t - *h + c->frame->area.height;
+ drb = b;
+ if (t > db && dlt <= db &&
+ dlt > db - config_resist_win)
+ *h = b - db;
+ break;
+ }
+ }
}
}
static gboolean screen_validate_layout(ObDesktopLayout *l);
static gboolean replace_wm();
-static void screen_tell_ksplash();
+//static void screen_tell_ksplash();
guint screen_num_desktops;
guint screen_num_monitors;
guint screen_desktop;
-guint screen_last_desktop;
+guint screen_last_desktop = 1;
Size screen_physical_size;
gboolean screen_showing_desktop;
ObDesktopLayout screen_desktop_layout;
net_supported, atom, supported, num_support);
g_free(supported);
- screen_tell_ksplash();
+// screen_tell_ksplash();
return TRUE;
}
-
+#if 0
static void screen_tell_ksplash()
{
XEvent e;
XSendEvent(ob_display, RootWindow(ob_display, ob_screen),
False, SubstructureNotifyMask, &e );
}
-
+#endif
void screen_startup(gboolean reconfig)
{
gchar **names = NULL;
{
if (sn_app_starting())
XDefineCursor(ob_display, RootWindow(ob_display, ob_screen),
- ob_cursor(OB_CURSOR_BUSYPOINTER));
+ ob_cursor(OB_CURSOR_BUSY));
else
XDefineCursor(ob_display, RootWindow(ob_display, ob_screen),
ob_cursor(OB_CURSOR_POINTER));
if (!g_ascii_strcasecmp("Mod1", str)) mask = Mod1Mask;
else if (!g_ascii_strcasecmp("Mod2", str)) mask = Mod2Mask;
- else if (!g_ascii_strcasecmp("Mod3", str)) mask = Mod3Mask;
- else if (!g_ascii_strcasecmp("Mod4", str)) mask = Mod4Mask;
+ else if (!g_ascii_strcasecmp("Mod3", str) ||
+ !g_ascii_strcasecmp("M", str))
+ mask = Mod3Mask;
+ else if (!g_ascii_strcasecmp("Mod4", str) ||
+ !g_ascii_strcasecmp("W", str))
+ mask = Mod4Mask;
else if (!g_ascii_strcasecmp("Mod5", str)) mask = Mod5Mask;
else if (!g_ascii_strcasecmp("Control", str) ||
rect.width = (rect.width + PANGO_SCALE - 1) / PANGO_SCALE;
rect.height = (rect.height + PANGO_SCALE - 1) / PANGO_SCALE;
#endif
- *x = rect.width + ABS(shadow_x) + 4 /* we put a 2 px edge on each side */;
- *y = rect.height + ABS(shadow_y);
+ *x = rect.width + /* ABS(shadow_x) +*/ 4 /* we put a 2 px edge on each side */;
+ *y = rect.height /*+ ABS(shadow_y) */;
}
RrSize *RrFontMeasureString(const RrFont *f, const gchar *str,
gint RrFontHeight(const RrFont *f, gint shadow_y)
{
- return (f->ascent + f->descent) / PANGO_SCALE + ABS(shadow_y);
+ return (f->ascent + f->descent) / PANGO_SCALE + 0-1;//ABS(shadow_y);
}
static inline int font_calculate_baseline(RrFont *f, gint height)
inst = RrInstanceNew(ob_display, ob_screen);
look = RrAppearanceNew(inst, 0);
- look->surface.grad = RR_SURFACE_PYRAMID;
- look->surface.secondary = RrColorParse(inst, "Yellow");
- look->surface.primary = RrColorParse(inst, "Blue");
+ look->surface.grad = RR_SURFACE_MIRROR_HORIZONTAL;
+ look->surface.secondary = RrColorParse(inst, "Dark Orange");
+ look->surface.primary = RrColorParse(inst, "Dark Blue");
look->surface.interlaced = FALSE;
if (ob_display == NULL) {
fprintf(stderr, "couldn't connect to X server :0\n");
case Expose:
break;
case ConfigureNotify:
+ look->surface.grad += 1;
+ if (look->surface.grad > RR_SURFACE_MIRROR_HORIZONTAL)
+ look->surface.grad = RR_SURFACE_SPLIT_VERTICAL;
RrPaint(look, win,
report.xconfigure.width,
report.xconfigure.height);
#include "font.h"
#include "mask.h"
#include "theme.h"
-#include "icon.h"
+#ifdef MIKACHU
+# include "icon-mikamika.h"
+#else
+# include "icon.h"
+#endif
#include "parser/parse.h"
#include <X11/Xlib.h>
RrMargins(theme->a_focused_label, &fl, &ft, &fr, &fb);
RrMargins(theme->a_unfocused_label, &ul, &ut, &ur, &ub);
theme->label_height = theme->win_font_height + MAX(ft + fb, ut + ub);
- theme->label_height += theme->label_height % 2;
+ //theme->label_height += theme->label_height & 1;
/* this would be nice I think, since padding.width can now be 0,
but it breaks frame.c horribly and I don't feel like fixing that
RrColorFree(theme->menu_selected_color);
RrColorFree(theme->menu_disabled_color);
RrColorFree(theme->menu_disabled_selected_color);
+// RrColorFree(theme->focus_cycle_inner);
+// RrColorFree(theme->focus_cycle_outer);
RrColorFree(theme->title_focused_shadow_color);
RrColorFree(theme->title_unfocused_shadow_color);
RrColorFree(theme->osd_color);
RrColor *menu_selected_color;
RrColor *menu_disabled_color;
RrColor *menu_disabled_selected_color;
+// RrColor *focus_cycle_inner;
+// RrColor *focus_cycle_outer;
RrColor *title_focused_shadow_color;
gchar title_focused_shadow_alpha;
RrColor *title_unfocused_shadow_color;
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
Window findClient(Display *d, Window win)
{
XPutImage(d, p, DefaultGC(d, s), i[j], 0, 0, x, 0,
i[j]->width, i[j]->height);
x += i[j]->width;
+ char *filename;
+ asprintf(&filename, "icon%i.raw", j);
+ int fd = open(filename, O_CREAT | O_RDWR);
+ write(fd, i[j]->data, i[j]->width * i[j]->height * i[j]->depth);
XDestroyImage(i[j]);
}
XDestroyWindow(display, win);
XSync(display, False);
- break;
- sleep(2);
+ //break;
+ usleep(200000);
}
return 1;
Display *display;
Window win;
XEvent report;
- Atom _net_fs, _net_state;
XEvent msg;
int x=50,y=50,h=100,w=400;
XWMHints hint;
return 0;
}
- _net_state = XInternAtom(display, "_NET_WM_STATE", False);
- _net_fs = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", False);
-
win = XCreateWindow(display, RootWindow(display, 0),
x, y, w, h, 10, CopyFromParent, CopyFromParent,
CopyFromParent, 0, NULL);