support for the shape extension works!
This commit is contained in:
parent
209b7f212d
commit
9d5865a160
9 changed files with 92 additions and 13 deletions
|
@ -105,7 +105,7 @@ AC_CHECK_LIB([Xext], [XShapeCombineShape],
|
||||||
[
|
[
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
SHAPE="yes"
|
SHAPE="yes"
|
||||||
AC_DEFINE([HAVE_SHAPE], [1], [Found the XShape extension])
|
AC_DEFINE([SHAPE], [1], [Found the XShape extension])
|
||||||
LIBS="$LIBS -lXext"
|
LIBS="$LIBS -lXext"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
|
@ -11,6 +11,10 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
|
|
||||||
|
#ifdef SHAPE
|
||||||
|
#include <X11/extensions/shape.h>
|
||||||
|
#endif // SHAPE
|
||||||
|
|
||||||
#ifdef HAVE_STDIO_H
|
#ifdef HAVE_STDIO_H
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
#endif // HAVE_STDIO_H
|
#endif // HAVE_STDIO_H
|
||||||
|
|
|
@ -264,7 +264,7 @@ BlackboxWindow::BlackboxWindow(Blackbox *b, Window w, BScreen *s) {
|
||||||
XUngrabServer(otk::OBDisplay::display);
|
XUngrabServer(otk::OBDisplay::display);
|
||||||
|
|
||||||
#ifdef SHAPE
|
#ifdef SHAPE
|
||||||
if (blackbox->hasShapeExtensions() && flags.shaped)
|
if (otk::OBDisplay::shape() && flags.shaped)
|
||||||
configureShape();
|
configureShape();
|
||||||
#endif // SHAPE
|
#endif // SHAPE
|
||||||
|
|
||||||
|
@ -511,7 +511,7 @@ void BlackboxWindow::associateClientWindow(void) {
|
||||||
XMapSubwindows(otk::OBDisplay::display, frame.plate);
|
XMapSubwindows(otk::OBDisplay::display, frame.plate);
|
||||||
|
|
||||||
#ifdef SHAPE
|
#ifdef SHAPE
|
||||||
if (blackbox->hasShapeExtensions()) {
|
if (otk::OBDisplay::shape()) {
|
||||||
XShapeSelectInput(otk::OBDisplay::display, client.window,
|
XShapeSelectInput(otk::OBDisplay::display, client.window,
|
||||||
ShapeNotifyMask);
|
ShapeNotifyMask);
|
||||||
|
|
||||||
|
@ -1601,7 +1601,7 @@ void BlackboxWindow::configure(int dx, int dy,
|
||||||
frame.rect.bottom() - frame.margin.bottom);
|
frame.rect.bottom() - frame.margin.bottom);
|
||||||
|
|
||||||
#ifdef SHAPE
|
#ifdef SHAPE
|
||||||
if (blackbox->hasShapeExtensions() && flags.shaped) {
|
if (otk::OBDisplay::shape() && flags.shaped) {
|
||||||
configureShape();
|
configureShape();
|
||||||
}
|
}
|
||||||
#endif // SHAPE
|
#endif // SHAPE
|
||||||
|
@ -3848,7 +3848,7 @@ void BlackboxWindow::leaveNotifyEvent(const XCrossingEvent*) {
|
||||||
|
|
||||||
#ifdef SHAPE
|
#ifdef SHAPE
|
||||||
void BlackboxWindow::shapeEvent(XShapeEvent *e) {
|
void BlackboxWindow::shapeEvent(XShapeEvent *e) {
|
||||||
if (blackbox->hasShapeExtensions()) {
|
if (otk::OBDisplay::shape()) {
|
||||||
if (! e->shaped && flags.shaped) {
|
if (! e->shaped && flags.shaped) {
|
||||||
clearShape();
|
clearShape();
|
||||||
flags.shaped = False;
|
flags.shaped = False;
|
||||||
|
|
|
@ -831,7 +831,7 @@ void Blackbox::process_event(XEvent *e) {
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
#ifdef SHAPE
|
#ifdef SHAPE
|
||||||
if (e->type == getShapeEventBase()) {
|
if (e->type == otk::OBDisplay::shapeEventBase()) {
|
||||||
XShapeEvent *shape_event = (XShapeEvent *) e;
|
XShapeEvent *shape_event = (XShapeEvent *) e;
|
||||||
BlackboxWindow *win = searchWindow(e->xany.window);
|
BlackboxWindow *win = searchWindow(e->xany.window);
|
||||||
|
|
||||||
|
|
|
@ -319,9 +319,13 @@ void OBClient::getShaped()
|
||||||
if (otk::OBDisplay::shape()) {
|
if (otk::OBDisplay::shape()) {
|
||||||
int foo;
|
int foo;
|
||||||
unsigned int ufoo;
|
unsigned int ufoo;
|
||||||
|
int s;
|
||||||
|
|
||||||
XShapeQueryExtents(otk::OBDisplay::display, client.window, &_shaped, &foo,
|
XShapeSelectInput(otk::OBDisplay::display, _window, ShapeNotifyMask);
|
||||||
|
|
||||||
|
XShapeQueryExtents(otk::OBDisplay::display, _window, &s, &foo,
|
||||||
&foo, &ufoo, &ufoo, &foo, &foo, &foo, &ufoo, &ufoo);
|
&foo, &ufoo, &ufoo, &foo, &foo, &foo, &ufoo, &ufoo);
|
||||||
|
_shaped = (s != 0);
|
||||||
}
|
}
|
||||||
#endif // SHAPE
|
#endif // SHAPE
|
||||||
}
|
}
|
||||||
|
@ -649,6 +653,14 @@ void OBClient::update(const XClientMessageEvent &e)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(SHAPE) || defined(DOXYGEN_IGNORE)
|
||||||
|
void OBClient::update(const XShapeEvent &e)
|
||||||
|
{
|
||||||
|
_shaped = e.shaped;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void OBClient::setArea(const otk::Rect &area)
|
void OBClient::setArea(const otk::Rect &area)
|
||||||
{
|
{
|
||||||
_area = area;
|
_area = area;
|
||||||
|
|
|
@ -9,6 +9,10 @@
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
|
#ifdef SHAPE
|
||||||
|
#include <X11/extensions/shape.h>
|
||||||
|
#endif // SHAPE
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -431,6 +435,10 @@ public:
|
||||||
//! Processes a client message XEvent for the window and causes an action
|
//! Processes a client message XEvent for the window and causes an action
|
||||||
//! or whatever was specified to occur
|
//! or whatever was specified to occur
|
||||||
void update(const XClientMessageEvent &e);
|
void update(const XClientMessageEvent &e);
|
||||||
|
#if defined(SHAPE) || defined(DOXYGEN_IGNORE)
|
||||||
|
//! Updates the client's shape status
|
||||||
|
void update(const XShapeEvent &e);
|
||||||
|
#endif
|
||||||
|
|
||||||
//! Changes the stored positions and size of the OBClient window
|
//! Changes the stored positions and size of the OBClient window
|
||||||
/*!
|
/*!
|
||||||
|
|
46
src/frame.cc
46
src/frame.cc
|
@ -4,6 +4,12 @@
|
||||||
# include "../config.h"
|
# include "../config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#ifdef SHAPE
|
||||||
|
#include <X11/extensions/shape.h>
|
||||||
|
#endif // SHAPE
|
||||||
|
}
|
||||||
|
|
||||||
#include "frame.hh"
|
#include "frame.hh"
|
||||||
#include "client.hh"
|
#include "client.hh"
|
||||||
#include "otk/display.hh"
|
#include "otk/display.hh"
|
||||||
|
@ -76,7 +82,45 @@ void OBFrame::resize()
|
||||||
|
|
||||||
void OBFrame::shape()
|
void OBFrame::shape()
|
||||||
{
|
{
|
||||||
// XXX: if shaped, shape the frame to the client..
|
#ifdef SHAPE
|
||||||
|
if (!_client->shaped()) {
|
||||||
|
// clear the shape on the frame window
|
||||||
|
XShapeCombineMask(otk::OBDisplay::display, _window, ShapeBounding,
|
||||||
|
_size.left - 2,//frame.margin.left - frame.border_w,
|
||||||
|
_size.top - 2,//frame.margin.top - frame.border_w,
|
||||||
|
None, ShapeSet);
|
||||||
|
} else {
|
||||||
|
// make the frame's shape match the clients
|
||||||
|
XShapeCombineShape(otk::OBDisplay::display, _window, ShapeBounding,
|
||||||
|
_size.left - 2,
|
||||||
|
_size.top - 2,
|
||||||
|
_client->window(), ShapeBounding, ShapeSet);
|
||||||
|
|
||||||
|
int num = 0;
|
||||||
|
XRectangle xrect[2];
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (decorations & Decor_Titlebar) {
|
||||||
|
xrect[0].x = xrect[0].y = -frame.border_w;
|
||||||
|
xrect[0].width = frame.rect.width();
|
||||||
|
xrect[0].height = frame.title_h + (frame.border_w * 2);
|
||||||
|
++num;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (decorations & Decor_Handle) {
|
||||||
|
xrect[1].x = -frame.border_w;
|
||||||
|
xrect[1].y = frame.rect.height() - frame.margin.bottom +
|
||||||
|
frame.mwm_border_w - frame.border_w;
|
||||||
|
xrect[1].width = frame.rect.width();
|
||||||
|
xrect[1].height = frame.handle_h + (frame.border_w * 2);
|
||||||
|
++num;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
XShapeCombineRectangles(otk::OBDisplay::display, _window,
|
||||||
|
ShapeBounding, 0, 0, xrect, num,
|
||||||
|
ShapeUnion, Unsorted);
|
||||||
|
}
|
||||||
|
#endif // SHAPE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
// -*- mode: C++; indent-tabs-mode: nil; -*-
|
// -*- mode: C++; indent-tabs-mode: nil; -*-
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "xeventhandler.hh"
|
#include "xeventhandler.hh"
|
||||||
#include "client.hh"
|
#include "client.hh"
|
||||||
#include "frame.hh"
|
#include "frame.hh"
|
||||||
|
@ -506,11 +510,14 @@ void OBXEventHandler::focusOut(const XFocusChangeEvent &e)
|
||||||
#ifdef SHAPE
|
#ifdef SHAPE
|
||||||
void OBXEventHandler::shapeEvent(const XShapeEvent &e)
|
void OBXEventHandler::shapeEvent(const XShapeEvent &e)
|
||||||
{
|
{
|
||||||
XShapeEvent *shape_event = (XShapeEvent *) e;
|
printf("ShapeEvent\n");
|
||||||
BlackboxWindow *win = searchWindow(e->xany.window);
|
if (e.kind != ShapeBounding) return;
|
||||||
|
|
||||||
if (win && shape_event->kind == ShapeBounding)
|
OBClient *client = Openbox::instance->findClient(e.window);
|
||||||
win->shapeEvent(shape_event);
|
if (!client) return;
|
||||||
|
|
||||||
|
client->update(e);
|
||||||
|
client->frame->shape();
|
||||||
}
|
}
|
||||||
#endif // SHAPE
|
#endif // SHAPE
|
||||||
|
|
||||||
|
@ -679,7 +686,7 @@ void OBXEventHandler::handle(const XEvent &e)
|
||||||
default:
|
default:
|
||||||
#ifdef SHAPE
|
#ifdef SHAPE
|
||||||
if (e.type == otk::OBDisplay::shapeEventBase())
|
if (e.type == otk::OBDisplay::shapeEventBase())
|
||||||
shapeEvent(e);
|
shapeEvent((*(XShapeEvent*)&e));
|
||||||
#endif // SHAPE
|
#endif // SHAPE
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,10 @@
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
|
#ifdef SHAPE
|
||||||
|
#include <X11/extensions/shape.h>
|
||||||
|
#endif // SHAPE
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ob {
|
namespace ob {
|
||||||
|
|
Loading…
Reference in a new issue