]> Eric's Git Repo - ericdock.git/commitdiff
Broke apart files, should actually compile now
authorEric Wertz <ericdwertz@gmail.com>
Mon, 5 Dec 2016 14:29:03 +0000 (09:29 -0500)
committerEric Wertz <ericdwertz@gmail.com>
Mon, 5 Dec 2016 14:29:03 +0000 (09:29 -0500)
15 files changed:
.main.c.swp [deleted file]
Makefile
clock.c
clock.h
dock_icon.c
dock_icon.h
drawing.c [new file with mode: 0644]
drawing.h
eric_window.h
ericdock.h
ericwindow-test
pager_item.c [new file with mode: 0644]
pager_item.h
tooltip_window.c
tooltip_window.h

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 049e73e05c3ac5d58a803fd40e14b541fb607cc8..409252808df51abde24a580244a3d419b95c81e9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,2 +1,11 @@
-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 $@ $^
diff --git a/clock.c b/clock.c
index 40a82565c6659a8d5d44b3c71219a5d8788c4e0b..33e61e98abbf3c76651fdab21337585cc69a63c9 100644 (file)
--- a/clock.c
+++ b/clock.c
@@ -9,7 +9,7 @@
 #include "clock.h"
 
 double clock_alpha = 0.75;
-double clock_height = 0.18;
+double clock_height = 18.0;
 
 int displaymode=0;
 
@@ -49,7 +49,9 @@ gboolean clock_refresh(gpointer data)
 
     timeinfo = localtime ( &rawtime );
     if( timeinfo->tm_sec != oldsec );
+    {
         gtk_widget_queue_draw( GTK_WIDGET( data ) );
+    }
 
     return TRUE;
 }
diff --git a/clock.h b/clock.h
index 3a2bd0d125ee61a98ac7e29d7dbe3243068291be..221c327afef0dcdbad9ba487c8df0d0ab1ac06da 100644 (file)
--- a/clock.h
+++ b/clock.h
@@ -6,12 +6,6 @@
 
 #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);
index c48f4d052f0db7ae8cc1e2eed774a946dd1d05e6..7099e8426ef3821c412b7ed9df8e276b54134a81 100644 (file)
@@ -4,12 +4,10 @@
  *
  * 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 ) );
index a97c4b4ccf8cec11c0efe7cec48dda5dfb10d776..d0a9fc913109bda6a952dfc17c0fc62004667d5b 100644 (file)
@@ -7,13 +7,11 @@
  */
 #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
new file mode 100644 (file)
index 0000000..beedc96
--- /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);
+}
+
index ced8af9929700a773c9f3e3f0370322050bb94cb..55dfffce729a8476134afe7ad36373499bc9b3d5 100644 (file)
--- a/drawing.h
+++ b/drawing.h
@@ -3,19 +3,5 @@
  * 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);
index 8cb667abab7b051d69b74e534f4f352a2d9ad443..47e9e645dc20cbab2bafc0881426034b90261f59 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 
-/*
- * TODO: add text color
- */
-
 typedef struct eric_window eric_window;
 struct eric_window
 {
index 0a7f87a609c28ebb71eb7633a928b54e025cf8de..08bf440a0f12861b14932597fac85a4e10d0c47c 100644 (file)
@@ -4,6 +4,7 @@
  */
 
 #include "eric_window.h" 
+#include "dock_icon.h"
 
 #define ERIC_DOCK_FONT "Source Sans Pro Regular" 
 #define ERIC_DOCK_TOOLTIP_SHADOW_RADIUS 16.0
@@ -20,3 +21,6 @@
 
 extern GList* dock_icons;
 extern eric_window* dock_window;
+extern eric_window* tooltip_window;
+extern dock_icon* tooltip_window_icon;
+
index 0d67b54b7ba0d541c1edb74c085ebba129f0638a..76efba7c21615d8277f874c7f577db7ab22e872f 100755 (executable)
Binary files a/ericwindow-test and b/ericwindow-test differ
diff --git a/pager_item.c b/pager_item.c
new file mode 100644 (file)
index 0000000..5cd5866
--- /dev/null
@@ -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 );
+
+}
index ebee6ade82173846bbbeb7e97a837837d883e572..dba3115f8f7d889e09588ff5113e123bc087f96e 100644 (file)
@@ -3,8 +3,6 @@
  * 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
@@ -25,81 +23,9 @@ typedef struct
     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 );
index 0fcad924de28a11a154b730f593e6ebd35801eb5..c89acd7ba2e141b36a7ed360113da82a5d9fb25d 100644 (file)
@@ -1,10 +1,9 @@
-#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;
index b4bd52fdb304d58ba4f68c4c2cf09bf66d87c5be..edf40cb204071c36124dfff30fc42dd068e13af1 100644 (file)
@@ -2,10 +2,6 @@
 
 #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 );