prefixing and capitalization for the Frame->ObFrame struct and the Context->ObFrameContext enum and its constants.
This commit is contained in:
parent
5be23ec5a4
commit
7d943a950e
8 changed files with 138 additions and 137 deletions
|
@ -10,7 +10,7 @@
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
struct Frame;
|
struct _ObFrame;
|
||||||
struct _ObGroup;
|
struct _ObGroup;
|
||||||
|
|
||||||
typedef struct _ObClient ObClient;
|
typedef struct _ObClient ObClient;
|
||||||
|
@ -75,7 +75,7 @@ struct _ObClient
|
||||||
Window window;
|
Window window;
|
||||||
|
|
||||||
/*! The window's decorations. NULL while the window is being managed! */
|
/*! The window's decorations. NULL while the window is being managed! */
|
||||||
struct Frame *frame;
|
struct _ObFrame *frame;
|
||||||
|
|
||||||
/*! The number of unmap events to ignore on the window */
|
/*! The number of unmap events to ignore on the window */
|
||||||
int ignore_unmaps;
|
int ignore_unmaps;
|
||||||
|
|
|
@ -620,23 +620,23 @@ static void event_handle_client(ObClient *client, XEvent *e)
|
||||||
is a waste of resources to go drawing it. */
|
is a waste of resources to go drawing it. */
|
||||||
if (!(e->xbutton.button == 4 || e->xbutton.button == 5)) {
|
if (!(e->xbutton.button == 4 || e->xbutton.button == 5)) {
|
||||||
switch (frame_context(client, e->xbutton.window)) {
|
switch (frame_context(client, e->xbutton.window)) {
|
||||||
case Context_Maximize:
|
case OB_FRAME_CONTEXT_MAXIMIZE:
|
||||||
client->frame->max_press = (e->type == ButtonPress);
|
client->frame->max_press = (e->type == ButtonPress);
|
||||||
framerender_frame(client->frame);
|
framerender_frame(client->frame);
|
||||||
break;
|
break;
|
||||||
case Context_Close:
|
case OB_FRAME_CONTEXT_CLOSE:
|
||||||
client->frame->close_press = (e->type == ButtonPress);
|
client->frame->close_press = (e->type == ButtonPress);
|
||||||
framerender_frame(client->frame);
|
framerender_frame(client->frame);
|
||||||
break;
|
break;
|
||||||
case Context_Iconify:
|
case OB_FRAME_CONTEXT_ICONIFY:
|
||||||
client->frame->iconify_press = (e->type == ButtonPress);
|
client->frame->iconify_press = (e->type == ButtonPress);
|
||||||
framerender_frame(client->frame);
|
framerender_frame(client->frame);
|
||||||
break;
|
break;
|
||||||
case Context_AllDesktops:
|
case OB_FRAME_CONTEXT_ALLDESKTOPS:
|
||||||
client->frame->desk_press = (e->type == ButtonPress);
|
client->frame->desk_press = (e->type == ButtonPress);
|
||||||
framerender_frame(client->frame);
|
framerender_frame(client->frame);
|
||||||
break;
|
break;
|
||||||
case Context_Shade:
|
case OB_FRAME_CONTEXT_SHADE:
|
||||||
client->frame->shade_press = (e->type == ButtonPress);
|
client->frame->shade_press = (e->type == ButtonPress);
|
||||||
framerender_frame(client->frame);
|
framerender_frame(client->frame);
|
||||||
break;
|
break;
|
||||||
|
|
116
openbox/frame.c
116
openbox/frame.c
|
@ -1,4 +1,5 @@
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
|
#include "client.h"
|
||||||
#include "openbox.h"
|
#include "openbox.h"
|
||||||
#include "extensions.h"
|
#include "extensions.h"
|
||||||
#include "framerender.h"
|
#include "framerender.h"
|
||||||
|
@ -10,7 +11,10 @@
|
||||||
#define ELEMENT_EVENTMASK (ButtonPressMask | ButtonReleaseMask | \
|
#define ELEMENT_EVENTMASK (ButtonPressMask | ButtonReleaseMask | \
|
||||||
ButtonMotionMask | ExposureMask)
|
ButtonMotionMask | ExposureMask)
|
||||||
|
|
||||||
static void layout_title(Frame *self);
|
#define FRAME_HANDLE_Y(f) (f->innersize.top + f->client->area.height + \
|
||||||
|
f->cbwidth)
|
||||||
|
|
||||||
|
static void layout_title(ObFrame *self);
|
||||||
|
|
||||||
void frame_startup()
|
void frame_startup()
|
||||||
{
|
{
|
||||||
|
@ -29,13 +33,13 @@ static Window createWindow(Window parent, unsigned long mask,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Frame *frame_new()
|
ObFrame *frame_new()
|
||||||
{
|
{
|
||||||
XSetWindowAttributes attrib;
|
XSetWindowAttributes attrib;
|
||||||
unsigned long mask;
|
unsigned long mask;
|
||||||
Frame *self;
|
ObFrame *self;
|
||||||
|
|
||||||
self = g_new(Frame, 1);
|
self = g_new(ObFrame, 1);
|
||||||
|
|
||||||
self->visible = FALSE;
|
self->visible = FALSE;
|
||||||
self->decorations = 0;
|
self->decorations = 0;
|
||||||
|
@ -110,10 +114,10 @@ Frame *frame_new()
|
||||||
self->max_press = self->close_press = self->desk_press =
|
self->max_press = self->close_press = self->desk_press =
|
||||||
self->iconify_press = self->shade_press = FALSE;
|
self->iconify_press = self->shade_press = FALSE;
|
||||||
|
|
||||||
return (Frame*)self;
|
return (ObFrame*)self;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void frame_free(Frame *self)
|
static void frame_free(ObFrame *self)
|
||||||
{
|
{
|
||||||
RrAppearanceFree(self->a_unfocused_title);
|
RrAppearanceFree(self->a_unfocused_title);
|
||||||
RrAppearanceFree(self->a_focused_title);
|
RrAppearanceFree(self->a_focused_title);
|
||||||
|
@ -128,7 +132,7 @@ static void frame_free(Frame *self)
|
||||||
g_free(self);
|
g_free(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
void frame_show(Frame *self)
|
void frame_show(ObFrame *self)
|
||||||
{
|
{
|
||||||
if (!self->visible) {
|
if (!self->visible) {
|
||||||
self->visible = TRUE;
|
self->visible = TRUE;
|
||||||
|
@ -136,7 +140,7 @@ void frame_show(Frame *self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void frame_hide(Frame *self)
|
void frame_hide(ObFrame *self)
|
||||||
{
|
{
|
||||||
if (self->visible) {
|
if (self->visible) {
|
||||||
self->visible = FALSE;
|
self->visible = FALSE;
|
||||||
|
@ -145,7 +149,7 @@ void frame_hide(Frame *self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void frame_adjust_shape(Frame *self)
|
void frame_adjust_shape(ObFrame *self)
|
||||||
{
|
{
|
||||||
#ifdef SHAPE
|
#ifdef SHAPE
|
||||||
int num;
|
int num;
|
||||||
|
@ -191,7 +195,7 @@ void frame_adjust_shape(Frame *self)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void frame_adjust_area(Frame *self, gboolean moved, gboolean resized)
|
void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized)
|
||||||
{
|
{
|
||||||
if (resized) {
|
if (resized) {
|
||||||
self->decorations = self->client->decorations;
|
self->decorations = self->client->decorations;
|
||||||
|
@ -291,7 +295,7 @@ void frame_adjust_area(Frame *self, gboolean moved, gboolean resized)
|
||||||
frame_client_gravity. */
|
frame_client_gravity. */
|
||||||
self->area.x = self->client->area.x;
|
self->area.x = self->client->area.x;
|
||||||
self->area.y = self->client->area.y;
|
self->area.y = self->client->area.y;
|
||||||
frame_client_gravity((Frame*)self,
|
frame_client_gravity((ObFrame*)self,
|
||||||
&self->area.x, &self->area.y);
|
&self->area.x, &self->area.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,28 +313,28 @@ void frame_adjust_area(Frame *self, gboolean moved, gboolean resized)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void frame_adjust_state(Frame *self)
|
void frame_adjust_state(ObFrame *self)
|
||||||
{
|
{
|
||||||
framerender_frame(self);
|
framerender_frame(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
void frame_adjust_focus(Frame *self, gboolean hilite)
|
void frame_adjust_focus(ObFrame *self, gboolean hilite)
|
||||||
{
|
{
|
||||||
self->focused = hilite;
|
self->focused = hilite;
|
||||||
framerender_frame(self);
|
framerender_frame(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
void frame_adjust_title(Frame *self)
|
void frame_adjust_title(ObFrame *self)
|
||||||
{
|
{
|
||||||
framerender_frame(self);
|
framerender_frame(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
void frame_adjust_icon(Frame *self)
|
void frame_adjust_icon(ObFrame *self)
|
||||||
{
|
{
|
||||||
framerender_frame(self);
|
framerender_frame(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
void frame_grab_client(Frame *self, ObClient *client)
|
void frame_grab_client(ObFrame *self, ObClient *client)
|
||||||
{
|
{
|
||||||
self->client = client;
|
self->client = client;
|
||||||
|
|
||||||
|
@ -372,7 +376,7 @@ void frame_grab_client(Frame *self, ObClient *client)
|
||||||
g_hash_table_insert(window_map, &self->rgrip, client);
|
g_hash_table_insert(window_map, &self->rgrip, client);
|
||||||
}
|
}
|
||||||
|
|
||||||
void frame_release_client(Frame *self, ObClient *client)
|
void frame_release_client(ObFrame *self, ObClient *client)
|
||||||
{
|
{
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
|
@ -414,7 +418,7 @@ void frame_release_client(Frame *self, ObClient *client)
|
||||||
frame_free(self);
|
frame_free(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void layout_title(Frame *self)
|
static void layout_title(ObFrame *self)
|
||||||
{
|
{
|
||||||
char *lc;
|
char *lc;
|
||||||
int x;
|
int x;
|
||||||
|
@ -543,68 +547,64 @@ static void layout_title(Frame *self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Context frame_context_from_string(char *name)
|
ObFrameContext frame_context_from_string(char *name)
|
||||||
{
|
{
|
||||||
if (!g_ascii_strcasecmp("root", name))
|
if (!g_ascii_strcasecmp("root", name))
|
||||||
return Context_Root;
|
return OB_FRAME_CONTEXT_ROOT;
|
||||||
else if (!g_ascii_strcasecmp("client", name))
|
else if (!g_ascii_strcasecmp("client", name))
|
||||||
return Context_Client;
|
return OB_FRAME_CONTEXT_CLIENT;
|
||||||
else if (!g_ascii_strcasecmp("titlebar", name))
|
else if (!g_ascii_strcasecmp("titlebar", name))
|
||||||
return Context_Titlebar;
|
return OB_FRAME_CONTEXT_TITLEBAR;
|
||||||
else if (!g_ascii_strcasecmp("handle", name))
|
else if (!g_ascii_strcasecmp("handle", name))
|
||||||
return Context_Handle;
|
return OB_FRAME_CONTEXT_HANDLE;
|
||||||
else if (!g_ascii_strcasecmp("frame", name))
|
else if (!g_ascii_strcasecmp("frame", name))
|
||||||
return Context_Frame;
|
return OB_FRAME_CONTEXT_FRAME;
|
||||||
else if (!g_ascii_strcasecmp("blcorner", name))
|
else if (!g_ascii_strcasecmp("blcorner", name))
|
||||||
return Context_BLCorner;
|
return OB_FRAME_CONTEXT_BLCORNER;
|
||||||
else if (!g_ascii_strcasecmp("tlcorner", name))
|
|
||||||
return Context_TLCorner;
|
|
||||||
else if (!g_ascii_strcasecmp("brcorner", name))
|
else if (!g_ascii_strcasecmp("brcorner", name))
|
||||||
return Context_BRCorner;
|
return OB_FRAME_CONTEXT_BRCORNER;
|
||||||
else if (!g_ascii_strcasecmp("trcorner", name))
|
|
||||||
return Context_TRCorner;
|
|
||||||
else if (!g_ascii_strcasecmp("maximize", name))
|
else if (!g_ascii_strcasecmp("maximize", name))
|
||||||
return Context_Maximize;
|
return OB_FRAME_CONTEXT_MAXIMIZE;
|
||||||
else if (!g_ascii_strcasecmp("alldesktops", name))
|
else if (!g_ascii_strcasecmp("alldesktops", name))
|
||||||
return Context_AllDesktops;
|
return OB_FRAME_CONTEXT_ALLDESKTOPS;
|
||||||
else if (!g_ascii_strcasecmp("shade", name))
|
else if (!g_ascii_strcasecmp("shade", name))
|
||||||
return Context_Shade;
|
return OB_FRAME_CONTEXT_SHADE;
|
||||||
else if (!g_ascii_strcasecmp("iconify", name))
|
else if (!g_ascii_strcasecmp("iconify", name))
|
||||||
return Context_Iconify;
|
return OB_FRAME_CONTEXT_ICONIFY;
|
||||||
else if (!g_ascii_strcasecmp("icon", name))
|
else if (!g_ascii_strcasecmp("icon", name))
|
||||||
return Context_Icon;
|
return OB_FRAME_CONTEXT_ICON;
|
||||||
else if (!g_ascii_strcasecmp("close", name))
|
else if (!g_ascii_strcasecmp("close", name))
|
||||||
return Context_Close;
|
return OB_FRAME_CONTEXT_CLOSE;
|
||||||
return Context_None;
|
return OB_FRAME_CONTEXT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Context frame_context(ObClient *client, Window win)
|
ObFrameContext frame_context(ObClient *client, Window win)
|
||||||
{
|
{
|
||||||
Frame *self;
|
ObFrame *self;
|
||||||
|
|
||||||
if (win == ob_root) return Context_Root;
|
if (win == ob_root) return OB_FRAME_CONTEXT_ROOT;
|
||||||
if (client == NULL) return Context_None;
|
if (client == NULL) return OB_FRAME_CONTEXT_NONE;
|
||||||
if (win == client->window) return Context_Client;
|
if (win == client->window) return OB_FRAME_CONTEXT_CLIENT;
|
||||||
|
|
||||||
self = client->frame;
|
self = client->frame;
|
||||||
if (win == self->window) return Context_Frame;
|
if (win == self->window) return OB_FRAME_CONTEXT_FRAME;
|
||||||
if (win == self->plate) return Context_Client;
|
if (win == self->plate) return OB_FRAME_CONTEXT_CLIENT;
|
||||||
if (win == self->title) return Context_Titlebar;
|
if (win == self->title) return OB_FRAME_CONTEXT_TITLEBAR;
|
||||||
if (win == self->label) return Context_Titlebar;
|
if (win == self->label) return OB_FRAME_CONTEXT_TITLEBAR;
|
||||||
if (win == self->handle) return Context_Handle;
|
if (win == self->handle) return OB_FRAME_CONTEXT_HANDLE;
|
||||||
if (win == self->lgrip) return Context_BLCorner;
|
if (win == self->lgrip) return OB_FRAME_CONTEXT_BLCORNER;
|
||||||
if (win == self->rgrip) return Context_BRCorner;
|
if (win == self->rgrip) return OB_FRAME_CONTEXT_BRCORNER;
|
||||||
if (win == self->max) return Context_Maximize;
|
if (win == self->max) return OB_FRAME_CONTEXT_MAXIMIZE;
|
||||||
if (win == self->iconify)return Context_Iconify;
|
if (win == self->iconify)return OB_FRAME_CONTEXT_ICONIFY;
|
||||||
if (win == self->close) return Context_Close;
|
if (win == self->close) return OB_FRAME_CONTEXT_CLOSE;
|
||||||
if (win == self->icon) return Context_Icon;
|
if (win == self->icon) return OB_FRAME_CONTEXT_ICON;
|
||||||
if (win == self->desk) return Context_AllDesktops;
|
if (win == self->desk) return OB_FRAME_CONTEXT_ALLDESKTOPS;
|
||||||
if (win == self->shade) return Context_Shade;
|
if (win == self->shade) return OB_FRAME_CONTEXT_SHADE;
|
||||||
|
|
||||||
return Context_None;
|
return OB_FRAME_CONTEXT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void frame_client_gravity(Frame *self, int *x, int *y)
|
void frame_client_gravity(ObFrame *self, int *x, int *y)
|
||||||
{
|
{
|
||||||
/* horizontal */
|
/* horizontal */
|
||||||
switch (self->client->gravity) {
|
switch (self->client->gravity) {
|
||||||
|
@ -659,7 +659,7 @@ void frame_client_gravity(Frame *self, int *x, int *y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void frame_frame_gravity(Frame *self, int *x, int *y)
|
void frame_frame_gravity(ObFrame *self, int *x, int *y)
|
||||||
{
|
{
|
||||||
/* horizontal */
|
/* horizontal */
|
||||||
switch (self->client->gravity) {
|
switch (self->client->gravity) {
|
||||||
|
|
|
@ -2,34 +2,33 @@
|
||||||
#define __frame_h
|
#define __frame_h
|
||||||
|
|
||||||
#include "geom.h"
|
#include "geom.h"
|
||||||
#include "client.h"
|
|
||||||
#include "render/render.h"
|
#include "render/render.h"
|
||||||
|
|
||||||
|
typedef struct _ObFrame ObFrame;
|
||||||
|
|
||||||
|
struct _ObClient;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
Context_None,
|
OB_FRAME_CONTEXT_NONE,
|
||||||
Context_Root,
|
OB_FRAME_CONTEXT_ROOT,
|
||||||
Context_Client,
|
OB_FRAME_CONTEXT_CLIENT,
|
||||||
Context_Titlebar,
|
OB_FRAME_CONTEXT_TITLEBAR,
|
||||||
Context_Handle,
|
OB_FRAME_CONTEXT_HANDLE,
|
||||||
Context_Frame,
|
OB_FRAME_CONTEXT_FRAME,
|
||||||
Context_BLCorner,
|
OB_FRAME_CONTEXT_BLCORNER,
|
||||||
Context_BRCorner,
|
OB_FRAME_CONTEXT_BRCORNER,
|
||||||
Context_TLCorner,
|
OB_FRAME_CONTEXT_MAXIMIZE,
|
||||||
Context_TRCorner,
|
OB_FRAME_CONTEXT_ALLDESKTOPS,
|
||||||
Context_Maximize,
|
OB_FRAME_CONTEXT_SHADE,
|
||||||
Context_AllDesktops,
|
OB_FRAME_CONTEXT_ICONIFY,
|
||||||
Context_Shade,
|
OB_FRAME_CONTEXT_ICON,
|
||||||
Context_Iconify,
|
OB_FRAME_CONTEXT_CLOSE,
|
||||||
Context_Icon,
|
OB_FRAME_NUM_CONTEXTS
|
||||||
Context_Close,
|
} ObFrameContext;
|
||||||
NUM_CONTEXTS
|
|
||||||
} Context;
|
|
||||||
|
|
||||||
#define FRAME_HANDLE_Y(f) (f->innersize.top + f->client->area.height + \
|
struct _ObFrame
|
||||||
f->cbwidth)
|
{
|
||||||
|
struct _ObClient *client;
|
||||||
typedef struct Frame {
|
|
||||||
ObClient *client;
|
|
||||||
|
|
||||||
Window window;
|
Window window;
|
||||||
Window plate;
|
Window plate;
|
||||||
|
@ -82,38 +81,38 @@ typedef struct Frame {
|
||||||
gboolean iconify_press;
|
gboolean iconify_press;
|
||||||
|
|
||||||
gboolean focused;
|
gboolean focused;
|
||||||
} Frame;
|
};
|
||||||
|
|
||||||
void frame_startup();
|
void frame_startup();
|
||||||
void frame_shutdown();
|
void frame_shutdown();
|
||||||
|
|
||||||
Frame *frame_new();
|
ObFrame *frame_new();
|
||||||
void frame_show(Frame *self);
|
void frame_show(ObFrame *self);
|
||||||
void frame_hide(Frame *self);
|
void frame_hide(ObFrame *self);
|
||||||
void frame_adjust_shape(Frame *self);
|
void frame_adjust_shape(ObFrame *self);
|
||||||
void frame_adjust_area(Frame *self, gboolean moved, gboolean resized);
|
void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized);
|
||||||
void frame_adjust_state(Frame *self);
|
void frame_adjust_state(ObFrame *self);
|
||||||
void frame_adjust_focus(Frame *self, gboolean hilite);
|
void frame_adjust_focus(ObFrame *self, gboolean hilite);
|
||||||
void frame_adjust_title(Frame *self);
|
void frame_adjust_title(ObFrame *self);
|
||||||
void frame_adjust_icon(Frame *self);
|
void frame_adjust_icon(ObFrame *self);
|
||||||
void frame_grab_client(Frame *self, ObClient *client);
|
void frame_grab_client(ObFrame *self, struct _ObClient *client);
|
||||||
void frame_release_client(Frame *self, ObClient *client);
|
void frame_release_client(ObFrame *self, struct _ObClient *client);
|
||||||
|
|
||||||
Context frame_context_from_string(char *name);
|
ObFrameContext frame_context_from_string(char *name);
|
||||||
|
|
||||||
Context frame_context(ObClient *self, Window win);
|
ObFrameContext frame_context(struct _ObClient *self, Window win);
|
||||||
|
|
||||||
/*! Applies gravity to the client's position to find where the frame should
|
/*! Applies gravity to the client's position to find where the frame should
|
||||||
be positioned.
|
be positioned.
|
||||||
@return The proper coordinates for the frame, based on the client.
|
@return The proper coordinates for the frame, based on the client.
|
||||||
*/
|
*/
|
||||||
void frame_client_gravity(Frame *self, int *x, int *y);
|
void frame_client_gravity(ObFrame *self, int *x, int *y);
|
||||||
|
|
||||||
/*! Reversly applies gravity to the frame's position to find where the client
|
/*! Reversly applies gravity to the frame's position to find where the client
|
||||||
should be positioned.
|
should be positioned.
|
||||||
@return The proper coordinates for the client, based on the frame.
|
@return The proper coordinates for the client, based on the frame.
|
||||||
*/
|
*/
|
||||||
void frame_frame_gravity(Frame *self, int *x, int *y);
|
void frame_frame_gravity(ObFrame *self, int *x, int *y);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -4,15 +4,15 @@
|
||||||
#include "framerender.h"
|
#include "framerender.h"
|
||||||
#include "render/theme.h"
|
#include "render/theme.h"
|
||||||
|
|
||||||
static void framerender_label(Frame *self, RrAppearance *a);
|
static void framerender_label(ObFrame *self, RrAppearance *a);
|
||||||
static void framerender_icon(Frame *self, RrAppearance *a);
|
static void framerender_icon(ObFrame *self, RrAppearance *a);
|
||||||
static void framerender_max(Frame *self, RrAppearance *a);
|
static void framerender_max(ObFrame *self, RrAppearance *a);
|
||||||
static void framerender_iconify(Frame *self, RrAppearance *a);
|
static void framerender_iconify(ObFrame *self, RrAppearance *a);
|
||||||
static void framerender_desk(Frame *self, RrAppearance *a);
|
static void framerender_desk(ObFrame *self, RrAppearance *a);
|
||||||
static void framerender_shade(Frame *self, RrAppearance *a);
|
static void framerender_shade(ObFrame *self, RrAppearance *a);
|
||||||
static void framerender_close(Frame *self, RrAppearance *a);
|
static void framerender_close(ObFrame *self, RrAppearance *a);
|
||||||
|
|
||||||
void framerender_frame(Frame *self)
|
void framerender_frame(ObFrame *self)
|
||||||
{
|
{
|
||||||
if (self->focused)
|
if (self->focused)
|
||||||
XSetWindowBorder(ob_display, self->plate,
|
XSetWindowBorder(ob_display, self->plate,
|
||||||
|
@ -145,7 +145,7 @@ void framerender_frame(Frame *self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void framerender_label(Frame *self, RrAppearance *a)
|
static void framerender_label(ObFrame *self, RrAppearance *a)
|
||||||
{
|
{
|
||||||
if (self->label_x < 0) return;
|
if (self->label_x < 0) return;
|
||||||
/* set the texture's text! */
|
/* set the texture's text! */
|
||||||
|
@ -153,7 +153,7 @@ static void framerender_label(Frame *self, RrAppearance *a)
|
||||||
RrPaint(a, self->label, self->label_width, ob_rr_theme->label_height);
|
RrPaint(a, self->label, self->label_width, ob_rr_theme->label_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void framerender_icon(Frame *self, RrAppearance *a)
|
static void framerender_icon(ObFrame *self, RrAppearance *a)
|
||||||
{
|
{
|
||||||
if (self->icon_x < 0) return;
|
if (self->icon_x < 0) return;
|
||||||
|
|
||||||
|
@ -172,33 +172,33 @@ static void framerender_icon(Frame *self, RrAppearance *a)
|
||||||
ob_rr_theme->button_size + 2, ob_rr_theme->button_size + 2);
|
ob_rr_theme->button_size + 2, ob_rr_theme->button_size + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void framerender_max(Frame *self, RrAppearance *a)
|
static void framerender_max(ObFrame *self, RrAppearance *a)
|
||||||
{
|
{
|
||||||
if (self->max_x < 0) return;
|
if (self->max_x < 0) return;
|
||||||
RrPaint(a, self->max, ob_rr_theme->button_size, ob_rr_theme->button_size);
|
RrPaint(a, self->max, ob_rr_theme->button_size, ob_rr_theme->button_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void framerender_iconify(Frame *self, RrAppearance *a)
|
static void framerender_iconify(ObFrame *self, RrAppearance *a)
|
||||||
{
|
{
|
||||||
if (self->iconify_x < 0) return;
|
if (self->iconify_x < 0) return;
|
||||||
RrPaint(a, self->iconify,
|
RrPaint(a, self->iconify,
|
||||||
ob_rr_theme->button_size, ob_rr_theme->button_size);
|
ob_rr_theme->button_size, ob_rr_theme->button_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void framerender_desk(Frame *self, RrAppearance *a)
|
static void framerender_desk(ObFrame *self, RrAppearance *a)
|
||||||
{
|
{
|
||||||
if (self->desk_x < 0) return;
|
if (self->desk_x < 0) return;
|
||||||
RrPaint(a, self->desk, ob_rr_theme->button_size, ob_rr_theme->button_size);
|
RrPaint(a, self->desk, ob_rr_theme->button_size, ob_rr_theme->button_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void framerender_shade(Frame *self, RrAppearance *a)
|
static void framerender_shade(ObFrame *self, RrAppearance *a)
|
||||||
{
|
{
|
||||||
if (self->shade_x < 0) return;
|
if (self->shade_x < 0) return;
|
||||||
RrPaint(a, self->shade,
|
RrPaint(a, self->shade,
|
||||||
ob_rr_theme->button_size, ob_rr_theme->button_size);
|
ob_rr_theme->button_size, ob_rr_theme->button_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void framerender_close(Frame *self, RrAppearance *a)
|
static void framerender_close(ObFrame *self, RrAppearance *a)
|
||||||
{
|
{
|
||||||
if (self->close_x < 0) return;
|
if (self->close_x < 0) return;
|
||||||
RrPaint(a, self->close,
|
RrPaint(a, self->close,
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
|
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
|
|
||||||
void framerender_frame(Frame *self);
|
void framerender_frame(ObFrame *self);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "openbox.h"
|
#include "openbox.h"
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
|
#include "client.h"
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
#include "stacking.h"
|
#include "stacking.h"
|
||||||
#include "render/render.h"
|
#include "render/render.h"
|
||||||
|
|
|
@ -102,14 +102,14 @@ void plugin_setup_config()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Array of GSList*s of PointerBinding*s. */
|
/* Array of GSList*s of PointerBinding*s. */
|
||||||
static GSList *bound_contexts[NUM_CONTEXTS];
|
static GSList *bound_contexts[OB_FRAME_NUM_CONTEXTS];
|
||||||
|
|
||||||
static void grab_for_client(ObClient *client, gboolean grab)
|
static void grab_for_client(ObClient *client, gboolean grab)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
GSList *it;
|
GSList *it;
|
||||||
|
|
||||||
for (i = 0; i < NUM_CONTEXTS; ++i)
|
for (i = 0; i < OB_FRAME_NUM_CONTEXTS; ++i)
|
||||||
for (it = bound_contexts[i]; it != NULL; it = it->next) {
|
for (it = bound_contexts[i]; it != NULL; it = it->next) {
|
||||||
/* grab/ungrab the button */
|
/* grab/ungrab the button */
|
||||||
MouseBinding *b = it->data;
|
MouseBinding *b = it->data;
|
||||||
|
@ -117,11 +117,11 @@ static void grab_for_client(ObClient *client, gboolean grab)
|
||||||
int mode;
|
int mode;
|
||||||
unsigned int mask;
|
unsigned int mask;
|
||||||
|
|
||||||
if (i == Context_Frame) {
|
if (i == OB_FRAME_CONTEXT_FRAME) {
|
||||||
win = client->frame->window;
|
win = client->frame->window;
|
||||||
mode = GrabModeAsync;
|
mode = GrabModeAsync;
|
||||||
mask = ButtonPressMask | ButtonMotionMask | ButtonReleaseMask;
|
mask = ButtonPressMask | ButtonMotionMask | ButtonReleaseMask;
|
||||||
} else if (i == Context_Client) {
|
} else if (i == OB_FRAME_CONTEXT_CLIENT) {
|
||||||
win = client->frame->plate;
|
win = client->frame->plate;
|
||||||
mode = GrabModeSync; /* this is handled in event */
|
mode = GrabModeSync; /* this is handled in event */
|
||||||
mask = ButtonPressMask; /* can't catch more than this with Sync
|
mask = ButtonPressMask; /* can't catch more than this with Sync
|
||||||
|
@ -149,7 +149,7 @@ static void clearall()
|
||||||
int i;
|
int i;
|
||||||
GSList *it;
|
GSList *it;
|
||||||
|
|
||||||
for(i = 0; i < NUM_CONTEXTS; ++i) {
|
for(i = 0; i < OB_FRAME_NUM_CONTEXTS; ++i) {
|
||||||
for (it = bound_contexts[i]; it != NULL; it = it->next) {
|
for (it = bound_contexts[i]; it != NULL; it = it->next) {
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
|
@ -167,7 +167,8 @@ static void clearall()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fire_button(MouseAction a, Context context, ObClient *c, guint state,
|
static void fire_button(MouseAction a, ObFrameContext context,
|
||||||
|
ObClient *c, guint state,
|
||||||
guint button, int x, int y)
|
guint button, int x, int y)
|
||||||
{
|
{
|
||||||
GSList *it;
|
GSList *it;
|
||||||
|
@ -198,7 +199,7 @@ static void fire_button(MouseAction a, Context context, ObClient *c, guint state
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fire_motion(MouseAction a, Context context, ObClient *c,
|
static void fire_motion(MouseAction a, ObFrameContext context, ObClient *c,
|
||||||
guint state, guint button, int x_root, int y_root,
|
guint state, guint button, int x_root, int y_root,
|
||||||
guint32 corner)
|
guint32 corner)
|
||||||
{
|
{
|
||||||
|
@ -259,7 +260,7 @@ static void event(ObEvent *e, void *foo)
|
||||||
static int px, py;
|
static int px, py;
|
||||||
gboolean click = FALSE;
|
gboolean click = FALSE;
|
||||||
gboolean dclick = FALSE;
|
gboolean dclick = FALSE;
|
||||||
Context context;
|
ObFrameContext context;
|
||||||
|
|
||||||
switch (e->type) {
|
switch (e->type) {
|
||||||
case Event_Client_Mapped:
|
case Event_Client_Mapped:
|
||||||
|
@ -284,7 +285,7 @@ static void event(ObEvent *e, void *foo)
|
||||||
e->data.x.e->xbutton.button,
|
e->data.x.e->xbutton.button,
|
||||||
e->data.x.e->xbutton.x_root, e->data.x.e->xbutton.y_root);
|
e->data.x.e->xbutton.x_root, e->data.x.e->xbutton.y_root);
|
||||||
|
|
||||||
if (context == Context_Client) {
|
if (context == OB_FRAME_CONTEXT_CLIENT) {
|
||||||
/* Replay the event, so it goes to the client*/
|
/* Replay the event, so it goes to the client*/
|
||||||
XAllowEvents(ob_display, ReplayPointer, event_lasttime);
|
XAllowEvents(ob_display, ReplayPointer, event_lasttime);
|
||||||
/* Fall through to the release case! */
|
/* Fall through to the release case! */
|
||||||
|
@ -348,12 +349,12 @@ static void event(ObEvent *e, void *foo)
|
||||||
e->data.x.e->xmotion.window);
|
e->data.x.e->xmotion.window);
|
||||||
|
|
||||||
/* You can't drag on buttons */
|
/* You can't drag on buttons */
|
||||||
if (context == Context_Maximize ||
|
if (context == OB_FRAME_CONTEXT_MAXIMIZE ||
|
||||||
context == Context_AllDesktops ||
|
context == OB_FRAME_CONTEXT_ALLDESKTOPS ||
|
||||||
context == Context_Shade ||
|
context == OB_FRAME_CONTEXT_SHADE ||
|
||||||
context == Context_Iconify ||
|
context == OB_FRAME_CONTEXT_ICONIFY ||
|
||||||
context == Context_Icon ||
|
context == OB_FRAME_CONTEXT_ICON ||
|
||||||
context == Context_Close)
|
context == OB_FRAME_CONTEXT_CLOSE)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!e->data.x.client)
|
if (!e->data.x.client)
|
||||||
|
@ -393,7 +394,7 @@ gboolean mbind(char *buttonstr, char *contextstr, MouseAction mact,
|
||||||
Action *action)
|
Action *action)
|
||||||
{
|
{
|
||||||
guint state, button;
|
guint state, button;
|
||||||
Context context;
|
ObFrameContext context;
|
||||||
MouseBinding *b;
|
MouseBinding *b;
|
||||||
GSList *it;
|
GSList *it;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue