Menu *menu = NULL;
ObWindow *obwin = NULL;
+ /* expose events aren't related to any internal stuff */
+ if (e->type == Expose) {
+ if (ob_state != State_Exiting)
+ RrExpose(ob_render_inst, &e->xexpose);
+ return;
+ }
+
window = event_get_window(e);
if ((obwin = g_hash_table_lookup(window_map, &window))) {
switch (obwin->type) {
GHashTable *menu_hash = NULL;
-#define FRAME_EVENTMASK (ButtonPressMask |ButtonMotionMask | EnterWindowMask | \
- LeaveWindowMask)
-#define TITLE_EVENTMASK (ButtonPressMask | ButtonMotionMask)
+#define FRAME_EVENTMASK (ButtonPressMask |ButtonMotionMask | EnterWindowMask |\
+ LeaveWindowMask | ExposureMask)
+#define TITLE_EVENTMASK (ButtonPressMask | ButtonMotionMask | ExposureMask)
#define ENTRY_EVENTMASK (EnterWindowMask | LeaveWindowMask | \
- ButtonPressMask | ButtonReleaseMask)
+ ButtonPressMask | ButtonReleaseMask | ExposureMask)
void menu_control_show(Menu *self, int x, int y, Client *client);
{
XSetWindowAttributes attrib;
Popup *self;
+ struct RrColor pri, sec;
self = g_new(Popup, 1);
self->obwin.type = Window_Internal;
stacking_raise(INTERNAL_AS_WINDOW(self));
attrib.override_redirect = True;
+ attrib.event_mask = ExposureMask;
self->bg = XCreateWindow(ob_display, ob_root,
0, 0, 1, 1, 0, RrInstanceDepth(ob_render_inst),
InputOutput, RrInstanceVisual(ob_render_inst),
- CWOverrideRedirect, &attrib);
+ CWEventMask|CWOverrideRedirect, &attrib);
self->s_bg = RrSurfaceNew(ob_render_inst, RR_SURFACE_PLANAR, self->bg, 0);
self->s_text = RrSurfaceNewChild(RR_SURFACE_PLANAR, self->s_bg, 1);
self->text = RrSurfaceWindow(self->s_text);
self->icon = None;
}
+ RrColorSet(&pri, 1, 0, 0, 0);
+ RrColorSet(&pri, 0, 1, 0, 0);
+ RrPlanarSet(self->s_bg, RR_PLANAR_VERTICAL, &pri, &sec);
+ RrColorSet(&pri, 0, 0.5, 0, 1);
+ RrColorSet(&pri, 0.5, 0, 0.5, 1);
+ RrPlanarSet(self->s_text, RR_PLANAR_HORIZONTAL, &pri, &sec);
+ if (self->s_icon) {
+ RrColorSet(&pri, 0, 0, 1, 1);
+ RrColorSet(&pri, 0.5, 0.5, 0, 1);
+ RrPlanarSet(self->s_icon, RR_PLANAR_HORIZONTAL, &pri, &sec);
+ }
+
/* XXX COPY THE APPEARANCES FROM THE THEME...... LIKE THIS SORTA!
self->a_text = appearance_copy(theme_app_hilite_label);
*/
if (!RrSurfaceVisible(self->s_bg)) {
RrSurfaceShow(self->s_bg);
stacking_raise(INTERNAL_AS_WINDOW(self));
+ } else {
+ /* XXX only need to paint top level surface in the future */
+ RrPaint(self->s_bg);
+ RrPaint(self->s_text);
+ if (self->s_icon)
+ RrPaint(self->s_icon);
}
}
void popup_hide(Popup *self)
{
- if (RrSurfaceVisible(self->s_bg)) {
- RrSurfaceHide(self->s_bg);
- }
+ RrSurfaceHide(self->s_bg);
}
-DTHEMEDIR=\"$(themedir)\"
INCLUDES=-I..
-LIBS=$(GL_LIBS) @LIBS@
+LIBS=$(GL_LIBS) $(GLIB_LIBS) @LIBS@
noinst_PROGRAMS=rendertest
rendertest_LDFLAGS=-lobrender2 -L.
#include "instance.h"
+#include "surface.h"
#include "debug.h"
#include "glft/glft.h"
#include <stdlib.h>
RrVisual(inst), AllocNone);
inst->glx_context = glXCreateContext(display, &vilist[best],
NULL, True);
+ inst->surface_map = g_hash_table_new(g_int_hash, g_int_equal);
assert(inst->glx_context);
{
return inst->visinfo.visual;
}
+
+void RrInstaceAddSurface(struct RrSurface *sur)
+{
+ g_hash_table_replace(RrSurfaceInstance(sur)->surface_map, &sur->win, sur);
+}
+
+void RrInstaceRemoveSurface(struct RrSurface *sur)
+{
+ g_hash_table_remove(RrSurfaceInstance(sur)->surface_map, &sur->win);
+}
+
+struct RrSurface *RrInstaceLookupSurface(struct RrInstance *inst, Window win)
+{
+ return g_hash_table_lookup(inst->surface_map, &win);
+}
#include <X11/Xutil.h>
#include <GL/glx.h>
+#include <glib.h>
+
struct RrInstance {
Display *display;
int screen;
XVisualInfo visinfo;
Colormap cmap;
GLXContext glx_context;
+
+ GHashTable *surface_map;
};
#define RrDisplay(i) ((i)->display)
#define RrColormap(i) ((i)->cmap)
#define RrContext(i) ((i)->glx_context)
+struct RrSurface;
+
+void RrInstaceAddSurface(struct RrSurface *sur);
+void RrInstaceRemoveSurface(struct RrSurface *sur);
+struct RrSurface *RrInstaceLookupSurface(struct RrInstance *inst, Window win);
+
#endif
#include <assert.h>
#include <GL/glx.h>
+void RrExpose(struct RrInstance *inst, XExposeEvent *e)
+{
+ struct RrSurface *sur;
+
+ if ((sur = RrInstaceLookupSurface(inst, e->window))) {
+ RrPaintArea(sur, e->x, e->y, e->width, e->height);
+ } else {
+ RrDebug("Unable to find surface for window 0x%lx\n", e->window);
+ }
+}
+
/*! Paints the surface, and all its children */
void RrPaint(struct RrSurface *sur)
{
int y,
int w,
int h);
+void RrExpose(struct RrInstance *inst, XExposeEvent *e);
#endif
static Window create_window(struct RrInstance *inst, Window parent)
{
- Window win = XCreateWindow(RrDisplay(inst), parent, 0, 0, 1, 1, 0,
- RrDepth(inst), InputOutput, RrVisual(inst),
- 0, NULL);
+ XSetWindowAttributes attrib;
+ Window win;
+
+ attrib.event_mask = ExposureMask;
+ win = XCreateWindow(RrDisplay(inst), parent, 0, 0, 1, 1, 0,
+ RrDepth(inst), InputOutput, RrVisual(inst),
+ CWEventMask, &attrib);
return win;
}
sur->win = win;
sur->parent = NULL;
sur->visible = 0;
+
+ RrInstaceAddSurface(sur);
return sur;
}
sur->win = create_window(sur->inst, parent->win);
sur->parent = parent;
RrSurfaceShow(sur);
+
+ RrInstaceAddSurface(sur);
return sur;
}
sur->win = win;
sur->parent = NULL;
sur->visible = 0;
+
+ RrInstaceAddSurface(sur);
return sur;
}
sur->win = create_window(sur->inst, parent->win);
sur->parent = parent;
RrSurfaceShow(sur);
+
+ RrInstaceAddSurface(sur);
return sur;
}
{
int i;
if (sur) {
+ RrInstaceRemoveSurface(sur);
for (i = 0; i < sur->ntextures; ++i)
RrTextureFreeContents(&sur->texture[i]);
if (sur->ntextures)
break;
}
+ minw = minh = 0;
for (i = 0; i < sur->ntextures; ++i) {
switch (sur->texture[i].type) {
case RR_TEXTURE_NONE: