awesome/objects/drawable.h
Uli Schlachter f957764e52 drawable/drawin: Pass both lua_State and stack index around
A stack index without the corresponding lua_State pointer is useless, because it
could reference another coroutine than the main thread and thus just assuming
globalconf.L is wrong. Fix this by also passing around the corresponding
lua_State pointer.

This improves the result for the following test:

  coroutine.resume(coroutine.create(function()
      drawin({}).visible = true
  end))

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-12-06 10:46:45 +01:00

55 lines
1.8 KiB
C

/*
* drawable.h - drawable functions header
*
* Copyright © 2007-2009 Julien Danjou <julien@danjou.info>
* Copyright © 2010-2012 Uli Schlachter <psychon@znc.in>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#ifndef AWESOME_OBJECTS_DRAWABLE_H
#define AWESOME_OBJECTS_DRAWABLE_H
#include "common/luaclass.h"
#include "draw.h"
typedef void drawable_refresh_callback(void *);
/** drawable type */
struct drawable_t
{
LUA_OBJECT_HEADER
/** The pixmap we are drawing to. */
xcb_pixmap_t pixmap;
/** Surface for drawing. */
cairo_surface_t *surface;
/** The geometry of the drawable (in root window coordinates). */
area_t geometry;
/** Surface contents are undefined if this is false. */
bool refreshed;
/** Callback for refreshing. */
drawable_refresh_callback *refresh_callback;
/** Data for refresh callback. */
void *refresh_data;
};
typedef struct drawable_t drawable_t;
drawable_t *drawable_allocator(lua_State *, drawable_refresh_callback *, void *);
void drawable_set_geometry(lua_State *, int, area_t);
void drawable_class_setup(lua_State *);
#endif
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80