summaryrefslogtreecommitdiff
path: root/openbox
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2007-07-12 02:57:08 -0400
committerDana Jansens <danakj@orodu.net>2007-07-12 02:57:08 -0400
commit4b73574406e24df84e909014926e56ab1e5c7934 (patch)
tree9adf4101fd94bf0a9bc1ffe3817ffe1e944a9986 /openbox
parent37a5b59d7bf51a201981c486b800b3b8d57e9b9c (diff)
adding trunk
Signed-off-by: Dana Jansens <danakj@orodu.net>
Diffstat (limited to 'openbox')
-rw-r--r--openbox/client.c27
-rw-r--r--openbox/client.h4
-rw-r--r--openbox/composite.c75
-rw-r--r--openbox/composite.h17
-rw-r--r--openbox/event.c2
-rw-r--r--openbox/extensions.c25
-rw-r--r--openbox/extensions.h12
-rw-r--r--openbox/frame.c93
-rw-r--r--openbox/frame.h5
-rw-r--r--openbox/openbox.c3
-rw-r--r--openbox/screen.c4
11 files changed, 31 insertions, 236 deletions
diff --git a/openbox/client.c b/openbox/client.c
index 93785459..071ecc4d 100644
--- a/openbox/client.c
+++ b/openbox/client.c
@@ -4175,30 +4175,3 @@ gboolean client_has_group_siblings(ObClient *self)
{
return self->group && self->group->members->next;
}
-
-ObClientIcon *client_thumbnail(ObClient *self, gint wantw, gint wanth)
-{
- ObClientIcon *ret;
- RrPixel32 *data;
- gint w, h;
-
- if (!self->frame->pixmap) return NULL;
- if (!RrPixmapToRGBA(ob_rr_inst, self->frame->pixmap, None, &w, &h, &data))
- return NULL;
-
- /* resize the thumbnail (within aspect ratio) to the given sizes */
-
- ret = g_new(ObClientIcon, 1);
- ret->data = data;
- ret->width = w;
- ret->height = h;
- return ret;
-}
-
-void clienticon_free(ObClientIcon *ci)
-{
- if (ci) {
- g_free(ci->data);
- g_free(ci);
- }
-}
diff --git a/openbox/client.h b/openbox/client.h
index 9f208596..e33b89e4 100644
--- a/openbox/client.h
+++ b/openbox/client.h
@@ -626,8 +626,6 @@ void client_get_type_and_transientness(ObClient *self);
const ObClientIcon *client_icon(ObClient *self, gint w, gint h);
-ObClientIcon *client_thumbnail(ObClient *self, gint w, gint h);
-
/*! Return TRUE if the client is transient for some other window. Return
FALSE if it's not transient or there is no window for it to be
transient for */
@@ -709,6 +707,4 @@ ObClient* client_under_pointer();
gboolean client_has_group_siblings(ObClient *self);
-void clienticon_free(ObClientIcon *ci);
-
#endif
diff --git a/openbox/composite.c b/openbox/composite.c
index deedf965..e69de29b 100644
--- a/openbox/composite.c
+++ b/openbox/composite.c
@@ -1,75 +0,0 @@
-#include "composite.h"
-#include "openbox.h"
-#include "extensions.h"
-
-#ifndef USE_XCOMPOSITE
-void composite_startup(gboolean reconfig) {}
-void composite_shutdown(gboolean reconfig) {}
-gboolean composite_window_has_alpha(Visual *vis) { return FALSE; }
-XID composite_get_window_picture(Window win, Visual *vis) { return None; }
-Pixmap composite_get_window_pixmap(Window win) { return None; }
-void composite_setup_root_window() {}
-void composite_enable_for_window(Window win) {}
-#else
-
-static Picture root_picture = None;
-
-void composite_startup(gboolean reconfig)
-{
- if (reconfig) return;
- if (!extensions_comp) return;
-}
-
-void composite_shutdown(gboolean reconfig)
-{
- if (reconfig) return;
- if (!extensions_comp) return;
-}
-
-void composite_setup_root_window()
-{
- if (root_picture)
- XRenderFreePicture(ob_display, root_picture);
-
- root_picture =
- composite_get_window_picture(RootWindow(ob_display, ob_screen),
- RrVisual(ob_rr_inst));
-}
-
-gboolean composite_window_has_alpha(Visual *vis)
-{
- XRenderPictFormat *format;
-
- if (!extensions_comp) return FALSE;
-
- format = XRenderFindVisualFormat(ob_display, vis);
- return format->type == PictTypeDirect && format->direct.alphaMask;
-}
-
-XID composite_get_window_picture(Window win, Visual *vis)
-{
- XRenderPictureAttributes pa;
- XRenderPictFormat *format;
-
- if (!extensions_comp) return None;
-
- format = XRenderFindVisualFormat(ob_display, vis);
-
- pa.subwindow_mode = IncludeInferiors;
- return XRenderCreatePicture(ob_display, win, format, CPSubwindowMode, &pa);
-}
-
-Pixmap composite_get_window_pixmap(Window win)
-{
- if (!extensions_comp) return None;
-
- return XCompositeNameWindowPixmap(ob_display, win);
-}
-
-void composite_enable_for_window(Window win)
-{
- /* Redirect window contents to offscreen pixmaps */
- XCompositeRedirectWindow(ob_display, win, CompositeRedirectAutomatic);
-}
-
-#endif
diff --git a/openbox/composite.h b/openbox/composite.h
index d20abacb..e69de29b 100644
--- a/openbox/composite.h
+++ b/openbox/composite.h
@@ -1,17 +0,0 @@
-#ifndef __composite_h
-#define __composite_h
-
-#include <glib.h>
-#include <X11/Xlib.h>
-
-void composite_startup(gboolean reconfig);
-void composite_shutdown(gboolean reconfig);
-
-void composite_setup_root_window();
-void composite_enable_for_window(Window win);
-
-gboolean composite_window_has_alpha(Visual *vis);
-XID composite_get_window_picture(Window win, Visual *vis);
-Pixmap composite_get_window_pixmap(Window win);
-
-#endif
diff --git a/openbox/event.c b/openbox/event.c
index ab4e8f9a..c3a17fbd 100644
--- a/openbox/event.c
+++ b/openbox/event.c
@@ -1529,7 +1529,7 @@ static void event_handle_client(ObClient *client, XEvent *e)
#ifdef SHAPE
if (extensions_shape && e->type == extensions_shape_event_basep) {
client->shaped = ((XShapeEvent*)e)->shaped;
- frame_adjust_area(client->frame, FALSE, TRUE, FALSE);
+ frame_adjust_shape(client->frame);
}
#endif
}
diff --git a/openbox/extensions.c b/openbox/extensions.c
index 2fdc6863..b7d8e73a 100644
--- a/openbox/extensions.c
+++ b/openbox/extensions.c
@@ -33,8 +33,6 @@ gboolean extensions_randr = FALSE;
gint extensions_randr_event_basep;
gboolean extensions_sync = FALSE;
gint extensions_sync_event_basep;
-gboolean extensions_comp = FALSE;
-gint extensions_comp_event_basep;
void extensions_query_all()
{
@@ -82,22 +80,6 @@ void extensions_query_all()
ob_debug("X Sync extension is not present on the server or is an "
"incompatible version\n");
#endif
-
-#ifdef USE_XCOMPOSITE
- if (XCompositeQueryExtension(ob_display, &extensions_comp_event_basep,
- &junk))
- {
- gint major = 0, minor = 2;
- XCompositeQueryVersion(ob_display, &major, &minor);
- /* Version 0.2 is the first version to have the
- XCompositeNameWindowPixmap() request. */
- if (major > 0 || minor >= 2)
- extensions_comp = TRUE;
- }
- if (!extensions_comp)
- ob_debug("X Composite extension is not present on the server or is an "
- "incompatible version\n");
-#endif
}
void extensions_xinerama_screens(Rect **xin_areas, guint *nxin)
@@ -146,10 +128,3 @@ void extensions_xinerama_screens(Rect **xin_areas, guint *nxin)
}
RECT_SET((*xin_areas)[*nxin], l, t, r - l + 1, b - t + 1);
}
-
-#ifdef USE_XCOMPOSITE
-Picture extensions_create_composite_picture(Window win, Visual *vis,
- gboolean *has_alpha)
-{
-}
-#endif
diff --git a/openbox/extensions.h b/openbox/extensions.h
index 94bf0dbf..3fbac871 100644
--- a/openbox/extensions.h
+++ b/openbox/extensions.h
@@ -39,11 +39,6 @@
#ifdef SYNC
#include <X11/extensions/sync.h>
#endif
-#ifdef USE_XCOMPOSITE
-#include <X11/extensions/Xcomposite.h>
-#include <X11/extensions/Xdamage.h>
-#include <X11/extensions/Xrender.h>
-#endif
#include <glib.h>
@@ -72,13 +67,8 @@ extern gboolean extensions_sync;
/*! Base for events for the Sync extension */
extern gint extensions_sync_event_basep;
-/*! Does the display have the Composite extension? */
-extern gboolean extensions_comp;
-/*! Base for events for the Composite extension */
-extern gint extensions_comp_event_basep;
-
void extensions_query_all();
void extensions_xinerama_screens(Rect **areas, guint *nxin);
-
+
#endif
diff --git a/openbox/frame.c b/openbox/frame.c
index c53d51d9..a4843d6f 100644
--- a/openbox/frame.c
+++ b/openbox/frame.c
@@ -27,7 +27,6 @@
#include "mainloop.h"
#include "focus_cycle.h"
#include "focus_cycle_indicator.h"
-#include "composite.h"
#include "moveresize.h"
#include "screen.h"
#include "render/theme.h"
@@ -51,10 +50,7 @@ static void layout_title(ObFrame *self);
static void set_theme_statics(ObFrame *self);
static void free_theme_statics(ObFrame *self);
static gboolean frame_animate_iconify(gpointer self);
-static void frame_adjust_shape(ObFrame *self);
static void frame_adjust_cursors(ObFrame *self);
-static void frame_get_offscreen_buffer(ObFrame *self);
-static void frame_free_offscreen_buffer(ObFrame *self);
static Window createWindow(Window parent, Visual *visual,
gulong mask, XSetWindowAttributes *attrib)
@@ -66,46 +62,58 @@ static Window createWindow(Window parent, Visual *visual,
}
+static Visual *check_32bit_client(ObClient *c)
+{
+ XWindowAttributes wattrib;
+ Status ret;
+
+ /* we're already running at 32 bit depth, yay. we don't need to use their
+ visual */
+ if (RrDepth(ob_rr_inst) == 32)
+ return NULL;
+
+ ret = XGetWindowAttributes(ob_display, c->window, &wattrib);
+ g_assert(ret != BadDrawable);
+ g_assert(ret != BadWindow);
+
+ if (wattrib.depth == 32)
+ return wattrib.visual;
+ return NULL;
+}
+
ObFrame *frame_new(ObClient *client)
{
XSetWindowAttributes attrib;
gulong mask;
ObFrame *self;
- XWindowAttributes wattrib;
- Status ret;
+ Visual *visual;
self = g_new0(ObFrame, 1);
self->client = client;
- ret = XGetWindowAttributes(ob_display, client->window, &wattrib);
- g_assert(ret != BadDrawable);
- g_assert(ret != BadWindow);
- self->has_alpha = composite_window_has_alpha(wattrib.visual);
+ visual = check_32bit_client(client);
/* create the non-visible decor windows */
mask = 0;
- if (self->has_alpha) {
- /* the colormap/backpixel/borderpixel are required for supporting
- windows with 32bit visuals */
- mask = CWColormap | CWBackPixel | CWBorderPixel;
+ if (visual) {
+ /* client has a 32-bit visual */
+ mask |= CWColormap | CWBackPixel | CWBorderPixel;
/* create a colormap with the visual */
self->colormap = attrib.colormap =
XCreateColormap(ob_display,
RootWindow(ob_display, ob_screen),
- wattrib.visual, AllocNone);
+ visual, AllocNone);
attrib.background_pixel = BlackPixel(ob_display, ob_screen);
attrib.border_pixel = BlackPixel(ob_display, ob_screen);
}
-
- self->window = createWindow(RootWindow(ob_display, ob_screen),
- (self->has_alpha ? wattrib.visual : NULL),
+ self->window = createWindow(RootWindow(ob_display, ob_screen), visual,
mask, &attrib);
/* create the visible decor windows */
mask = 0;
- if (self->has_alpha) {
+ if (visual) {
/* client has a 32-bit visual */
mask |= CWColormap | CWBackPixel | CWBorderPixel;
attrib.colormap = RrColormap(ob_rr_inst);
@@ -232,7 +240,6 @@ void frame_free(ObFrame *self)
XDestroyWindow(ob_display, self->window);
if (self->colormap)
XFreeColormap(ob_display, self->colormap);
- frame_free_offscreen_buffer(self);
g_free(self);
}
@@ -244,8 +251,6 @@ void frame_show(ObFrame *self)
framerender_frame(self);
XMapWindow(ob_display, self->client->window);
XMapWindow(ob_display, self->window);
-
- frame_get_offscreen_buffer(self);
}
}
@@ -255,7 +260,6 @@ void frame_hide(ObFrame *self)
self->visible = FALSE;
if (!frame_iconify_animating(self))
XUnmapWindow(ob_display, self->window);
-
/* we unmap the client itself so that we can get MapRequest
events, and because the ICCCM tells us to! */
XUnmapWindow(ob_display, self->client->window);
@@ -364,8 +368,7 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
self->cbwidth_l + (!self->max_horz ? self->bwidth : 0),
self->cbwidth_t + self->bwidth,
self->cbwidth_r + (!self->max_horz ? self->bwidth : 0),
- self->cbwidth_b + (!self->max_horz || !self->max_vert ?
- self->bwidth : 0));
+ self->cbwidth_b + (!self->max_horz || !self->max_vert ? self->bwidth : 0));
if (self->decorations & OB_FRAME_DECOR_TITLEBAR)
self->size.top += ob_rr_theme->title_height + self->bwidth;
@@ -783,9 +786,6 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
self->need_render = TRUE;
framerender_frame(self);
frame_adjust_shape(self);
-
- /* the offscreen buffer's shape needs to match */
- frame_get_offscreen_buffer(self);
}
if (!STRUT_EQUAL(self->size, oldsize)) {
@@ -916,9 +916,6 @@ void frame_grab_client(ObFrame *self)
/* reparent the client to the frame */
XReparentWindow(ob_display, self->client->window, self->window, 0, 0);
- /* enable the offscreen composite buffer for the client window */
- composite_enable_for_window(self->client->window);
-
/*
When reparenting the client window, it is usually not mapped yet, since
this occurs from a MapRequest. However, in the case where Openbox is
@@ -1680,9 +1677,6 @@ void frame_end_iconify_animation(ObFrame *self)
need to send the synthetic configurenotify, since apps may have
read the position when the client mapped, apparently. */
client_reconfigure(self->client, TRUE);
-
- /* the offscreen buffer is invalid when the window is resized */
- frame_get_offscreen_buffer(self);
}
/* we're not animating any more ! */
@@ -1747,34 +1741,3 @@ void frame_begin_iconify_animation(ObFrame *self, gboolean iconifying)
XMapWindow(ob_display, self->window);
}
}
-
-static void frame_get_offscreen_buffer(ObFrame *self)
-{
- frame_free_offscreen_buffer(self);
-
- if (self->visible || frame_iconify_animating(self)) {
- self->pixmap = composite_get_window_pixmap(self->client->window);
-
-#ifdef SHAPE
- /* shape the offscreen buffer to match the window */
- XShapeCombineShape(ob_display, self->pixmap, ShapeBounding,
- 0, 0, self->client->window,
- ShapeBounding, ShapeSet);
-#endif
-
- /*
- self->picture = composite_create_picture(self->window,
- wattrib.visual,
- &self->has_alpha);
- */
- }
-
-}
-
-static void frame_free_offscreen_buffer(ObFrame *self)
-{
- if (self->pixmap) {
- XFreePixmap(ob_display, self->pixmap);
- self->pixmap = None;
- }
-}
diff --git a/openbox/frame.h b/openbox/frame.h
index f7adbfd4..edf75b05 100644
--- a/openbox/frame.h
+++ b/openbox/frame.h
@@ -78,10 +78,6 @@ struct _ObFrame
Window window;
- Pixmap pixmap; /* Offscreen buffer of the frame window's contents
- when Composite is enabled */
- gboolean has_alpha;
-
Strut size;
Rect area;
gboolean visible;
@@ -209,6 +205,7 @@ void frame_free(ObFrame *self);
void frame_show(ObFrame *self);
void frame_hide(ObFrame *self);
void frame_adjust_theme(ObFrame *self);
+void frame_adjust_shape(ObFrame *self);
void frame_adjust_area(ObFrame *self, gboolean moved,
gboolean resized, gboolean fake);
void frame_adjust_client_area(ObFrame *self);
diff --git a/openbox/openbox.c b/openbox/openbox.c
index 250ca6d0..00fe6e6e 100644
--- a/openbox/openbox.c
+++ b/openbox/openbox.c
@@ -35,7 +35,6 @@
#include "focus_cycle_indicator.h"
#include "focus_cycle_popup.h"
#include "moveresize.h"
-#include "composite.h"
#include "frame.h"
#include "keyboard.h"
#include "mouse.h"
@@ -301,7 +300,6 @@ gint main(gint argc, gchar **argv)
window_startup(reconfigure);
sn_startup(reconfigure);
screen_startup(reconfigure);
- composite_startup(reconfigure);
grab_startup(reconfigure);
propwin_startup(reconfigure);
group_startup(reconfigure);
@@ -367,7 +365,6 @@ gint main(gint argc, gchar **argv)
group_shutdown(reconfigure);
propwin_shutdown(reconfigure);
grab_shutdown(reconfigure);
- composite_shutdown(reconfigure);
screen_shutdown(reconfigure);
focus_cycle_popup_shutdown(reconfigure);
focus_cycle_indicator_shutdown(reconfigure);
diff --git a/openbox/screen.c b/openbox/screen.c
index de3c9fb0..707d0b6b 100644
--- a/openbox/screen.c
+++ b/openbox/screen.c
@@ -27,7 +27,6 @@
#include "moveresize.h"
#include "config.h"
#include "screen.h"
-#include "composite.h"
#include "client.h"
#include "session.h"
#include "frame.h"
@@ -491,9 +490,6 @@ void screen_resize()
for (it = client_list; it; it = g_list_next(it))
client_move_onscreen(it->data, FALSE);
-
- /* this needs to be setup whenever the root window's size changes */
- composite_setup_root_window();
}
void screen_set_num_desktops(guint num)