wmcliphist: Migrate to GTK3; remove bitmaps in favor of Cairo for mask.

This commit is contained in:
Doug Torrance 2014-11-22 20:48:46 -06:00 committed by Carlos R. Mafra
parent 7a271c57db
commit 49f749a29a
12 changed files with 12 additions and 123 deletions

View file

@ -3,7 +3,7 @@ INSTALL = install
PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
DATADIR = $(PREFIX)/share/wmcliphist
INCLUDES = `pkg-config --cflags gtk+-2.0 x11`
INCLUDES = `pkg-config --cflags gtk+-3.0 x11`
# for normal use
CFLAGS += -Wall -ansi -pedantic $(INCLUDES) -DDATADIR=\"$(DATADIR)\"
@ -15,7 +15,7 @@ DEBUG =
#CFLAGS += -Wall -g -ansi $(INCLUDES) -DFNCALL_DEBUG
#DEBUG = debug.o
LIBS = `pkg-config --libs gtk+-2.0 x11`
LIBS = `pkg-config --libs gtk+-3.0 x11`
OBJECTS = wmcliphist.o clipboard.o gui.o rcconfig.o history.o hotkeys.o utils.o $(DEBUG)
TARGET = wmcliphist
@ -34,9 +34,7 @@ lclint:
wmcliphist: $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@
wmcliphist.o: wmcliphist.c wmcliphist.h \
icon/ico_60x60_mask.xbm icon/ico_40x40_mask.xbm \
icon/ico_30x30_mask.xbm icon/ico_16x16_mask.xbm
wmcliphist.o: wmcliphist.c wmcliphist.h
clipboard.o: clipboard.c wmcliphist.h

View file

@ -34,10 +34,6 @@ GtkWidget *button;
/* pixmap */
GtkWidget *pixmap;
GdkPixmap *icon;
GdkBitmap *icon_mask;
GdkBitmap *mask;
/* ==========================================================================
* clipboard history menu

Binary file not shown.

View file

@ -1,7 +0,0 @@
/* Created with The GIMP */
#define ico_16x16_mask_width 16
#define ico_16x16_mask_height 16
static unsigned char ico_16x16_mask_bits[] = {
0xc0, 0x03, 0xf8, 0x1f, 0xfc, 0x3f, 0xfc, 0x7f, 0xfc, 0x7f, 0xfc, 0x7f,
0xfc, 0x7f, 0xfc, 0x7f, 0xfc, 0x7f, 0xfc, 0x7f, 0xfc, 0x7f, 0xfc, 0x7f,
0xfc, 0x7f, 0xfc, 0x7f, 0xf8, 0x7f, 0xf0, 0x3f };

Binary file not shown.

View file

