1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 loco.c for the Openbox window manager
4 Copyright (c) 2008 Derek Foreman
5 Copyright (c) 2008 Dana Jansens
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 See the COPYING file for a copy of the GNU General Public License.
21 #include "obt/mainloop.h"
22 #include "obt/display.h"
23 #include "obt/mainloop.h"
27 #include <GL/glxext.h>
28 #include <GL/glxtokens.h>
30 <dana> you want CreateNotify, DestroyNotify, MapNotify, UnmapNotify, and
32 <dana> and then xdamage or whatever
36 void composite_setup_window(Window win)
38 XCompositeRedirectWindow(obt_display, win, CompositeRedirectAutomatic);
39 /*something useful = */XDamageCreate(obt_display, win, XDamageReportRawRectangles);
42 void COMPOSTER_RAWR(const XEvent *e, gpointer data)
45 if (e->type == CreateNotify) {
46 window = e->xmap.window;
47 printf("Do first time stuff\n");
48 composite_setup_window(window);
50 if (e->type == obt_display_extension_damage_basep + XDamageNotify) {
52 if (e->type == ConfigureNotify) {
53 printf("Window moved or something\n");
57 void loco_set_mainloop(gint ob_screen, ObtMainLoop *loop)
63 { GLX_DEPTH_SIZE, 1, GLX_DOUBLEBUFFER, GLX_RGBA, None };
65 vi = glXChooseVisual(obt_display, DefaultScreen(obt_display), config);
66 cont = glXCreateContext(obt_display, vi, NULL, GL_TRUE);
68 printf("context creation failed\n");
69 glXMakeCurrent(obt_display, RootWindow(obt_display, ob_screen), cont);
71 w = WidthOfScreen(ScreenOfDisplay(obt_display, ob_screen));
72 h = HeightOfScreen(ScreenOfDisplay(obt_display, ob_screen));
73 glViewport(0, 0, w, h);
74 glMatrixMode(GL_PROJECTION);
76 printf("Setting up an orthographic projection of %dx%d\n", w, h);
77 glOrtho(0, w, h, 0.0, -1.0, 100.0);
78 glMatrixMode(GL_MODELVIEW);
80 glClear(GL_COLOR_BUFFER_BIT);
81 glEnable(GL_TEXTURE_RECTANGLE_ARB);
82 glXSwapBuffers(obt_display, RootWindow(obt_display, ob_screen));
83 obt_main_loop_x_add(loop, COMPOSTER_RAWR, NULL, NULL);
86 void loco_shutdown(void)