summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 31b6d08)
raw | patch | inline | side by side (parent: 31b6d08)
author | Eric Wertz <ericdwertz@gmail.com> | |
Mon, 5 Dec 2016 14:29:03 +0000 (09:29 -0500) | ||
committer | Eric Wertz <ericdwertz@gmail.com> | |
Mon, 5 Dec 2016 14:29:03 +0000 (09:29 -0500) |
15 files changed:
.main.c.swp | [deleted file] | patch | blob | history |
Makefile | patch | blob | history | |
clock.c | patch | blob | history | |
clock.h | patch | blob | history | |
dock_icon.c | patch | blob | history | |
dock_icon.h | patch | blob | history | |
drawing.c | [new file with mode: 0644] | patch | blob |
drawing.h | patch | blob | history | |
eric_window.h | patch | blob | history | |
ericdock.h | patch | blob | history | |
ericwindow-test | patch | blob | history | |
pager_item.c | [new file with mode: 0644] | patch | blob |
pager_item.h | patch | blob | history | |
tooltip_window.c | patch | blob | history | |
tooltip_window.h | patch | blob | history |
diff --git a/.main.c.swp b/.main.c.swp
deleted file mode 100644 (file)
index a4c15ba..0000000
Binary files a/.main.c.swp and /dev/null differ
index a4c15ba..0000000
Binary files a/.main.c.swp and /dev/null differ
diff --git a/Makefile b/Makefile
index 049e73e05c3ac5d58a803fd40e14b541fb607cc8..409252808df51abde24a580244a3d419b95c81e9 100644 (file)
--- a/Makefile
+++ b/Makefile
-ericdock: main.c
- gcc -o ericdock -lm -lX11 `pkg-config --cflags --libs gtk+-3.0 libwnck-3.0` main.c
+CC = gcc
+CFLAGS = -std=gnu++98 -Wall -lm -lX11 `pkg-config --cflags gtk+-3.0 libwnck-3.0`
+LDFLAGS = `pkg-config --libs gtk+-3.0 libwnck-3.0`
+DEPS = dock_icon.h ericdock.h clock.h drawing.h eric_window.h pager_item.h tooltip_window.h
+OBJ = dock_icon.o tooltip_window.o eric_window.o clock.o main.o pager_item.o drawing.o
+
+%.o: %.c $(DEPS)
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+ericdock: $(OBJ)
+ gcc $(LDFLAGS) $(CFLAGS) -o $@ $^
index 40a82565c6659a8d5d44b3c71219a5d8788c4e0b..33e61e98abbf3c76651fdab21337585cc69a63c9 100644 (file)
--- a/clock.c
+++ b/clock.c
#include "clock.h"
double clock_alpha = 0.75;
-double clock_height = 0.18;
+double clock_height = 18.0;
int displaymode=0;
timeinfo = localtime ( &rawtime );
if( timeinfo->tm_sec != oldsec );
+ {
gtk_widget_queue_draw( GTK_WIDGET( data ) );
+ }
return TRUE;
}
index 3a2bd0d125ee61a98ac7e29d7dbe3243068291be..221c327afef0dcdbad9ba487c8df0d0ab1ac06da 100644 (file)
--- a/clock.h
+++ b/clock.h
#include "eric_window.h"
-extern double clock_alpha;
-extern double clock_height;
-extern int displaymode;
-extern char* weekday_names[7];
-extern char* month_names[12];
-
gboolean clock_refresh(gpointer data);
void clock_init( gpointer window );
void clock_draw_timestring(cairo_t* cr, double x, double y, int blurpass);
diff --git a/dock_icon.c b/dock_icon.c
index c48f4d052f0db7ae8cc1e2eed774a946dd1d05e6..7099e8426ef3821c412b7ed9df8e276b54134a81 100644 (file)
--- a/dock_icon.c
+++ b/dock_icon.c
*
* renders/handles events based on how many pager_items it contains
*/
+#include "ericdock.h"
#include "dock_icon.h"
#include "tooltip_window.h"
-eric_window* tooltip_window = NULL;
-dock_icon* tooltip_window_icon = NULL;
-
dock_icon* dock_icon_create( WnckClassGroup* class_group )
{
dock_icon* icon = malloc( sizeof( dock_icon ) );
diff --git a/dock_icon.h b/dock_icon.h
index a97c4b4ccf8cec11c0efe7cec48dda5dfb10d776..d0a9fc913109bda6a952dfc17c0fc62004667d5b 100644 (file)
--- a/dock_icon.h
+++ b/dock_icon.h
*/
#include <gtk/gtk.h>
#include <X11/Xlib.h>
+#include <time.h>
#define WNCK_I_KNOW_THIS_IS_UNSTABLE
#include <libwnck/libwnck.h>
-#include <time.h>
-
-#include "ericdock.h"
#include "pager_item.h"
typedef struct
diff --git a/drawing.c b/drawing.c
--- /dev/null
+++ b/drawing.c
@@ -0,0 +1,17 @@
+#include "drawing.h"
+#include <math.h>
+
+void draw_rounded_rect(cairo_t* cr,double x,double y,double w,double h,double r)
+{
+ cairo_move_to(cr,x+r,y);
+ cairo_line_to(cr,x+w-r*2,y);
+ cairo_arc(cr,x+w-r,y+r,r,-M_PI/2.0,0);
+ cairo_line_to(cr,x+w,y+h-r*2);
+ cairo_arc(cr,x+w-r,y+h-r,r,0,M_PI/2.0);
+ cairo_line_to(cr, x+r,y+h);
+ cairo_arc(cr,x+r,y+h-r,r,M_PI/2.0,M_PI);
+ cairo_line_to(cr, x, y+r);
+ cairo_arc(cr,x+r,y+r,r,M_PI,-M_PI/2.0);
+ cairo_close_path(cr);
+}
+
diff --git a/drawing.h b/drawing.h
index ced8af9929700a773c9f3e3f0370322050bb94cb..55dfffce729a8476134afe7ad36373499bc9b3d5 100644 (file)
--- a/drawing.h
+++ b/drawing.h
* Drawing functions!
*/
#include <gtk/gtk.h>
-#include <math.h>
-
-void draw_rounded_rect(cairo_t* cr,double x,double y,double w,double h,double r)
-{
- cairo_move_to(cr,x+r,y);
- cairo_line_to(cr,x+w-r*2,y);
- cairo_arc(cr,x+w-r,y+r,r,-M_PI/2.0,0);
- cairo_line_to(cr,x+w,y+h-r*2);
- cairo_arc(cr,x+w-r,y+h-r,r,0,M_PI/2.0);
- cairo_line_to(cr, x+r,y+h);
- cairo_arc(cr,x+r,y+h-r,r,M_PI/2.0,M_PI);
- cairo_line_to(cr, x, y+r);
- cairo_arc(cr,x+r,y+r,r,M_PI,-M_PI/2.0);
- cairo_close_path(cr);
-}
+void draw_rounded_rect(cairo_t* cr,double x,double y,double w,double h,double r);
diff --git a/eric_window.h b/eric_window.h
index 8cb667abab7b051d69b74e534f4f352a2d9ad443..47e9e645dc20cbab2bafc0881426034b90261f59 100644 (file)
--- a/eric_window.h
+++ b/eric_window.h
#include <stdlib.h>
#include <string.h>
-/*
- * TODO: add text color
- */
-
typedef struct eric_window eric_window;
struct eric_window
{
diff --git a/ericdock.h b/ericdock.h
index 0a7f87a609c28ebb71eb7633a928b54e025cf8de..08bf440a0f12861b14932597fac85a4e10d0c47c 100644 (file)
--- a/ericdock.h
+++ b/ericdock.h
*/
#include "eric_window.h"
+#include "dock_icon.h"
#define ERIC_DOCK_FONT "Source Sans Pro Regular"
#define ERIC_DOCK_TOOLTIP_SHADOW_RADIUS 16.0
extern GList* dock_icons;
extern eric_window* dock_window;
+extern eric_window* tooltip_window;
+extern dock_icon* tooltip_window_icon;
+
diff --git a/ericwindow-test b/ericwindow-test
index 0d67b54b7ba0d541c1edb74c085ebba129f0638a..76efba7c21615d8277f874c7f577db7ab22e872f 100755 (executable)
Binary files a/ericwindow-test and b/ericwindow-test differ
Binary files a/ericwindow-test and b/ericwindow-test differ
diff --git a/pager_item.c b/pager_item.c
--- /dev/null
+++ b/pager_item.c
@@ -0,0 +1,91 @@
+/*
+ * pager_item - held by the dock_icon object
+ */
+
+#include "pager_item.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <gtk/gtk.h>
+
+#include "ericdock.h"
+#include "drawing.h"
+
+void pager_item_name_changed( WnckWindow* window, pager_item* item )
+{
+ strcpy( item->name, wnck_window_get_name( window ) );
+}
+
+void pager_item_icon_changed( WnckWindow* window, pager_item* item )
+{
+ item->icon_pixbuf = wnck_window_get_mini_icon( window );
+}
+
+void pager_item_state_changed( WnckWindow* window, WnckWindowState changed_mask, WnckWindowState new_state, pager_item* item )
+{
+ //item->icon_pixbuf = wnck_window_get_mini_icon( window );
+}
+
+pager_item* pager_item_create( WnckWindow* window )
+{
+ pager_item* item = malloc( sizeof( pager_item ) );
+ item->window = window;
+ strcpy( item->name, wnck_window_get_name( item->window ) );
+ item->icon_pixbuf = wnck_window_get_mini_icon( item->window );
+ item->icon_state = ICON_STATE_NORMAL;
+
+ g_signal_connect( G_OBJECT( window ), "name-changed", G_CALLBACK( pager_item_name_changed ), (gpointer)item );
+ g_signal_connect( G_OBJECT( window ), "icon-changed", G_CALLBACK( pager_item_icon_changed ), (gpointer)item );
+ g_signal_connect( G_OBJECT( window ), "state-changed", G_CALLBACK( pager_item_state_changed ), (gpointer)item );
+
+ item->width = SCALE_VALUE( 320 );
+ item->height = SCALE_VALUE( 24.0 );
+ item->text_height = SCALE_VALUE( 16.0 );
+
+ return item;
+}
+
+/* Returns bool if state has changed */
+int pager_item_mouse_move( pager_item* item, double mx, double my )
+{
+ double it, ib, il, ir;
+ int old_state;
+
+ old_state = item->icon_state;
+
+ il = item->x; ir = item->x + item->width;
+ it = item->y; ib = item->y + item->height;
+
+ if( il < mx && mx < ir && it < my && my < ib )
+ {
+ item->icon_state = ICON_STATE_HOVER;
+ }
+ else
+ {
+ item->icon_state = ICON_STATE_NORMAL;
+ }
+
+ return old_state != item->icon_state;
+}
+
+void pager_item_draw( pager_item* item, cairo_t* cr, eric_window* w, cairo_pattern_t* pattern )
+{
+ if( item->icon_state == ICON_STATE_HOVER )
+ {
+ w->text_color.alpha = 0.25;
+ gdk_cairo_set_source_rgba( cr, &w->text_color );
+ draw_rounded_rect( cr, item->x, item->y,
+ item->width, item->height, SCALE_VALUE( 2.0 ) );
+ cairo_fill( cr );
+ }
+
+ gdk_cairo_set_source_pixbuf( cr, item->icon_pixbuf, item->x, item->y + SCALE_VALUE( 6.0 ) );
+ cairo_paint( cr );
+
+ cairo_set_source( cr, pattern );
+ cairo_move_to( cr, item->x + SCALE_VALUE( 20.0 ), item->y + item->text_height );
+ cairo_text_path( cr, item->name );
+
+ cairo_fill( cr );
+
+}
diff --git a/pager_item.h b/pager_item.h
index ebee6ade82173846bbbeb7e97a837837d883e572..dba3115f8f7d889e09588ff5113e123bc087f96e 100644 (file)
--- a/pager_item.h
+++ b/pager_item.h
* pager_item - held by the dock_icon object
*/
-#include <string.h>
-#include <stdlib.h>
#include <gtk/gtk.h>
#define WNCK_I_KNOW_THIS_IS_UNSTABLE
int icon_state;
} pager_item;
-void pager_item_name_changed( WnckWindow* window, pager_item* item )
-{
- strcpy( item->name, wnck_window_get_name( window ) );
-}
-
-void pager_item_icon_changed( WnckWindow* window, pager_item* item )
-{
- item->icon_pixbuf = wnck_window_get_mini_icon( window );
-}
-
-void pager_item_state_changed( WnckWindow* window, WnckWindowState changed_mask, WnckWindowState new_state, pager_item* item )
-{
- //item->icon_pixbuf = wnck_window_get_mini_icon( window );
-}
-
-pager_item* pager_item_create( WnckWindow* window )
-{
- pager_item* item = malloc( sizeof( pager_item ) );
- item->window = window;
- strcpy( item->name, wnck_window_get_name( item->window ) );
- item->icon_pixbuf = wnck_window_get_mini_icon( item->window );
- item->icon_state = ICON_STATE_NORMAL;
-
- g_signal_connect( G_OBJECT( window ), "name-changed", G_CALLBACK( pager_item_name_changed ), (gpointer)item );
- g_signal_connect( G_OBJECT( window ), "icon-changed", G_CALLBACK( pager_item_icon_changed ), (gpointer)item );
- g_signal_connect( G_OBJECT( window ), "state-changed", G_CALLBACK( pager_item_state_changed ), (gpointer)item );
-
- item->width = SCALE_VALUE( 320 );
- item->height = SCALE_VALUE( 24.0 );
- item->text_height = SCALE_VALUE( 16.0 );
-
- return item;
-}
-
-/* Returns bool if state has changed */
-int pager_item_mouse_move( pager_item* item, double mx, double my )
-{
- double it, ib, il, ir;
- int old_state;
-
- old_state = item->icon_state;
-
- il = item->x; ir = item->x + item->width;
- it = item->y; ib = item->y + item->height;
-
- if( il < mx && mx < ir && it < my && my < ib )
- {
- item->icon_state = ICON_STATE_HOVER;
- }
- else
- {
- item->icon_state = ICON_STATE_NORMAL;
- }
-
- return old_state != item->icon_state;
-}
-
-void pager_item_draw( pager_item* item, cairo_t* cr, eric_window* w, cairo_pattern_t* pattern )
-{
- if( item->icon_state == ICON_STATE_HOVER )
- {
- w->text_color.alpha = 0.25;
- gdk_cairo_set_source_rgba( cr, &w->text_color );
- draw_rounded_rect( cr, item->x, item->y,
- item->width, item->height, SCALE_VALUE( 2.0 ) );
- cairo_fill( cr );
- }
-
- gdk_cairo_set_source_pixbuf( cr, item->icon_pixbuf, item->x, item->y + SCALE_VALUE( 6.0 ) );
- cairo_paint( cr );
-
- cairo_set_source( cr, pattern );
- cairo_move_to( cr, item->x + SCALE_VALUE( 20.0 ), item->y + item->text_height );
- cairo_text_path( cr, item->name );
-
- cairo_fill( cr );
-
-}
+void pager_item_name_changed( WnckWindow* window, pager_item* item );
+void pager_item_icon_changed( WnckWindow* window, pager_item* item );
+void pager_item_state_changed( WnckWindow* window, WnckWindowState changed_mask, WnckWindowState new_state, pager_item* item );
+pager_item* pager_item_create( WnckWindow* window );
+int pager_item_mouse_move( pager_item* item, double mx, double my );
+void pager_item_draw( pager_item* item, cairo_t* cr, eric_window* w, cairo_pattern_t* pattern );
diff --git a/tooltip_window.c b/tooltip_window.c
index 0fcad924de28a11a154b730f593e6ebd35801eb5..c89acd7ba2e141b36a7ed360113da82a5d9fb25d 100644 (file)
--- a/tooltip_window.c
+++ b/tooltip_window.c
-#include "tooltip_window.h"
#include "ericdock.h"
#define WNCK_I_KNOW_THIS_IS_UNSTABLE
#include <libwnck/libwnck.h>
-#include "dock_icon.h"
+#include "tooltip_window.h"
#include "drawing.h"
eric_window* tooltip_window = NULL;
diff --git a/tooltip_window.h b/tooltip_window.h
index b4bd52fdb304d58ba4f68c4c2cf09bf66d87c5be..edf40cb204071c36124dfff30fc42dd068e13af1 100644 (file)
--- a/tooltip_window.h
+++ b/tooltip_window.h
#include <gtk/gtk.h>
#include "eric_window.h"
-#include "dock_icon.h"
-
-extern eric_window* tooltip_window;
-extern dock_icon* tooltip_window_icon;
void tooltip_window_hide();
gboolean tooltip_window_lose_focus( GtkWidget* widget, GdkEvent* event, gpointer user );