@ -1,14 +0,0 @@
/* Created with The GIMP */
#define ico_30x30_mask_width 30
#define ico_30x30_mask_height 30
static unsigned char ico_30x30_mask_bits[] = {
0x00, 0xf8, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0xfc, 0x03, 0x00,
0xf8, 0xff, 0xff, 0x07, 0xf8, 0xff, 0xff, 0x07, 0xf8, 0xff, 0xff, 0x07,
0xf8, 0xff, 0xff, 0x07, 0xf8, 0xff, 0xff, 0x07, 0xf8, 0xff, 0xff, 0x07,
0xfc, 0xff, 0xff, 0x07, 0xfe, 0xff, 0xff, 0x07, 0xfe, 0xff, 0xff, 0x07,
0xfe, 0xff, 0xff, 0x07, 0xfe, 0xff, 0xff, 0x07, 0xfe, 0xff, 0xff, 0x07,
0xfc, 0xff, 0xff, 0x07, 0xfc, 0xff, 0xff, 0x07, 0xfc, 0xff, 0xff, 0x07,
0xf8, 0xff, 0xff, 0x07, 0xf8, 0xff, 0xff, 0x07, 0xf8, 0xff, 0xff, 0x07,
0xf8, 0xff, 0xff, 0x07, 0xf8, 0xff, 0xff, 0x07, 0xf8, 0xff, 0xff, 0x07,
0xf8, 0xff, 0xff, 0x07, 0xf8, 0xff, 0xff, 0x07, 0xf8, 0xff, 0xff, 0x07,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

Binary file not shown.

View file

@ -1,21 +0,0 @@
/* Created with The GIMP */
#define ico_40x40_mask_width 40
#define ico_40x40_mask_height 40
static unsigned char ico_40x40_mask_bits[] = {
0x00, 0x80, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0xe0,
0x7f, 0x00, 0x00, 0x00, 0xe0, 0xfb, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff,
0x0f, 0xf0, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0x0f, 0xf0,
0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff,
0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0x0f,
0xf0, 0xff, 0xff, 0xff, 0x0f, 0xfc, 0xff, 0xff, 0xff, 0x0f, 0xfe, 0xff,
0xff, 0xff, 0x0f, 0xfe, 0xff, 0xff, 0xff, 0x0f, 0xfe, 0xff, 0xff, 0xff,
0x0f, 0xfe, 0xff, 0xff, 0xff, 0x0f, 0xfe, 0xff, 0xff, 0xff, 0x0f, 0xfc,
0xff, 0xff, 0xff, 0x0f, 0xfc, 0xff, 0xff, 0xff, 0x0f, 0xfc, 0xff, 0xff,
0xff, 0x0f, 0xf8, 0xff, 0xff, 0xff, 0x0f, 0xf8, 0xff, 0xff, 0xff, 0x0f,
0xf8, 0xff, 0xff, 0xff, 0x0f, 0xf8, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff,
0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff,
0x0f, 0xf0, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0x0f, 0xf0,
0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff,
0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0x0f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

Binary file not shown.

View file

@ -1,44 +0,0 @@
#define ico_60x60_mask_width 60
#define ico_60x60_mask_height 60
static unsigned char ico_60x60_mask_bits[] = {
0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0xe0, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff,
0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xe7, 0x1f, 0x00, 0x00, 0x00,
0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0xff,
0xff, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00,
0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0xff,
0xff, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00,
0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0xff,
0xff, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00,
0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0xff,
0xff, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00,
0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, 0xff,
0xff, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00,
0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xfc, 0xff, 0xff, 0xff,
0xff, 0xff, 0x3f, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00,
0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xfc, 0xff, 0xff, 0xff,
0xff, 0xff, 0x3f, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00,
0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0xff, 0xff,
0xff, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00,
0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xf0, 0xff, 0xff, 0xff,
0xff, 0xff, 0x3f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00,
0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xf0, 0xff, 0xff, 0xff,
0xff, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00,
0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, 0xff,
0xff, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00,
0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0xff,
0xff, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00,
0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0xff,
0xff, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00,
0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0xff,
0xff, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00,
0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0xff,
0xff, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00,
0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0xff,
0xff, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};

View file

@ -4,11 +4,6 @@
#include "wmcliphist.h"
#include "icon/ico_60x60_mask.xbm"
#include "icon/ico_40x40_mask.xbm"
#include "icon/ico_30x30_mask.xbm"
#include "icon/ico_16x16_mask.xbm"
/*
* print some help
*/
@ -195,11 +190,6 @@ main(int argc, char **argv)
/* create icon_mask */
if (icon_size == 60) {
/* 60x60 icon */
icon_mask = gdk_bitmap_create_from_data(gtk_widget_get_window(main_window),
(gchar *) ico_60x60_mask_bits,
ico_60x60_mask_width,
ico_60x60_mask_height);
/* create icon */
if (icon_number == 0) {
icon_file = "ico_60x60_gray.png";
} else if (icon_number == 1) {
@ -209,10 +199,6 @@ main(int argc, char **argv)
}
} else if (icon_size == 40) {
/* 40x40 icon */
icon_mask = gdk_bitmap_create_from_data(gtk_widget_get_window(main_window),
(gchar *) ico_40x40_mask_bits,
ico_40x40_mask_width,
ico_40x40_mask_height);
/* create icon */
if (icon_number == 0) {
icon_file = "ico_40x40_gray.png";
@ -223,10 +209,6 @@ main(int argc, char **argv)
}
} else if (icon_size == 30) {
/* 30x30 icon */
icon_mask = gdk_bitmap_create_from_data(gtk_widget_get_window(main_window),
(gchar *) ico_30x30_mask_bits,
ico_30x30_mask_width,
ico_30x30_mask_height);
/* create icon */
if (icon_number == 0) {
icon_file = "ico_30x30_gray.png";
@ -237,10 +219,6 @@ main(int argc, char **argv)
}
} else {
/* 16x16 icon */
icon_mask = gdk_bitmap_create_from_data(gtk_widget_get_window(main_window),
(gchar *) ico_16x16_mask_bits,
ico_16x16_mask_width,
ico_16x16_mask_height);
/* create icon */
icon_file = "ico_16x16.png";
}
@ -365,6 +343,9 @@ main(int argc, char **argv)
if (icon_size) {
cairo_region_t *region;
cairo_surface_t *surface;
/* connect signal for menu popup */
gtk_widget_add_events(dock_app, GDK_BUTTON_PRESS_MASK);
g_signal_connect(G_OBJECT(dock_app),
@ -372,8 +353,12 @@ main(int argc, char **argv)
G_CALLBACK(button_press),
G_OBJECT(menu_hist));
gdk_window_shape_combine_mask(gtk_widget_get_window(main_window), icon_mask, 0, 0);
gdk_window_shape_combine_mask(gtk_widget_get_window(dock_app), icon_mask, 0, 0);
surface = cairo_image_surface_create_from_png(icon_file);
region = gdk_cairo_region_create_from_surface(surface);
gdk_window_shape_combine_region(gtk_widget_get_window(dock_app),
region, 0, 0);
}

View file

@ -280,10 +280,6 @@ extern GtkWidget *button;
/* pixmap */
extern GtkWidget *pixmap;
extern GdkPixmap *icon;
extern GdkBitmap *icon_mask;
extern GdkBitmap *mask;
/*
* dock button click response