summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorracarr <racarr>2007-01-28 15:45:53 +0000
committerracarr <racarr>2007-01-28 15:45:53 +0000
commit1cecc206698b69ff70241448c899d8db01ebd7fb (patch)
treeed0f14cbd5bf50940045ad436d704015a8d43c53
parentaec2bdfcab3d2b1f90a6e8a873a120836efa2988 (diff)
downloadberyl-desktop-manager-1cecc206698b69ff70241448c899d8db01ebd7fb.tar.gz
beryl-desktop-manager-1cecc206698b69ff70241448c899d8db01ebd7fb.tar.bz2
Move structs in to header file
-rw-r--r--src/bdm.c54
-rw-r--r--src/bdm.h49
2 files changed, 66 insertions, 37 deletions
diff --git a/src/bdm.c b/src/bdm.c
index 1b1b3f9..896f2e6 100644
--- a/src/bdm.c
+++ b/src/bdm.c
@@ -1,4 +1,5 @@
/*
+* Copyright: Robert Carr < racarr@beryl-project.org > GPLv2 and all that other stuff will add a real license in a bit
* Authors: Robert Carr <racarr@beryl-project.org>
* Guillaume Seguin <iXce>
*/
@@ -12,49 +13,14 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include "bdm.h"
#include <X11/Xlib.h>
#include <X11/Xatom.h>
-//quinn was here
-#define NEW(a,b) a * b ;\
- b = malloc(sizeof(a));\
- memset((b),0,sizeof(a));
-typedef enum
-{
- WALLPAPER_TYPE_PIXBUF,
- WALLPAPER_TYPE_COUNT
-} WallpaperType;
-
-typedef struct _PixbufWallpaper
-{
- GdkPixbuf * source;
- int width;
- int height;
-} PixbufWallpaper;
-
-typedef union _WallUnion
-{
- PixbufWallpaper pixbuf;
-} WallUnion;
-typedef struct _Wallpaper
-{
- WallpaperType type;
- WallUnion data;
-} Wallpaper;
-
-typedef struct _ScreenArea
-{
- int width;
- int height;
- Wallpaper * wallpaper;
- GtkWidget * window;
-} ScreenArea;
-
-GSList * Wallpapers=NULL;
static void render_pixbuf (cairo_t * cr, ScreenArea * area)
{
@@ -68,7 +34,7 @@ static void render_pixbuf (cairo_t * cr, ScreenArea * area)
cairo_fill(cr);
cairo_stroke(cr);
- cairo_paint(cr);
+ cairo_paint_with_alpha(cr,area->alpha);
cairo_restore(cr);
}
@@ -91,6 +57,18 @@ static void render (ScreenArea * area)
static gboolean on_alpha_window_expose(GtkWidget * widget, GdkEventExpose * expose, ScreenArea * area)
{
+ XEvent event;
+ Display *display = XOpenDisplay(getenv("DISPLAY"));
+ while (XPending(display))
+ {
+ XNextEvent(display,&event);
+ switch (event.type)
+ {
+ printf("Xevent");
+ case ButtonPress:
+ area->alpha -= .05f;
+ }
+ }
render(area);
}
@@ -224,6 +202,7 @@ int main(int argc, char * argv[])
GtkWidget * dwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
sa->window=dwindow;
sa->wallpaper=wp->data;
+ sa->alpha=1.0f;
wp=wp->next;
if (!wp) wp=Wallpapers;
gtk_window_set_default_size(GTK_WINDOW(dwindow),onex,oney);
@@ -236,6 +215,7 @@ int main(int argc, char * argv[])
gtk_widget_set_app_paintable(dwindow, TRUE);
gtk_window_set_keep_below(GTK_WINDOW(dwindow),TRUE);
g_signal_connect( G_OBJECT(dwindow),"expose-event",G_CALLBACK(on_alpha_window_expose),sa);
+
gtk_widget_show(dwindow);
on_alpha_window_expose(dwindow,0,sa);
}
diff --git a/src/bdm.h b/src/bdm.h
new file mode 100644
index 0000000..1c02a2e
--- /dev/null
+++ b/src/bdm.h
@@ -0,0 +1,49 @@
+#include <string.h>
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkprivate.h>
+#include <cairo/cairo.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+//quinn was here
+#define NEW(a,b) a * b ;\
+ b = malloc(sizeof(a));\
+ memset((b),0,sizeof(a));
+
+typedef enum
+{
+ WALLPAPER_TYPE_PIXBUF,
+ WALLPAPER_TYPE_COUNT
+} WallpaperType;
+
+typedef struct _PixbufWallpaper
+{
+ GdkPixbuf * source;
+ int width;
+ int height;
+} PixbufWallpaper;
+
+typedef union _WallUnion
+{
+ PixbufWallpaper pixbuf;
+} WallUnion;
+
+typedef struct _Wallpaper
+{
+ WallpaperType type;
+ WallUnion data;
+} Wallpaper;
+
+typedef struct _ScreenArea
+{
+ int width;
+ int height;
+ Wallpaper * wallpaper;
+ GtkWidget * window;
+ float alpha;
+} ScreenArea;
+
+GSList * Wallpapers=NULL; \ No newline at end of file