Created
July 21, 2017 09:32
-
-
Save ZoomTen/e0b3843a24f2649f0f9397fbf1d83d16 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Personal patch for xfce4-session Simple engine. | |
# Crap, but it'll do | |
# * Moves the info text INSIDE the image. | |
# * Adds a "text border" option - defines the padding between | |
# the canvas and the text. | |
# * Adds a "BorderThickness" entry in Xfconf | |
# * Disables shadow effect | |
--- simple2.c 2017-07-21 16:15:37.468585431 +0700 | |
+++ simple.c 2017-07-21 16:09:13.090351000 +0700 | |
@@ -39,9 +39,7 @@ | |
#include <engines/simple/fallback.h> | |
#include <engines/simple/preview.h> | |
- | |
-#define BORDER 2 | |
- | |
+#define DEFAULT_BORDER 2 | |
#define DEFAULT_FONT "Sans Bold 10" | |
#define DEFAULT_BGCOLOR "Black" | |
#define DEFAULT_FGCOLOR "White" | |
@@ -105,7 +103,8 @@ | |
gint logo_height; | |
gint text_height; | |
cairo_t *cr; | |
- | |
+ gint BORDER; | |
+ | |
simple = (Simple *) engine->user_data; | |
/* load settings */ | |
@@ -117,6 +116,7 @@ | |
gdk_rgba_parse (&simple->fgcolor, color); | |
g_free (color); | |
+ BORDER = DEFAULT_BORDER; | |
+ BORDER = atol(xfsm_splash_rc_read_entry (rc, "BorderThickness", DEFAULT_BORDER)); | |
font = xfsm_splash_rc_read_entry (rc, "Font", DEFAULT_FONT); | |
path = xfsm_splash_rc_read_entry (rc, "Image", NULL); | |
@@ -147,9 +147,9 @@ | |
text_height = (pango_font_metrics_get_ascent (metrics) | |
+ pango_font_metrics_get_descent (metrics)) / PANGO_SCALE | |
+ 4; | |
- | |
- simple->area.width = logo_width + 2 * BORDER; | |
- simple->area.height = logo_height + text_height + 3 * BORDER; | |
+ | |
+ simple->area.width = logo_width; | |
+ simple->area.height = logo_height; | |
simple->area.x = (geo.width - simple->area.width) / 2; | |
simple->area.y = (geo.height - simple->area.height) / 2; | |
@@ -218,26 +218,6 @@ | |
gdk_cairo_set_source_pixbuf (cr, simple->logo, 0, 0); | |
cairo_paint (cr); | |
- gdk_cairo_set_source_rgba (cr, &simple->bgcolor); | |
- cairo_rectangle (cr, | |
- simple->textbox.x, | |
- simple->textbox.y, | |
- simple->textbox.width, | |
- simple->textbox.height); | |
- cairo_fill (cr); | |
- | |
- /* draw shadow */ | |
- shcolor.red = (simple->fgcolor.red + simple->bgcolor.red) / 2; | |
- shcolor.green = (simple->fgcolor.green + simple->bgcolor.green) / 2; | |
- shcolor.blue = (simple->fgcolor.blue + simple->bgcolor.blue) / 2; | |
- shcolor.red = (shcolor.red + shcolor.green + shcolor.blue) / 3; | |
- shcolor.green = shcolor.red; | |
- shcolor.blue = shcolor.red; | |
- | |
- gdk_cairo_set_source_rgba (cr, &shcolor); | |
- cairo_move_to (cr, tx + 2, ty + 2); | |
- pango_cairo_show_layout (cr, simple->layout); | |
- | |
gdk_cairo_set_source_rgba (cr, &simple->fgcolor); | |
cairo_move_to (cr, tx, ty); | |
pango_cairo_show_layout (cr, simple->layout); | |
@@ -318,6 +298,7 @@ | |
GtkWidget *dialog; | |
GtkWidget *frame; | |
GtkWidget *btn_font; | |
+ GtkWidget *border_e; | |
GtkWidget *table; | |
GtkWidget *label; | |
GtkWidget *sel_bg; | |
@@ -340,7 +321,27 @@ | |
NULL); | |
dbox = GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))); | |
+ /* border... */ | |
+ frame = xfce_gtk_frame_box_new (_("Other"), &bin); | |
+ gtk_box_pack_start (dbox, frame, FALSE, FALSE, 6); | |
+ gtk_widget_show (frame); | |
+ | |
+ table = gtk_grid_new (); | |
+ gtk_container_add (GTK_CONTAINER (bin), table); | |
+ gtk_widget_show (table); | |
+ | |
+ label = gtk_label_new (_("Text Border: ")); | |
+ gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1); | |
+ gtk_widget_show (label); | |
+ border_e = gtk_entry_new (); | |
+ gtk_grid_attach (GTK_GRID (table), border_e, 1, 0, 1, 1); | |
+ gtk_widget_show (border_e); | |
+ | |
+ /* font... */ | |
frame = xfce_gtk_frame_box_new (_("Font"), &bin); | |
gtk_box_pack_start (dbox, frame, FALSE, FALSE, 6); | |
gtk_widget_show (frame); | |
@@ -351,6 +352,7 @@ | |
gtk_container_add (GTK_CONTAINER (bin), btn_font); | |
gtk_widget_show (btn_font); | |
+/* ---- */ | |
frame = xfce_gtk_frame_box_new (_("Colors"), &bin); | |
gtk_box_pack_start (dbox, frame, FALSE, FALSE, 6); | |
gtk_widget_show (frame); | |
@@ -435,6 +437,9 @@ | |
/* store settings */ | |
xfsm_splash_rc_write_entry (config->rc, "Font", | |
gtk_font_button_get_font_name (GTK_FONT_BUTTON (btn_font))); | |
+ | |
+ xfsm_splash_rc_write_entry (config->rc, "BorderThickness", | |
+ gtk_entry_get_text(border_e)); | |
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (sel_bg), &color); | |
buffer = gdk_rgba_to_string (&color); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment