diff --git a/0001-add-X-System-Server-in-categories.patch b/0001-add-X-System-Server-in-categories.patch new file mode 100644 index 0000000..ae97970 --- /dev/null +++ b/0001-add-X-System-Server-in-categories.patch @@ -0,0 +1,24 @@ +From 8a44e6f8f73784553d6171ff6f7cb20340089ba5 Mon Sep 17 00:00:00 2001 +From: root +Date: Thu, 9 Jul 2020 19:49:08 +0800 +Subject: [PATCH] add X-System-Server in categories + +--- + src/capplet/mate-notification-properties.desktop.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/capplet/mate-notification-properties.desktop.in b/src/capplet/mate-notification-properties.desktop.in +index acdec6b..b601603 100644 +--- a/src/capplet/mate-notification-properties.desktop.in ++++ b/src/capplet/mate-notification-properties.desktop.in +@@ -6,6 +6,6 @@ Icon=mate-notification-properties + Terminal=false + Type=Application + StartupNotify=true +-Categories=GTK;Settings;DesktopSettings;X-System-Server; ++Categories=GTK;Settings;DesktopSettings;X-System-Server;X-System-Server; + OnlyShowIn=MATE; + Keywords=MATE;Notification;Theme; +-- +2.18.1 + diff --git a/0001-features-add-new-kiran-themes-in-mate-notification-p-507a6bf0.patch b/0001-features-add-new-kiran-themes-in-mate-notification-p-507a6bf0.patch new file mode 100644 index 0000000..89acf38 --- /dev/null +++ b/0001-features-add-new-kiran-themes-in-mate-notification-p-507a6bf0.patch @@ -0,0 +1,1267 @@ +From 507a6bf07ab39523df276a51a8b44ec8f9a235bd Mon Sep 17 00:00:00 2001 +From: yuanxing +Date: Fri, 22 Jan 2021 10:33:30 +0800 +Subject: [PATCH 1/9] features: add new kiran themes in + mate-notification-properties +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 添加新的kiran消息框主题 + +Realated #33420 +--- + configure.ac | 1 + + po/POTFILES.in | 1 + + po/zh_CN.po | 13 + + src/capplet/mate-notification-properties.c | 4 + + src/daemon/daemon.c | 2 +- + src/themes/Makefile.am | 2 +- + src/themes/kiran/Makefile.am | 28 + + src/themes/kiran/data/icons/close_hover.svg | 16 + + src/themes/kiran/data/icons/close_normal.svg | 11 + + src/themes/kiran/data/icons/close_press.svg | 16 + + src/themes/kiran/data/kiran.css | 91 ++ + src/themes/kiran/kiran.c | 934 +++++++++++++++++++ + src/themes/kiran/kiran.gresource.xml | 9 + + 13 files changed, 1126 insertions(+), 2 deletions(-) + create mode 100644 src/themes/kiran/Makefile.am + create mode 100644 src/themes/kiran/data/icons/close_hover.svg + create mode 100644 src/themes/kiran/data/icons/close_normal.svg + create mode 100644 src/themes/kiran/data/icons/close_press.svg + create mode 100644 src/themes/kiran/data/kiran.css + create mode 100644 src/themes/kiran/kiran.c + create mode 100644 src/themes/kiran/kiran.gresource.xml + +diff --git a/configure.ac b/configure.ac +index a43ad19..dea982e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -249,6 +249,7 @@ src/themes/coco/Makefile + src/themes/nodoka/Makefile + src/themes/slider/Makefile + src/themes/standard/Makefile ++src/themes/kiran/Makefile + ]) + + AC_OUTPUT +diff --git a/po/POTFILES.in b/po/POTFILES.in +index 64a83b1..e3f7c90 100644 +--- a/po/POTFILES.in ++++ b/po/POTFILES.in +@@ -8,3 +8,4 @@ src/themes/coco/coco-theme.c + src/themes/nodoka/nodoka-theme.c + src/themes/slider/theme.c + src/themes/standard/theme.c ++src/themes/kiran/kiran.c +diff --git a/po/zh_CN.po b/po/zh_CN.po +index 294734f..e2f2551 100644 +--- a/po/zh_CN.po ++++ b/po/zh_CN.po +@@ -187,3 +187,16 @@ msgstr "通知主体文本" + #: ../src/themes/standard/theme.c:752 + msgid "Closes the notification." + msgstr "关闭通知" ++ ++ ++#: ../src/themes/kiran/kiran.c ++msgid "Normal Notification" ++msgstr "一般信息通知" ++ ++#: ../src/themes/kiran/kiran.c ++msgid "Low Notification" ++msgstr "低优先级通知" ++ ++#: ../src/themes/kiran/kiran.c ++msgid "Critical Notification" ++msgstr "重要通知" +\ No newline at end of file +diff --git a/src/capplet/mate-notification-properties.c b/src/capplet/mate-notification-properties.c +index 2f5b103..09b6643 100644 +--- a/src/capplet/mate-notification-properties.c ++++ b/src/capplet/mate-notification-properties.c +@@ -340,6 +340,10 @@ static void notification_properties_dialog_setup_themes(NotificationAppletDialog + { + theme_label = g_strdup(_("Standard theme")); + } ++ else if (g_str_equal(theme_name, "kiran")) ++ { ++ theme_label = g_strdup(_("Kiran")); ++ } + else + { + theme_label = g_strdup(theme_name); +diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c +index c418809..3ee2266 100644 +--- a/src/daemon/daemon.c ++++ b/src/daemon/daemon.c +@@ -1352,8 +1352,8 @@ static gboolean notify_daemon_notify_handler(NotifyDaemonNotifications *object, + theme_clear_notification_actions (nw); + } + +- theme_set_notification_text (nw, summary, body); + theme_set_notification_hints (nw, hints); ++ theme_set_notification_text (nw, summary, body); + + /* + *XXX This needs to handle file URIs and all that. +diff --git a/src/themes/Makefile.am b/src/themes/Makefile.am +index 160000b..99df82a 100644 +--- a/src/themes/Makefile.am ++++ b/src/themes/Makefile.am +@@ -1,3 +1,3 @@ +-SUBDIRS = coco nodoka slider standard ++SUBDIRS = coco nodoka slider standard kiran + + -include $(top_srcdir)/git.mk +diff --git a/src/themes/kiran/Makefile.am b/src/themes/kiran/Makefile.am +new file mode 100644 +index 0000000..fcb1626 +--- /dev/null ++++ b/src/themes/kiran/Makefile.am +@@ -0,0 +1,28 @@ ++NULL = ++ ++enginedir = $(libdir)/mate-notification-daemon/engines ++engine_LTLIBRARIES = libkiran.la ++ ++RESOURCE_XML=kiran.gresource.xml ++GLIB_COMPILE_RESOURCE=glib-compile-resources ++ ++AM_CPPFLAGS = $(THEME_CFLAGS) ++ ++gresource.c: $(RESOURCE_XML) ++ $(GLIB_COMPILE_RESOURCE) --target $@ $< --generate --c-name kiran ++ ++gresource.h: $(RESOURCE_XML) ++ $(GLIB_COMPILE_RESOURCE) --target $@ $< --generate --c-name kiran ++ ++libkiran_la_SOURCES = kiran.c gresource.c gresource.h ++ ++libkiran_la_LDFLAGS = -module -avoid-version -no-undefined ++libkiran_la_LIBADD = \ ++ $(THEME_LIBS) \ ++ $(NULL) ++ ++-include $(top_srcdir)/git.mk ++ ++.PHONY :clean ++clean: ++ rm -f gresource.c gresource.h +\ No newline at end of file +diff --git a/src/themes/kiran/data/icons/close_hover.svg b/src/themes/kiran/data/icons/close_hover.svg +new file mode 100644 +index 0000000..1edd094 +--- /dev/null ++++ b/src/themes/kiran/data/icons/close_hover.svg +@@ -0,0 +1,16 @@ ++ ++ ++ ++ ++ ++ ++ +diff --git a/src/themes/kiran/data/icons/close_normal.svg b/src/themes/kiran/data/icons/close_normal.svg +new file mode 100644 +index 0000000..5b94a31 +--- /dev/null ++++ b/src/themes/kiran/data/icons/close_normal.svg +@@ -0,0 +1,11 @@ ++ ++ ++ ++ ++ ++ +diff --git a/src/themes/kiran/data/icons/close_press.svg b/src/themes/kiran/data/icons/close_press.svg +new file mode 100644 +index 0000000..7a75734 +--- /dev/null ++++ b/src/themes/kiran/data/icons/close_press.svg +@@ -0,0 +1,16 @@ ++ ++ ++ ++ ++ ++ ++ +diff --git a/src/themes/kiran/data/kiran.css b/src/themes/kiran/data/kiran.css +new file mode 100644 +index 0000000..2f9123e +--- /dev/null ++++ b/src/themes/kiran/data/kiran.css +@@ -0,0 +1,91 @@ ++/******************Label******************************/ ++#summary_label ++{ ++ color:#ffffff; ++ font-size:14px; ++ font-family: "Noto Sans CJK SC regular"; ++ padding-bottom: 8px; ++} ++ ++#body_label ++{ ++ color: #919191; ++ font-size: 12px; ++ font-family: "Noto Sans CJK SC regular"; ++ line-height:12px; ++} ++ ++#actions_label ++{ ++ color: #3197de; ++ font-size: 12px; ++ font-family: "PingFang SC Medium"; ++} ++ ++ ++/*********************Button****************************/ ++ ++#actions_button,#actions_hbox ++{ ++ padding:0px; ++ box-shadow:none; ++ margin:0px; ++} ++ ++#actions_button:hover ++{ ++ border-bottom:1px solid #3197DE; ++} ++ ++#close_button ++{ ++ background-image: url("/kiran/themes/close_normal"); ++ background-repeat: no-repeat; ++ background-position: center; ++ background-color: transparent; ++ padding: 0px; ++ border: none; ++ margin: 0px; ++ box-shadow: 0px; ++} ++ ++#close_button:hover ++{ ++ background-image: url("/kiran/themes/close_hover"); ++ background-repeat: no-repeat; ++ background-position: center; ++} ++ ++#close_button:active ++{ ++ background-image: url("/kiran/themes/close_press"); ++ background-repeat: no-repeat; ++ background-position: center; ++} ++ ++/***********************Box***********************/ ++#main_hbox , #main_vbox ++{ ++ margin: 0px; ++ padding: 0px; ++ box-shadow: 0px; ++} ++ ++#main_hbox ++{ ++ /* background-color: yellow; */ ++ margin-right: 14px; ++ margin-bottom: 12px; ++} ++ ++#icon_box ++{ ++ margin-left: 12px; ++ margin-top: 12px; ++ margin-right: 12px; ++} ++ ++#text_vbox ,#action_vbox ++{ ++ margin-top: 16px; ++} +diff --git a/src/themes/kiran/kiran.c b/src/themes/kiran/kiran.c +new file mode 100644 +index 0000000..9181e20 +--- /dev/null ++++ b/src/themes/kiran/kiran.c +@@ -0,0 +1,934 @@ ++/* ++ * kiran.c ++ * This file is part of notification-daemon-engine-kiran ++ * ++ * Copyright (C) 2012 - Stefano Karapetsas ++ * Copyright (C) 2010 - Eduardo Grajeda ++ * Copyright (C) 2008 - Martin Sourada ++ * ++ * notification-daemon-engine-kiran is free software; you can redistribute it ++ * and/or modify it under the terms of the GNU General Public License as ++ * published by the Free Software Foundation; either version 3 of the License, ++ * or (at your option) any later version. ++ * ++ * notification-daemon-engine-kiran is distributed in the hope that it will be ++ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with notification-daemon-engine-kiran; if not, write to the Free ++ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, ++ * Boston, MA 02110-1301 USA ++ */ ++ ++#include "config.h" ++ ++#include ++#include ++#include ++#include ++#include "gresource.h" ++ ++/* Define basic kiran types */ ++typedef void (*ActionInvokedCb)(GtkWindow *nw, const char *key); ++typedef void (*UrlClickedCb)(GtkWindow *nw, const char *url); ++ ++typedef struct ++{ ++ GtkWidget *win; ++ GtkWidget *top_spacer; ++ GtkWidget *bottom_spacer; ++ GtkWidget *main_hbox; ++ GtkWidget *iconbox; ++ GtkWidget *icon; ++ GtkWidget *close_button; ++ GtkWidget *summary_label; ++ GtkWidget *body_label; ++ GtkWidget *actions_box; ++ GtkWidget *last_sep; ++ GtkWidget *stripe_spacer; ++ GtkWidget *pie_countdown; ++ ++ gboolean composited; ++ gboolean action_icons; ++ ++ int width; ++ int height; ++ int last_width; ++ int last_height; ++ ++ guchar urgency; ++ glong timeout; ++ glong remaining; ++ ++ UrlClickedCb url_clicked; ++ ++ GtkTextDirection rtl; ++} WindowData; ++ ++ ++enum ++{ ++ URGENCY_LOW, ++ URGENCY_NORMAL, ++ URGENCY_CRITICAL ++}; ++ ++gboolean theme_check_init(unsigned int major_ver, unsigned int minor_ver, ++ unsigned int micro_ver); ++void get_theme_info(char **theme_name, char **theme_ver, char **author, ++ char **homepage); ++GtkWindow* create_notification(UrlClickedCb url_clicked); ++void set_notification_text(GtkWindow *nw, const char *summary, ++ const char *body); ++void set_notification_icon(GtkWindow *nw, GdkPixbuf *pixbuf); ++void set_notification_arrow(GtkWidget *nw, gboolean visible, int x, int y); ++void add_notification_action(GtkWindow *nw, const char *text, const char *key, ++ ActionInvokedCb cb); ++void clear_notification_actions(GtkWindow *nw); ++void move_notification(GtkWidget *nw, int x, int y); ++void set_notification_timeout(GtkWindow *nw, glong timeout); ++void set_notification_hints(GtkWindow *nw, GVariant *hints); ++void notification_tick(GtkWindow *nw, glong remaining); ++ ++#define STRIPE_WIDTH 32 ++#define WIDTH 270 ++#define IMAGE_SIZE 32 ++#define IMAGE_PADDING 10 ++#define SPACER_LEFT 30 ++#define PIE_RADIUS 7 ++#define PIE_WIDTH (2 * PIE_RADIUS) ++#define PIE_HEIGHT (2 * PIE_RADIUS) ++#define BODY_X_OFFSET (IMAGE_SIZE + 8) ++#define DEFAULT_ARROW_OFFSET (SPACER_LEFT + 12) ++#define DEFAULT_ARROW_HEIGHT 14 ++#define DEFAULT_ARROW_WIDTH 22 ++#define DEFAULT_ARROW_SKEW -6 ++#define BACKGROUND_OPACITY 1.0 ++#define GRADIENT_CENTER 0.7 ++ ++/* Support Nodoka Functions */ ++ ++/* Handle clicking on link */ ++static gboolean ++activate_link (GtkLabel *label, const char *url, WindowData *windata) ++{ ++ windata->url_clicked (GTK_WINDOW (windata->win), url); ++ return TRUE; ++} ++ ++static void ++destroy_windata(WindowData *windata) ++{ ++ g_free(windata); ++} ++ ++/* Draw fuctions */ ++/* Standard rounded rectangle */ ++static void ++nodoka_rounded_rectangle (cairo_t * cr, ++ double x, double y, double w, double h, ++ int radius) ++{ ++ cairo_move_to (cr, x + radius, y); ++ cairo_arc (cr, x + w - radius, y + radius, radius, G_PI * 1.5, G_PI * 2); ++ cairo_arc (cr, x + w - radius, y + h - radius, radius, 0, G_PI * 0.5); ++ cairo_arc (cr, x + radius, y + h - radius, radius, G_PI * 0.5, G_PI); ++ cairo_arc (cr, x + radius, y + radius, radius, G_PI, G_PI * 1.5); ++} ++ ++/* Fill background */ ++static void ++fill_background(GtkWidget *widget, WindowData *windata, cairo_t *cr) ++{ ++ float alpha; ++ if (windata->composited) ++ alpha = BACKGROUND_OPACITY; ++ else ++ alpha = 1.0; ++ ++ cairo_pattern_t *pattern; ++ pattern = cairo_pattern_create_linear (0, 0, 0, windata->height); ++ cairo_pattern_add_color_stop_rgba (pattern, 0, ++ 34/255.0, 34/255.0, 34/255.0, alpha); ++ cairo_pattern_add_color_stop_rgba (pattern, GRADIENT_CENTER, ++ 34/255.0, 34/255.0, 34/255.0, alpha); ++ cairo_pattern_add_color_stop_rgba (pattern, 1, ++ 34/255.0, 34/255.0, 34/255.0, alpha); ++ cairo_set_source (cr, pattern); ++ cairo_pattern_destroy (pattern); ++ ++ nodoka_rounded_rectangle (cr, 0, 0, windata->width, ++ windata->height, 6); ++ ++ cairo_fill (cr); ++} ++ ++ ++/** ++ * @brief 当鼠标进入消息框窗体时,重绘背景 ++ */ ++static void ++fill_background_when_pointer_enter(GtkWidget *widget, WindowData *windata, cairo_t *cr) ++{ ++ float alpha; ++ if (windata->composited) ++ alpha = BACKGROUND_OPACITY; ++ else ++ alpha = 1.0; ++ ++ cairo_pattern_t *pattern; ++ pattern = cairo_pattern_create_linear (0, 0, 0, windata->height); ++ cairo_pattern_add_color_stop_rgba (pattern, 0, ++ 51/255.0, 51/255.0, 51/255.0, alpha); ++ cairo_pattern_add_color_stop_rgba (pattern, GRADIENT_CENTER, ++ 51/255.0, 51/255.0, 51/255.0, alpha); ++ cairo_pattern_add_color_stop_rgba (pattern, 1, ++ 51/255.0, 51/255.0, 51/255.0, alpha); ++ cairo_set_source (cr, pattern); ++ cairo_pattern_destroy (pattern); ++ ++ nodoka_rounded_rectangle (cr, 0, 0, windata->width, ++ windata->height, 8); ++ ++ cairo_fill (cr); ++} ++ ++static void ++draw_pie(GtkWidget *pie, WindowData *windata, cairo_t *cr) ++{ ++ if (windata->timeout == 0) ++ return; ++ ++ gdouble arc_angle = 1.0 - (gdouble)windata->remaining / (gdouble)windata->timeout; ++ cairo_set_source_rgba (cr, 92/255.0, 92/255.0, 92/255.0, 1); ++ cairo_move_to(cr, PIE_RADIUS, PIE_RADIUS); ++ cairo_arc_negative(cr, PIE_RADIUS, PIE_RADIUS, PIE_RADIUS, ++ -G_PI/2, (-0.25 + arc_angle)*2*G_PI); ++ cairo_line_to(cr, PIE_RADIUS, PIE_RADIUS); ++ ++ cairo_fill (cr); ++} ++ ++static void ++update_shape_region (cairo_surface_t *surface, ++ WindowData *windata) ++{ ++ if (windata->width == windata->last_width && windata->height == windata->last_height) ++ { ++ return; ++ } ++ ++ if (windata->width == 0 || windata->height == 0) ++ { ++ GtkAllocation allocation; ++ gtk_widget_get_allocation (windata->win, &allocation); ++ ++ windata->width = MAX (allocation.width, 1); ++ windata->height = MAX (allocation.height, 1); ++ } ++ ++ if (!windata->composited) { ++ cairo_region_t *region; ++ ++ region = gdk_cairo_region_create_from_surface (surface); ++ gtk_widget_shape_combine_region (windata->win, region); ++ cairo_region_destroy (region); ++ } else { ++ gtk_widget_shape_combine_region (windata->win, NULL); ++ return; ++ } ++ ++ windata->last_width = windata->width; ++ windata->last_height = windata->height; ++} ++ ++static void ++paint_window (GtkWidget *widget, ++ cairo_t *cr, ++ WindowData *windata) ++{ ++ cairo_surface_t *surface; ++ cairo_t *cr2; ++ ++ if (windata->width == 0 || windata->height == 0) { ++ GtkAllocation allocation; ++ ++ gtk_widget_get_allocation(windata->win, &allocation); ++ windata->width = allocation.width; ++ windata->height = allocation.height; ++ } ++ ++ surface = cairo_surface_create_similar(cairo_get_target(cr), ++ CAIRO_CONTENT_COLOR_ALPHA, ++ windata->width, ++ windata->height); ++ ++ cr2 = cairo_create (surface); ++ fill_background(widget, windata, cr2); ++ cairo_fill (cr2); ++ ++ cairo_destroy (cr2); ++ ++ cairo_save (cr); ++ ++ cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); ++ cairo_set_source_surface (cr, surface, 0, 0); ++ cairo_paint (cr); ++ cairo_restore (cr); ++ ++ update_shape_region (surface, windata); ++ ++ cairo_surface_destroy (surface); ++} ++ ++/** ++ * @brief 当鼠标进入消息框窗体时,给窗体加上边框 ++ */ ++static void ++paint_window_when_pointer_enter(GtkWidget *widget, ++ cairo_t *cr, ++ WindowData *windata) ++{ ++ cairo_surface_t *surface; ++ cairo_t *cr2; ++ ++ if (windata->width == 0 || windata->height == 0) { ++ GtkAllocation allocation; ++ ++ gtk_widget_get_allocation(windata->win, &allocation); ++ windata->width = allocation.width; ++ windata->height = allocation.height; ++ } ++ ++ surface = cairo_surface_create_similar(cairo_get_target(cr), ++ CAIRO_CONTENT_COLOR_ALPHA, ++ windata->width, ++ windata->height); ++ ++ cr2 = cairo_create (surface); ++ ++ fill_background_when_pointer_enter(widget, windata, cr2); ++ cairo_fill (cr2); ++ ++ nodoka_rounded_rectangle (cr2, 0, 0, windata->width , windata->height, 8); ++ cairo_set_source_rgba (cr2, 40/255.0, 144/255.0, 216/255.0, 1.0); ++ cairo_set_line_width (cr2, 4.0); ++ cairo_stroke (cr2); ++ ++ cairo_destroy (cr2); ++ ++ cairo_save (cr); ++ ++ cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); ++ cairo_set_source_surface (cr, surface, 0, 0); ++ cairo_paint (cr); ++ cairo_restore (cr); ++ ++ update_shape_region (surface, windata); ++ ++ cairo_surface_destroy (surface); ++ ++} ++ ++/* Event handlers */ ++/** ++ * @brief "draw"回调函数:根据窗体当前状态,判断绘制成鼠标移入样式 ++ */ ++static gboolean ++on_draw (GtkWidget *widget, cairo_t *cr, WindowData *windata) ++{ ++ GtkStateFlags flags = gtk_widget_get_state_flags(windata->win); ++ if (flags & GTK_STATE_FLAG_PRELIGHT) ++ { ++ paint_window_when_pointer_enter(widget , cr , windata); ++ } ++ else ++ { ++ paint_window (widget, cr, windata); ++ } ++ return FALSE; ++} ++ ++static gboolean ++configure_event_cb(GtkWidget *nw, ++ GdkEventConfigure *event, ++ WindowData *windata) ++{ ++ windata->width = event->width; ++ windata->height = event->height; ++ ++ gtk_widget_queue_draw(nw); ++ ++ return FALSE; ++} ++ ++static gboolean ++countdown_expose_cb(GtkWidget *pie, ++ cairo_t *cr, ++ WindowData *windata) ++{ ++ cairo_t *cr2; ++ cairo_surface_t *surface; ++ GtkAllocation alloc; ++ ++ cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); ++ ++ gtk_widget_get_allocation (pie, &alloc); ++ ++ surface = cairo_surface_create_similar (cairo_get_target (cr), ++ CAIRO_CONTENT_COLOR_ALPHA, ++ alloc.width, ++ alloc.height); ++ ++ cr2 = cairo_create (surface); ++ ++ cairo_translate (cr2, -alloc.x, -alloc.y); ++ ++ GtkStateFlags flags = gtk_widget_get_state_flags(windata->win); ++ if (flags & GTK_STATE_FLAG_PRELIGHT) ++ { ++ fill_background_when_pointer_enter(pie, windata ,cr2); ++ } ++ else ++ { ++ fill_background (pie, windata, cr2); ++ } ++ cairo_translate (cr2, alloc.x, alloc.y); ++ draw_pie (pie, windata, cr2); ++ cairo_fill (cr2); ++ ++ cairo_destroy (cr2); ++ ++ cairo_save (cr); ++ cairo_set_source_surface (cr, surface, 0, 0); ++ cairo_paint (cr); ++ cairo_restore (cr); ++ ++ cairo_surface_destroy (surface); ++ return TRUE; ++} ++ ++static gboolean on_configure_event (GtkWidget* widget, GdkEventConfigure* event, WindowData* windata) ++{ ++ windata->width = event->width; ++ windata->height = event->height; ++ ++ gtk_widget_queue_draw (widget); ++ ++ return FALSE; ++} ++ ++static void on_composited_changed (GtkWidget* window, WindowData* windata) ++{ ++ windata->composited = gdk_screen_is_composited (gtk_widget_get_screen(window)); ++ ++ gtk_widget_queue_draw (window); ++} ++ ++ ++/** ++ * @brief 事件过滤:当鼠标移入或者离开消息框,绘制相应的消息框状态 ++ */ ++GdkFilterReturn event_filter(GdkXEvent *xevent, GdkEvent *event, gpointer userdata) ++{ ++ XEvent *x_event = (XEvent*)xevent; ++ XGenericEvent *general_event = (XGenericEvent*)x_event; ++ GtkWidget *window = GTK_WIDGET(userdata); ++ ++ switch(x_event->type) { ++ case EnterNotify: ++ gtk_widget_set_state_flags(window, GTK_STATE_FLAG_PRELIGHT, FALSE); ++ gtk_widget_queue_draw(window); ++ break; ++ case LeaveNotify: ++ gtk_widget_set_state_flags(window, gtk_widget_get_state_flags(window) & ~GTK_STATE_FLAG_PRELIGHT, TRUE); ++ gtk_widget_queue_draw(window); ++ break; ++ case GenericEvent: ++ do ++ { ++ if (general_event->evtype == EnterNotify) { ++ gtk_widget_set_state_flags(window, GTK_STATE_FLAG_PRELIGHT, FALSE); ++ gtk_widget_queue_draw(window); ++ } ++ ++ if (general_event->evtype == LeaveNotify) { ++ gtk_widget_set_state_flags(window, gtk_widget_get_state_flags(window) & ~GTK_STATE_FLAG_PRELIGHT, TRUE); ++ gtk_widget_queue_draw(window); ++ } ++ }while(0); ++ break; ++ default: ++ break; ++ } ++ return GDK_FILTER_CONTINUE; ++} ++ ++static void ++on_realize(GtkWidget *widget , gpointer userdata ) ++{ ++ GdkWindow *window = gtk_widget_get_window(widget); ++ gdk_window_add_filter(window, event_filter, widget); ++} ++ ++ ++static void ++action_clicked_cb(GtkWidget *w, GdkEventButton *event, ++ ActionInvokedCb action_cb) ++{ ++ GtkWindow *nw = g_object_get_data(G_OBJECT(w), "_nw"); ++ const char *key = g_object_get_data(G_OBJECT(w), "_action_key"); ++ ++ action_cb(nw, key); ++} ++ ++/* Required functions */ ++ ++/* Checking if we support this notification daemon version */ ++gboolean ++theme_check_init(unsigned int major_ver, unsigned int minor_ver, ++ unsigned int micro_ver) ++{ ++ return major_ver == NOTIFICATION_DAEMON_MAJOR_VERSION && minor_ver == NOTIFICATION_DAEMON_MINOR_VERSION && micro_ver == NOTIFICATION_DAEMON_MICRO_VERSION; ++} ++ ++/* Sending theme info to the notification daemon */ ++void ++get_theme_info(char **theme_name, ++ char **theme_ver, ++ char **author, ++ char **homepage) ++{ ++ *theme_name = g_strdup("Kiran"); ++ *theme_ver = g_strdup_printf("%d.%d.%d", NOTIFICATION_DAEMON_MAJOR_VERSION, ++ NOTIFICATION_DAEMON_MINOR_VERSION, ++ NOTIFICATION_DAEMON_MICRO_VERSION); ++ *author = g_strdup("Eduardo Grajeda"); ++ *homepage = g_strdup("http://github.com/tatofoo/"); ++} ++ ++/* set css*/ ++static void ++set_css(GtkWidget* widget) ++{ ++ GtkCssProvider *provider = gtk_css_provider_new (); ++ ++ gtk_css_provider_load_from_resource (provider, "/kiran/themes/kiran.css"); ++ gtk_style_context_add_provider_for_screen (gtk_widget_get_screen(widget), ++ GTK_STYLE_PROVIDER(provider), ++ GTK_STYLE_PROVIDER_PRIORITY_USER); ++ gtk_style_context_reset_widgets(gtk_widget_get_screen(widget)); ++ ++ g_object_unref (provider); ++} ++ ++ ++/* Create new notification */ ++GtkWindow * ++create_notification(UrlClickedCb url_clicked) ++{ ++ GtkWidget *win; ++ GtkWidget *main_vbox; ++ GtkWidget* close_button; ++ GtkWidget* action_vbox; ++ GtkWidget *vbox; ++ AtkObject *atkobj; ++ WindowData *windata; ++ GdkVisual *visual; ++ GdkScreen *screen; ++ GResource *resource; ++ ++ windata = g_new0(WindowData, 1); ++ windata->urgency = URGENCY_NORMAL; ++ windata->url_clicked = url_clicked; ++ ++ win = gtk_window_new(GTK_WINDOW_POPUP); ++ gtk_window_set_resizable(GTK_WINDOW(win), FALSE); ++ gtk_window_set_decorated (GTK_WINDOW(win), TRUE); ++ windata->win = win; ++ ++ //register resource ++ resource = kiran_get_resource(); ++ g_resources_register (resource); ++ ++ set_css(windata->win); ++ gtk_widget_set_name(windata->win , "notification_window"); ++ windata->rtl = gtk_widget_get_default_direction(); ++ windata->composited = FALSE; ++ screen = gtk_window_get_screen(GTK_WINDOW(win)); ++ visual = gdk_screen_get_rgba_visual(screen); ++ ++ if (visual != NULL) ++ { ++ gtk_widget_set_visual(win, visual); ++ if (gdk_screen_is_composited(screen)) ++ windata->composited = TRUE; ++ } ++ gtk_window_set_title(GTK_WINDOW(win), "Notification"); ++ gtk_window_set_type_hint(GTK_WINDOW(win), GDK_WINDOW_TYPE_HINT_NOTIFICATION); ++ gtk_widget_add_events(win, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); ++ ++ g_signal_connect(G_OBJECT(win), "realize" , G_CALLBACK(on_realize) , NULL); ++ ++ gtk_widget_realize(win); ++ ++ g_object_set_data_full(G_OBJECT(win), "windata", windata, ++ (GDestroyNotify)destroy_windata); ++ atk_object_set_role(gtk_widget_get_accessible(win), ATK_ROLE_ALERT); ++ ++ g_signal_connect(G_OBJECT(win), "configure_event", ++ G_CALLBACK(configure_event_cb), windata); ++ ++ main_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); ++ gtk_widget_set_name(main_vbox , "main_vbox"); ++ gtk_widget_show(main_vbox); ++ gtk_container_add (GTK_CONTAINER (win), main_vbox); ++ ++ g_signal_connect (G_OBJECT (main_vbox), "draw", ++ G_CALLBACK (on_draw), windata); ++ ++ g_signal_connect (G_OBJECT (win), "configure-event", G_CALLBACK (on_configure_event), windata); ++ ++ g_signal_connect (G_OBJECT (win), "composited-changed", G_CALLBACK (on_composited_changed), windata); ++ ++ windata->main_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); ++ gtk_widget_set_name(windata->main_hbox , "main_hbox"); ++ gtk_widget_set_halign (windata->main_hbox, GTK_ALIGN_START); ++ gtk_widget_set_valign (windata->main_hbox, GTK_ALIGN_START); ++ gtk_widget_show (windata->main_hbox); ++ gtk_box_pack_start (GTK_BOX(main_vbox), windata->main_hbox, FALSE, FALSE, 0); ++ ++ /* The icon goes at the left */ ++ windata->iconbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); ++ gtk_widget_set_name(windata->iconbox , "icon_box"); ++ gtk_widget_show(windata->iconbox); ++ gtk_box_pack_start(GTK_BOX(windata->main_hbox), windata->iconbox, ++ FALSE, FALSE, 0); ++ gtk_widget_set_valign (GTK_WIDGET(windata->iconbox),GTK_ALIGN_START); ++ ++ windata->icon = gtk_image_new(); ++ gtk_box_pack_start(GTK_BOX(windata->iconbox), windata->icon, ++ FALSE, FALSE, 0); ++ ++ /* The title and the text at the right */ ++ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); ++ gtk_widget_set_name(vbox , "text_vbox"); ++ gtk_widget_set_halign (vbox, GTK_ALIGN_START); ++ gtk_widget_show (vbox); ++ gtk_box_pack_start (GTK_BOX (windata->main_hbox), vbox, FALSE, FALSE, 0); ++ ++ ++ /* Add action_vbox*/ ++ action_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL , 0); ++ gtk_widget_set_name(action_vbox , "action_vbox"); ++ gtk_widget_show(action_vbox); ++ gtk_box_pack_end(GTK_BOX(windata->main_hbox), action_vbox , FALSE , FALSE ,0); ++ gtk_widget_set_halign (action_vbox, GTK_ALIGN_END); ++ ++ /* Add the close button */ ++ close_button = gtk_button_new(); ++ gtk_widget_set_name(GTK_WIDGET(close_button) ,"close_button" ); ++ gtk_widget_set_size_request(GTK_WIDGET(close_button) , 16 , 16); ++ gtk_widget_set_valign (close_button, GTK_ALIGN_START); ++ gtk_widget_set_halign (close_button, GTK_ALIGN_END); ++ gtk_widget_set_vexpand (close_button,FALSE); ++ gtk_widget_set_hexpand(close_button , FALSE); ++ gtk_widget_show(close_button); ++ ++ windata->close_button = close_button; ++ gtk_box_pack_start (GTK_BOX (action_vbox), ++ windata->close_button, ++ FALSE, FALSE, 0); ++ ++ gtk_button_set_relief(GTK_BUTTON(close_button), GTK_RELIEF_NONE); ++ gtk_container_set_border_width(GTK_CONTAINER(close_button), 0); ++ g_signal_connect_swapped(G_OBJECT(close_button), "clicked", G_CALLBACK(gtk_widget_destroy), win); ++ ++ atkobj = gtk_widget_get_accessible(close_button); ++ atk_action_set_description(ATK_ACTION(atkobj), 0, ++ _("Closes the notification.")); ++ atk_object_set_name(atkobj, ""); ++ atk_object_set_description (atkobj, _("Closes the notification.")); ++ ++ windata->actions_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,10); ++ gtk_widget_set_name(windata->actions_box , "actions_box"); ++ gtk_widget_set_halign(windata->actions_box, GTK_ALIGN_END); ++ gtk_widget_show(windata->actions_box); ++ gtk_box_pack_end(GTK_BOX(action_vbox), windata->actions_box, FALSE, FALSE, 0); ++ gtk_widget_set_vexpand (windata->actions_box,FALSE); ++ gtk_widget_set_hexpand (windata->actions_box,FALSE); ++ ++ windata->summary_label = gtk_label_new(NULL); ++ gtk_widget_set_name(windata->summary_label, "summary_label"); ++ gtk_widget_show(windata->summary_label); ++ gtk_box_pack_start(GTK_BOX(vbox), windata->summary_label, FALSE, FALSE, 0); ++ gtk_label_set_xalign (GTK_LABEL (windata->summary_label), 0.0); ++ gtk_label_set_yalign (GTK_LABEL (windata->summary_label), 0.0); ++ gtk_label_set_line_wrap(GTK_LABEL(windata->summary_label), TRUE); ++ gtk_label_set_line_wrap_mode (GTK_LABEL (windata->summary_label), PANGO_WRAP_WORD_CHAR); ++ ++ atkobj = gtk_widget_get_accessible(windata->summary_label); ++ atk_object_set_description (atkobj, _("Notification summary text.")); ++ ++ windata->body_label = gtk_label_new(NULL); ++ gtk_widget_set_name(windata->body_label , "body_label"); ++ gtk_box_pack_start(GTK_BOX(vbox), windata->body_label, FALSE, FALSE, 0); ++ gtk_label_set_xalign (GTK_LABEL (windata->body_label), 0.0); ++ gtk_label_set_yalign (GTK_LABEL (windata->body_label), 0.0); ++ gtk_label_set_line_wrap(GTK_LABEL(windata->body_label), TRUE); ++ gtk_label_set_line_wrap_mode (GTK_LABEL (windata->body_label), PANGO_WRAP_WORD_CHAR); ++ gtk_label_set_max_width_chars (GTK_LABEL (windata->body_label), 50); ++ gtk_widget_set_vexpand (windata->body_label, FALSE); ++ ++ g_signal_connect(G_OBJECT(windata->body_label), "activate-link", ++ G_CALLBACK(activate_link), windata); ++ ++ atkobj = gtk_widget_get_accessible(windata->body_label); ++ atk_object_set_description (atkobj, _("Notification body text.")); ++ ++ g_resources_unregister (resource); ++ return GTK_WINDOW(win); ++} ++ ++/* Set the notification text */ ++void ++set_notification_text(GtkWindow *nw, const char *summary, const char *body) ++{ ++ WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata"); ++ g_assert(windata != NULL); ++ ++ if(summary == NULL || *summary == '\0') ++ { ++ if(windata->urgency == URGENCY_CRITICAL) ++ { ++ summary = _("Normal Notification"); ++ } ++ else if(windata->urgency == URGENCY_LOW) ++ { ++ summary = _("Low Notification"); ++ } ++ else if(windata->urgency == URGENCY_CRITICAL) ++ { ++ summary = _("Critical Notification"); ++ } ++ } ++ ++ gtk_label_set_text(GTK_LABEL(windata->summary_label) , summary); ++ gtk_label_set_text (GTK_LABEL (windata->body_label), body); ++ ++ if (body == NULL || *body == '\0') ++ gtk_widget_hide(windata->body_label); ++ else ++ gtk_widget_show(windata->body_label); ++ ++ gtk_widget_set_size_request( ++ ((body != NULL && *body != '\0') ++ ? windata->body_label : windata->summary_label), ++ WIDTH - (IMAGE_SIZE + IMAGE_PADDING) - 10, ++ -1); ++} ++ ++/* Set notification icon */ ++void ++set_notification_icon(GtkWindow *nw, GdkPixbuf *pixbuf) ++{ ++ WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata"); ++ g_assert(windata != NULL); ++ gtk_image_set_from_pixbuf(GTK_IMAGE(windata->icon), pixbuf); ++ ++ if (pixbuf != NULL) ++ { ++ int pixbuf_width = gdk_pixbuf_get_width(pixbuf); ++ ++ gtk_widget_show(windata->icon); ++ gtk_widget_set_size_request(windata->iconbox, ++ MAX(BODY_X_OFFSET, pixbuf_width), -1); ++ } ++ else ++ { ++ gtk_widget_hide(windata->icon); ++ gtk_widget_set_size_request(windata->iconbox, BODY_X_OFFSET, -1); ++ } ++} ++ ++/* Set notification arrow */ ++void ++set_notification_arrow(GtkWidget *nw, gboolean visible, int x, int y) ++{ ++ /* nothing */ ++} ++ ++/* Add notification action */ ++void ++add_notification_action(GtkWindow *nw, const char *text, const char *key, ++ ActionInvokedCb cb) ++{ ++ WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata"); ++ GtkWidget *label; ++ GtkWidget *button; ++ GtkWidget *hbox; ++ GdkPixbuf *pixbuf; ++ char *buf; ++ ++ g_assert(windata != NULL); ++ ++ if (gtk_widget_get_visible(windata->actions_box)) ++ { ++ gtk_widget_show(windata->actions_box); ++ /* Don't try to re-add a pie_countdown */ ++ if (!windata->pie_countdown) { ++ windata->pie_countdown = gtk_drawing_area_new(); ++ gtk_widget_set_halign (windata->pie_countdown, GTK_ALIGN_END); ++ gtk_widget_set_valign (windata->pie_countdown, GTK_ALIGN_END); ++ gtk_widget_show(windata->pie_countdown); ++ ++ gtk_box_pack_end (GTK_BOX (windata->actions_box), windata->pie_countdown, FALSE, FALSE, 0); ++ gtk_widget_set_size_request(windata->pie_countdown, ++ PIE_WIDTH, PIE_HEIGHT); ++ g_signal_connect(G_OBJECT(windata->pie_countdown), "draw", ++ G_CALLBACK(countdown_expose_cb), windata); ++ } ++ } ++ ++ if (windata->action_icons) { ++ button = gtk_button_new_from_icon_name(key, GTK_ICON_SIZE_BUTTON); ++ goto add_button; ++ } ++ ++ button = gtk_button_new(); ++ gtk_widget_show(button); ++ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); ++ gtk_widget_set_name(GTK_WIDGET(hbox) , "actions_hbox"); ++ gtk_widget_set_valign(GTK_WIDGET(hbox), GTK_ALIGN_END); ++ gtk_container_set_border_width(GTK_CONTAINER(hbox), 0); ++ gtk_widget_show(hbox); ++ gtk_container_add(GTK_CONTAINER(button), hbox); ++ ++ /* Try to be smart and find a suitable icon. */ ++ buf = g_strdup_printf("stock_%s", key); ++ pixbuf = gtk_icon_theme_load_icon( ++ gtk_icon_theme_get_for_screen( ++ gdk_window_get_screen(gtk_widget_get_window(GTK_WIDGET(nw)))), ++ buf, 16, GTK_ICON_LOOKUP_USE_BUILTIN, NULL); ++ g_free(buf); ++ ++ if (pixbuf != NULL) ++ { ++ GtkWidget *image = gtk_image_new_from_pixbuf(pixbuf); ++ gtk_widget_show(image); ++ gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0); ++ gtk_widget_set_halign (image, GTK_ALIGN_END); ++ gtk_widget_set_valign (image, GTK_ALIGN_END); ++ } ++ ++ label = gtk_label_new(NULL); ++ gtk_widget_set_name(GTK_WIDGET(label) , "actions_label"); ++ gtk_widget_show(label); ++ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0); ++ gtk_label_set_xalign (GTK_LABEL (label), 0.0); ++ gtk_label_set_yalign (GTK_LABEL (label), 1.0); ++ gtk_widget_set_valign(GTK_WIDGET(label), GTK_ALIGN_END); ++ gtk_label_set_text(GTK_LABEL(label) , text); ++ ++add_button: ++ gtk_widget_set_valign(GTK_WIDGET(button), GTK_ALIGN_END); ++ gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); ++ ++ gtk_widget_set_name(GTK_WIDGET(button) , "actions_button"); ++ gtk_box_pack_start(GTK_BOX(windata->actions_box), button, FALSE, FALSE, 0); ++ ++ g_object_set_data(G_OBJECT(button), "_nw", nw); ++ g_object_set_data_full(G_OBJECT(button), ++ "_action_key", g_strdup(key), g_free); ++ g_signal_connect(G_OBJECT(button), "button-release-event", ++ G_CALLBACK(action_clicked_cb), cb); ++ ++ gtk_widget_show_all(windata->actions_box); ++} ++ ++/* Clear notification actions */ ++void ++clear_notification_actions(GtkWindow *nw) ++{ ++ WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata"); ++ ++ windata->pie_countdown = NULL; ++ ++ gtk_widget_hide(windata->actions_box); ++ gtk_container_foreach(GTK_CONTAINER(windata->actions_box), ++ (GtkCallback)gtk_widget_destroy, NULL); ++} ++ ++/* Move notification window */ ++void ++move_notification(GtkWidget *nw, int x, int y) ++{ ++ WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata"); ++ g_assert(windata != NULL); ++ ++ gtk_window_move(GTK_WINDOW(nw), x, y); ++} ++ ++ ++/* Optional Functions */ ++ ++/* Destroy notification */ ++ ++/* Show notification */ ++ ++/* Hide notification */ ++ ++/* Set notification timeout */ ++void ++set_notification_timeout(GtkWindow *nw, glong timeout) ++{ ++ WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata"); ++ g_assert(windata != NULL); ++ ++ windata->timeout = timeout; ++} ++ ++/* Set notification hints */ ++void set_notification_hints(GtkWindow *nw, GVariant *hints) ++{ ++ WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata"); ++ GVariant *value = NULL, *icon_value = NULL; ++ ++ g_assert(windata != NULL); ++ ++ g_variant_lookup(hints, "urgency", "v", &value); ++ g_variant_lookup(hints, "action-icons", "v", &icon_value); ++ ++ if (value != NULL && g_variant_get_type(value) == G_VARIANT_TYPE_BYTE) ++ { ++ windata->urgency = g_variant_get_byte(value); ++ ++ if (windata->urgency == URGENCY_CRITICAL) { ++ gtk_window_set_title(GTK_WINDOW(nw), "Critical Notification"); ++ } else { ++ gtk_window_set_title(GTK_WINDOW(nw), "Notification"); ++ } ++ } ++ ++ /* Determine if action-icons have been requested */ ++ if (icon_value != NULL && g_variant_get_type(icon_value) == G_VARIANT_TYPE_BOOLEAN) ++ { ++ windata->action_icons = g_variant_get_boolean(icon_value); ++ } ++} ++ ++/* Notification tick */ ++void ++notification_tick(GtkWindow *nw, glong remaining) ++{ ++ WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata"); ++ windata->remaining = remaining; ++ ++ if (windata->pie_countdown != NULL) ++ { ++ gtk_widget_queue_draw_area(windata->pie_countdown, 0, 0, ++ PIE_WIDTH, PIE_HEIGHT); ++ } ++} +diff --git a/src/themes/kiran/kiran.gresource.xml b/src/themes/kiran/kiran.gresource.xml +new file mode 100644 +index 0000000..d177863 +--- /dev/null ++++ b/src/themes/kiran/kiran.gresource.xml +@@ -0,0 +1,9 @@ ++ ++ ++ ++ data/kiran.css ++ data/icons/close_hover.svg ++ data/icons/close_normal.svg ++ data/icons/close_press.svg ++ ++ +-- +2.27.0 + diff --git a/0001-fix-kiran-theme-Remove-the-blue-border-when-the-mous-e495941c.patch b/0001-fix-kiran-theme-Remove-the-blue-border-when-the-mous-e495941c.patch new file mode 100644 index 0000000..89a03f9 --- /dev/null +++ b/0001-fix-kiran-theme-Remove-the-blue-border-when-the-mous-e495941c.patch @@ -0,0 +1,37 @@ +From e495941ce3f0f68490cbee0c66c0bbfd23fb4a77 Mon Sep 17 00:00:00 2001 +From: yuanxing +Date: Tue, 25 May 2021 15:24:35 +0800 +Subject: [PATCH] fix(kiran theme):Remove the blue border when the mouse enters + the message box +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 当鼠标进入消息框时去掉蓝色边框效果 +--- + src/themes/kiran/kiran.c | 9 --------- + 1 file changed, 9 deletions(-) + +diff --git a/src/themes/kiran/kiran.c b/src/themes/kiran/kiran.c +index 732cb2e..7f6b9b1 100644 +--- a/src/themes/kiran/kiran.c ++++ b/src/themes/kiran/kiran.c +@@ -321,15 +321,6 @@ paint_window_when_pointer_enter(GtkWidget *widget, + fill_background_when_pointer_enter(widget, windata, cr2); + cairo_fill(cr2); + +- rounded_rectangle(cr2, 0, 0, windata->width, windata->height, 8); +- cairo_set_source_rgba(cr2, +- 40 / 255.0, +- 144 / 255.0, +- 216 / 255.0, +- 1.0); +- cairo_set_line_width(cr2, 4.0); +- cairo_stroke(cr2); +- + cairo_destroy(cr2); + + cairo_save(cr); +-- +2.27.0 + diff --git a/0001-fix-move-mate-notification-properties-from-menus.patch b/0001-fix-move-mate-notification-properties-from-menus.patch new file mode 100644 index 0000000..cbcac7c --- /dev/null +++ b/0001-fix-move-mate-notification-properties-from-menus.patch @@ -0,0 +1,27 @@ +From e20b79092905b16a46643d7a649ab500a05dc541 Mon Sep 17 00:00:00 2001 +From: yuanxing +Date: Mon, 20 Jul 2020 17:16:21 +0800 +Subject: [PATCH] fix: move mate-notification-properties from menus +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 将mate-notification-properties从开始菜单中移除 + +Fixes #28100 +--- + src/capplet/mate-notification-properties.desktop.in | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/capplet/mate-notification-properties.desktop.in b/src/capplet/mate-notification-properties.desktop.in +index b601603..42a3a84 100644 +--- a/src/capplet/mate-notification-properties.desktop.in ++++ b/src/capplet/mate-notification-properties.desktop.in +@@ -9,3 +9,4 @@ StartupNotify=true + Categories=GTK;Settings;DesktopSettings;X-System-Server;X-System-Server; + OnlyShowIn=MATE; + Keywords=MATE;Notification;Theme; ++X-KIRAN-NoDisplay=true +-- +2.18.1 + diff --git a/0001-mate-notification-daemon-change-bottom_right.patch b/0001-mate-notification-daemon-change-bottom_right.patch new file mode 100644 index 0000000..548c7f7 --- /dev/null +++ b/0001-mate-notification-daemon-change-bottom_right.patch @@ -0,0 +1,25 @@ +From 5d4603c894e260e9f98553c5ede7f5e197efa195 Mon Sep 17 00:00:00 2001 +From: mazhiguo +Date: Wed, 4 Sep 2019 23:44:46 -0400 +Subject: [PATCH] mate notification daemon change bottom_right + +--- + data/org.mate.NotificationDaemon.gschema.xml.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/data/org.mate.NotificationDaemon.gschema.xml.in b/data/org.mate.NotificationDaemon.gschema.xml.in +index c3c615b..fdac60a 100644 +--- a/data/org.mate.NotificationDaemon.gschema.xml.in ++++ b/data/org.mate.NotificationDaemon.gschema.xml.in +@@ -1,7 +1,7 @@ + + + +- 'top_right' ++ 'bottom_right' + Popup location + Default popup location on the workspace for stack notifications. Allowed values: "top_left","top_right","bottom_left" and "bottom_right" + +-- +2.18.1 + diff --git a/0001-notification-modify-categories-KY3.4.patch b/0001-notification-modify-categories-KY3.4.patch new file mode 100644 index 0000000..f231485 --- /dev/null +++ b/0001-notification-modify-categories-KY3.4.patch @@ -0,0 +1,24 @@ +From f4a306b98e0cf730ab60cc3ec198676f328aa2d2 Mon Sep 17 00:00:00 2001 +From: zhudongbo +Date: Thu, 19 Sep 2019 10:44:26 +0800 +Subject: [PATCH] notification modify categories + +--- + src/capplet/mate-notification-properties.desktop.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/capplet/mate-notification-properties.desktop.in b/src/capplet/mate-notification-properties.desktop.in +index 5a90f57..acdec6b 100644 +--- a/src/capplet/mate-notification-properties.desktop.in ++++ b/src/capplet/mate-notification-properties.desktop.in +@@ -6,6 +6,6 @@ Icon=mate-notification-properties + Terminal=false + Type=Application + StartupNotify=true +-Categories=GTK;Settings;DesktopSettings; ++Categories=GTK;Settings;DesktopSettings;X-System-Server; + OnlyShowIn=MATE; + Keywords=MATE;Notification;Theme; +-- +1.8.3.1 + diff --git a/0002-fix-UI-improve-css-style-of-notification-window-725faa6b.patch b/0002-fix-UI-improve-css-style-of-notification-window-725faa6b.patch new file mode 100644 index 0000000..b61c501 --- /dev/null +++ b/0002-fix-UI-improve-css-style-of-notification-window-725faa6b.patch @@ -0,0 +1,120 @@ +From 725faa6b7345e364dd46b80b8dd1ffdc96ae3870 Mon Sep 17 00:00:00 2001 +From: yuanxing +Date: Fri, 22 Jan 2021 17:12:46 +0800 +Subject: [PATCH 2/9] fix(UI):improve css style of notification window +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 完善消息框界面 +--- + src/themes/kiran/data/kiran.css | 23 ++++++++++++++++++----- + src/themes/kiran/kiran.c | 9 +++++---- + 2 files changed, 23 insertions(+), 9 deletions(-) + +diff --git a/src/themes/kiran/data/kiran.css b/src/themes/kiran/data/kiran.css +index 2f9123e..0e00f1c 100644 +--- a/src/themes/kiran/data/kiran.css ++++ b/src/themes/kiran/data/kiran.css +@@ -18,11 +18,12 @@ + #actions_label + { + color: #3197de; +- font-size: 12px; +- font-family: "PingFang SC Medium"; ++ font-size: 11px; ++ font-family: "Noto Sans CJK SC regular"; ++ padding: 0px; ++ text-shadow: none; + } + +- + /*********************Button****************************/ + + #actions_button,#actions_hbox +@@ -30,6 +31,7 @@ + padding:0px; + box-shadow:none; + margin:0px; ++ border: none; + } + + #actions_button:hover +@@ -73,7 +75,6 @@ + + #main_hbox + { +- /* background-color: yellow; */ + margin-right: 14px; + margin-bottom: 12px; + } +@@ -87,5 +88,17 @@ + + #text_vbox ,#action_vbox + { +- margin-top: 16px; ++ margin-top: 12px; ++} ++ ++ ++#action_vbox ++{ ++ border: none; ++} ++ ++ ++#actions_box ++{ ++ margin-right: 2px; + } +diff --git a/src/themes/kiran/kiran.c b/src/themes/kiran/kiran.c +index 9181e20..a99af72 100644 +--- a/src/themes/kiran/kiran.c ++++ b/src/themes/kiran/kiran.c +@@ -93,7 +93,7 @@ void set_notification_hints(GtkWindow *nw, GVariant *hints); + void notification_tick(GtkWindow *nw, glong remaining); + + #define STRIPE_WIDTH 32 +-#define WIDTH 270 ++#define WIDTH 380 + #define IMAGE_SIZE 32 + #define IMAGE_PADDING 10 + #define SPACER_LEFT 30 +@@ -160,7 +160,7 @@ fill_background(GtkWidget *widget, WindowData *windata, cairo_t *cr) + cairo_pattern_destroy (pattern); + + nodoka_rounded_rectangle (cr, 0, 0, windata->width, +- windata->height, 6); ++ windata->height, 8); + + cairo_fill (cr); + } +@@ -555,6 +555,7 @@ create_notification(UrlClickedCb url_clicked) + + set_css(windata->win); + gtk_widget_set_name(windata->win , "notification_window"); ++ gtk_widget_set_size_request(windata->win , WIDTH,70); + windata->rtl = gtk_widget_get_default_direction(); + windata->composited = FALSE; + screen = gtk_window_get_screen(GTK_WINDOW(win)); +@@ -598,7 +599,7 @@ create_notification(UrlClickedCb url_clicked) + gtk_widget_set_halign (windata->main_hbox, GTK_ALIGN_START); + gtk_widget_set_valign (windata->main_hbox, GTK_ALIGN_START); + gtk_widget_show (windata->main_hbox); +- gtk_box_pack_start (GTK_BOX(main_vbox), windata->main_hbox, FALSE, FALSE, 0); ++ gtk_box_pack_start (GTK_BOX(main_vbox), windata->main_hbox, FALSE, TRUE, 0); + + /* The icon goes at the left */ + windata->iconbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); +@@ -726,7 +727,7 @@ set_notification_text(GtkWindow *nw, const char *summary, const char *body) + gtk_widget_set_size_request( + ((body != NULL && *body != '\0') + ? windata->body_label : windata->summary_label), +- WIDTH - (IMAGE_SIZE + IMAGE_PADDING) - 10, ++ WIDTH - (IMAGE_SIZE + IMAGE_PADDING) - 60, + -1); + } + +-- +2.27.0 + diff --git a/0003-fix-UI-set-the-text-box-fill-the-extra-space-in-wind-19276cbc.patch b/0003-fix-UI-set-the-text-box-fill-the-extra-space-in-wind-19276cbc.patch new file mode 100644 index 0000000..ebb73ba --- /dev/null +++ b/0003-fix-UI-set-the-text-box-fill-the-extra-space-in-wind-19276cbc.patch @@ -0,0 +1,110 @@ +From 19276cbc3d1b205354390e75b209a521c098e8d0 Mon Sep 17 00:00:00 2001 +From: yuanxing +Date: Fri, 22 Jan 2021 18:33:56 +0800 +Subject: [PATCH 3/9] fix(UI):set the text box fill the extra space in window + when text is short +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 当文字很短时,将中间文字控件占满窗口额外的空间 + +Realated #33420 +--- + src/themes/kiran/data/kiran.css | 7 +++++++ + src/themes/kiran/kiran.c | 20 +++++++++++--------- + 2 files changed, 18 insertions(+), 9 deletions(-) + +diff --git a/src/themes/kiran/data/kiran.css b/src/themes/kiran/data/kiran.css +index 0e00f1c..b85dc2f 100644 +--- a/src/themes/kiran/data/kiran.css ++++ b/src/themes/kiran/data/kiran.css +@@ -95,10 +95,17 @@ + #action_vbox + { + border: none; ++ background-color: red; + } + + + #actions_box + { + margin-right: 2px; ++ background-color: purple; + } ++ ++#text_vbox ++{ ++ background-color: seagreen; ++} +\ No newline at end of file +diff --git a/src/themes/kiran/kiran.c b/src/themes/kiran/kiran.c +index a99af72..ac8d471 100644 +--- a/src/themes/kiran/kiran.c ++++ b/src/themes/kiran/kiran.c +@@ -94,13 +94,13 @@ void notification_tick(GtkWindow *nw, glong remaining); + + #define STRIPE_WIDTH 32 + #define WIDTH 380 +-#define IMAGE_SIZE 32 +-#define IMAGE_PADDING 10 ++#define IMAGE_SIZE 48 ++#define IMAGE_PADDING 12 + #define SPACER_LEFT 30 + #define PIE_RADIUS 7 + #define PIE_WIDTH (2 * PIE_RADIUS) + #define PIE_HEIGHT (2 * PIE_RADIUS) +-#define BODY_X_OFFSET (IMAGE_SIZE + 8) ++#define BODY_X_OFFSET (IMAGE_SIZE + 24) + #define DEFAULT_ARROW_OFFSET (SPACER_LEFT + 12) + #define DEFAULT_ARROW_HEIGHT 14 + #define DEFAULT_ARROW_WIDTH 22 +@@ -596,10 +596,10 @@ create_notification(UrlClickedCb url_clicked) + + windata->main_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + gtk_widget_set_name(windata->main_hbox , "main_hbox"); +- gtk_widget_set_halign (windata->main_hbox, GTK_ALIGN_START); ++ gtk_widget_set_halign (windata->main_hbox, GTK_ALIGN_FILL); + gtk_widget_set_valign (windata->main_hbox, GTK_ALIGN_START); + gtk_widget_show (windata->main_hbox); +- gtk_box_pack_start (GTK_BOX(main_vbox), windata->main_hbox, FALSE, TRUE, 0); ++ gtk_box_pack_start (GTK_BOX(main_vbox), windata->main_hbox, TRUE, TRUE, 0); + + /* The icon goes at the left */ + windata->iconbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); +@@ -616,9 +616,10 @@ create_notification(UrlClickedCb url_clicked) + /* The title and the text at the right */ + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + gtk_widget_set_name(vbox , "text_vbox"); +- gtk_widget_set_halign (vbox, GTK_ALIGN_START); ++ gtk_widget_set_halign (vbox, GTK_ALIGN_FILL); + gtk_widget_show (vbox); +- gtk_box_pack_start (GTK_BOX (windata->main_hbox), vbox, FALSE, FALSE, 0); ++ gtk_box_pack_start (GTK_BOX (windata->main_hbox), vbox, TRUE, TRUE, 0); ++ gtk_widget_set_hexpand (vbox, TRUE); + + + /* Add action_vbox*/ +@@ -681,7 +682,7 @@ create_notification(UrlClickedCb url_clicked) + gtk_label_set_line_wrap(GTK_LABEL(windata->body_label), TRUE); + gtk_label_set_line_wrap_mode (GTK_LABEL (windata->body_label), PANGO_WRAP_WORD_CHAR); + gtk_label_set_max_width_chars (GTK_LABEL (windata->body_label), 50); +- gtk_widget_set_vexpand (windata->body_label, FALSE); ++ gtk_widget_set_vexpand (windata->body_label, TRUE); + + g_signal_connect(G_OBJECT(windata->body_label), "activate-link", + G_CALLBACK(activate_link), windata); +@@ -727,8 +728,9 @@ set_notification_text(GtkWindow *nw, const char *summary, const char *body) + gtk_widget_set_size_request( + ((body != NULL && *body != '\0') + ? windata->body_label : windata->summary_label), +- WIDTH - (IMAGE_SIZE + IMAGE_PADDING) - 60, ++ WIDTH - (IMAGE_SIZE + IMAGE_PADDING*2) -40, + -1); ++ + } + + /* Set notification icon */ +-- +2.27.0 + diff --git a/0004-fix-ui-delete-some-unuseful-code-7e52eef1.patch b/0004-fix-ui-delete-some-unuseful-code-7e52eef1.patch new file mode 100644 index 0000000..e6deda3 --- /dev/null +++ b/0004-fix-ui-delete-some-unuseful-code-7e52eef1.patch @@ -0,0 +1,43 @@ +From 7e52eef1c3f19da057a93b1b2268c16c16e9a5df Mon Sep 17 00:00:00 2001 +From: yuanxing +Date: Fri, 22 Jan 2021 18:39:20 +0800 +Subject: [PATCH 4/9] fix(ui):delete some unuseful code +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 删除一些没用的文字 +--- + src/themes/kiran/data/kiran.css | 9 --------- + 1 file changed, 9 deletions(-) + +diff --git a/src/themes/kiran/data/kiran.css b/src/themes/kiran/data/kiran.css +index b85dc2f..c1017d2 100644 +--- a/src/themes/kiran/data/kiran.css ++++ b/src/themes/kiran/data/kiran.css +@@ -91,21 +91,12 @@ + margin-top: 12px; + } + +- + #action_vbox + { + border: none; +- background-color: red; + } + +- + #actions_box + { + margin-right: 2px; +- background-color: purple; +-} +- +-#text_vbox +-{ +- background-color: seagreen; + } +\ No newline at end of file +-- +2.27.0 + diff --git a/0005-fix-generate-resource.mk-file-to-ensure-generate-gre-017d2922.patch b/0005-fix-generate-resource.mk-file-to-ensure-generate-gre-017d2922.patch new file mode 100644 index 0000000..06a70a7 --- /dev/null +++ b/0005-fix-generate-resource.mk-file-to-ensure-generate-gre-017d2922.patch @@ -0,0 +1,57 @@ +From 017d2922f54cbc5b7caa05ae002d83ffdcffa9b4 Mon Sep 17 00:00:00 2001 +From: yuanxing +Date: Tue, 26 Jan 2021 23:55:56 +0800 +Subject: [PATCH 5/9] fix:generate resource.mk file to ensure generate + gresource.h file +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 生成resource.mk文件,确保能够编译生成gresource.h文件 +--- + src/themes/kiran/Makefile.am | 19 +++++++++++++------ + 1 file changed, 13 insertions(+), 6 deletions(-) + +diff --git a/src/themes/kiran/Makefile.am b/src/themes/kiran/Makefile.am +index fcb1626..c3f0494 100644 +--- a/src/themes/kiran/Makefile.am ++++ b/src/themes/kiran/Makefile.am +@@ -8,21 +8,28 @@ GLIB_COMPILE_RESOURCE=glib-compile-resources + + AM_CPPFLAGS = $(THEME_CFLAGS) + +-gresource.c: $(RESOURCE_XML) +- $(GLIB_COMPILE_RESOURCE) --target $@ $< --generate --c-name kiran ++$(RESOURCE_XML): data/kiran.css data/icons/close_hover.svg data/icons/close_normal.svg data/icons/close_press.svg ++ @touch $@ + + gresource.h: $(RESOURCE_XML) + $(GLIB_COMPILE_RESOURCE) --target $@ $< --generate --c-name kiran + +-libkiran_la_SOURCES = kiran.c gresource.c gresource.h ++gresource.c: $(RESOURCE_XML) gresource.h ++ $(GLIB_COMPILE_RESOURCE) --target $@ $< --generate --c-name kiran ++ ++kiran.c: gresource.h ++ ++libkiran_la_SOURCES = kiran.c ++nodist_libkiran_la_SOURCES=gresource.c + + libkiran_la_LDFLAGS = -module -avoid-version -no-undefined + libkiran_la_LIBADD = \ + $(THEME_LIBS) \ + $(NULL) + ++EXTRA_DIST = data/kiran.css data/icons/close_hover.svg data/icons/close_normal.svg data/icons/close_press.svg $(RESOURCE_XML) ++ + -include $(top_srcdir)/git.mk + +-.PHONY :clean +-clean: +- rm -f gresource.c gresource.h +\ No newline at end of file ++clean-local: ++ rm -f gresource.h gresource.c +-- +2.27.0 + diff --git a/0006-fix-themes-change-the-default-theme-to-kiran-89a7d9a1.patch b/0006-fix-themes-change-the-default-theme-to-kiran-89a7d9a1.patch new file mode 100644 index 0000000..5479551 --- /dev/null +++ b/0006-fix-themes-change-the-default-theme-to-kiran-89a7d9a1.patch @@ -0,0 +1,72 @@ +From 89a7d9a149cf2902723df154479fb184eea26e4d Mon Sep 17 00:00:00 2001 +From: yuanxing +Date: Wed, 27 Jan 2021 14:16:12 +0800 +Subject: [PATCH 6/9] fix(themes):change the default theme to kiran +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 将默认的消息主题修改为kiran +--- + data/org.mate.NotificationDaemon.gschema.xml.in | 2 +- + src/capplet/mate-notification-properties.c | 10 +++++----- + src/themes/kiran/kiran.c | 2 +- + 3 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/data/org.mate.NotificationDaemon.gschema.xml.in b/data/org.mate.NotificationDaemon.gschema.xml.in +index fdac60a..c5c4009 100644 +--- a/data/org.mate.NotificationDaemon.gschema.xml.in ++++ b/data/org.mate.NotificationDaemon.gschema.xml.in +@@ -16,7 +16,7 @@ + Monitor to display the notification. Allowed values: -1 (display on active monitor) and 0 to n - 1 where n is the number of monitors. + + +- 'nodoka' ++ 'kiran' + Current theme + The theme used when displaying notifications. + +diff --git a/src/capplet/mate-notification-properties.c b/src/capplet/mate-notification-properties.c +index 09b6643..42066b0 100644 +--- a/src/capplet/mate-notification-properties.c ++++ b/src/capplet/mate-notification-properties.c +@@ -324,7 +324,11 @@ static void notification_properties_dialog_setup_themes(NotificationAppletDialog + theme_name = get_theme_name(filename); + + /* FIXME: other solution than hardcode? */ +- if (g_str_equal(theme_name, "coco")) ++ if(g_str_equal(theme_name, "kiran")) ++ { ++ theme_label = g_strdup(_("Kiran")); ++ } ++ else if (g_str_equal(theme_name, "coco")) + { + theme_label = g_strdup(_("Coco")); + } +@@ -340,10 +344,6 @@ static void notification_properties_dialog_setup_themes(NotificationAppletDialog + { + theme_label = g_strdup(_("Standard theme")); + } +- else if (g_str_equal(theme_name, "kiran")) +- { +- theme_label = g_strdup(_("Kiran")); +- } + else + { + theme_label = g_strdup(theme_name); +diff --git a/src/themes/kiran/kiran.c b/src/themes/kiran/kiran.c +index ac8d471..165b03c 100644 +--- a/src/themes/kiran/kiran.c ++++ b/src/themes/kiran/kiran.c +@@ -728,7 +728,7 @@ set_notification_text(GtkWindow *nw, const char *summary, const char *body) + gtk_widget_set_size_request( + ((body != NULL && *body != '\0') + ? windata->body_label : windata->summary_label), +- WIDTH - (IMAGE_SIZE + IMAGE_PADDING*2) -40, ++ WIDTH - (IMAGE_SIZE + IMAGE_PADDING*2) -80, + -1); + + } +-- +2.27.0 + diff --git a/0007-fix-themes-change-the-first-option-to-kiran-in-mate--0fa4d5ba.patch b/0007-fix-themes-change-the-first-option-to-kiran-in-mate--0fa4d5ba.patch new file mode 100644 index 0000000..686b23e --- /dev/null +++ b/0007-fix-themes-change-the-first-option-to-kiran-in-mate--0fa4d5ba.patch @@ -0,0 +1,26 @@ +From 0fa4d5baaad75c311dc3d69ebe68ad529e23c7e3 Mon Sep 17 00:00:00 2001 +From: yuanxing +Date: Wed, 27 Jan 2021 14:36:28 +0800 +Subject: [PATCH 7/9] fix(themes):change the first option to kiran in + mate-notification-properties +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 在mate-notification-properties中修改第一个主题选项为kiran +--- + src/themes/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/themes/Makefile.am b/src/themes/Makefile.am +index 99df82a..645c3ff 100644 +--- a/src/themes/Makefile.am ++++ b/src/themes/Makefile.am +@@ -1,3 +1,3 @@ +-SUBDIRS = coco nodoka slider standard kiran ++SUBDIRS = kiran coco nodoka slider standard + + -include $(top_srcdir)/git.mk +-- +2.27.0 + diff --git a/0008-fix-theme-adjust-the-code-indent-and-remove-the-usel-3f451b70.patch b/0008-fix-theme-adjust-the-code-indent-and-remove-the-usel-3f451b70.patch new file mode 100644 index 0000000..0cd56fc --- /dev/null +++ b/0008-fix-theme-adjust-the-code-indent-and-remove-the-usel-3f451b70.patch @@ -0,0 +1,220 @@ +From 3f451b70099b93ff46d7b91dc4ddfa4541ac8646 Mon Sep 17 00:00:00 2001 +From: yuanxing +Date: Thu, 28 Jan 2021 10:49:44 +0800 +Subject: [PATCH 8/9] fix(theme):adjust the code indent and remove the useless + code +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 调整代码缩进,并且去掉无用的代码 +--- + src/themes/kiran/kiran.c | 101 ++++++++++++++++----------------------- + 1 file changed, 42 insertions(+), 59 deletions(-) + +diff --git a/src/themes/kiran/kiran.c b/src/themes/kiran/kiran.c +index 165b03c..7858d52 100644 +--- a/src/themes/kiran/kiran.c ++++ b/src/themes/kiran/kiran.c +@@ -127,7 +127,7 @@ destroy_windata(WindowData *windata) + /* Draw fuctions */ + /* Standard rounded rectangle */ + static void +-nodoka_rounded_rectangle (cairo_t * cr, ++rounded_rectangle (cairo_t * cr, + double x, double y, double w, double h, + int radius) + { +@@ -159,7 +159,7 @@ fill_background(GtkWidget *widget, WindowData *windata, cairo_t *cr) + cairo_set_source (cr, pattern); + cairo_pattern_destroy (pattern); + +- nodoka_rounded_rectangle (cr, 0, 0, windata->width, ++ rounded_rectangle (cr, 0, 0, windata->width, + windata->height, 8); + + cairo_fill (cr); +@@ -189,7 +189,7 @@ fill_background_when_pointer_enter(GtkWidget *widget, WindowData *windata, cairo + cairo_set_source (cr, pattern); + cairo_pattern_destroy (pattern); + +- nodoka_rounded_rectangle (cr, 0, 0, windata->width, ++ rounded_rectangle (cr, 0, 0, windata->width, + windata->height, 8); + + cairo_fill (cr); +@@ -311,8 +311,8 @@ paint_window_when_pointer_enter(GtkWidget *widget, + + fill_background_when_pointer_enter(widget, windata, cr2); + cairo_fill (cr2); +- +- nodoka_rounded_rectangle (cr2, 0, 0, windata->width , windata->height, 8); ++ ++ rounded_rectangle (cr2, 0, 0, windata->width , windata->height, 8); + cairo_set_source_rgba (cr2, 40/255.0, 144/255.0, 216/255.0, 1.0); + cairo_set_line_width (cr2, 4.0); + cairo_stroke (cr2); +@@ -340,7 +340,7 @@ static gboolean + on_draw (GtkWidget *widget, cairo_t *cr, WindowData *windata) + { + GtkStateFlags flags = gtk_widget_get_state_flags(windata->win); +- if (flags & GTK_STATE_FLAG_PRELIGHT) ++ if (flags & GTK_STATE_FLAG_PRELIGHT) + { + paint_window_when_pointer_enter(widget , cr , windata); + } +@@ -351,19 +351,6 @@ on_draw (GtkWidget *widget, cairo_t *cr, WindowData *windata) + return FALSE; + } + +-static gboolean +-configure_event_cb(GtkWidget *nw, +- GdkEventConfigure *event, +- WindowData *windata) +-{ +- windata->width = event->width; +- windata->height = event->height; +- +- gtk_widget_queue_draw(nw); +- +- return FALSE; +-} +- + static gboolean + countdown_expose_cb(GtkWidget *pie, + cairo_t *cr, +@@ -387,7 +374,7 @@ countdown_expose_cb(GtkWidget *pie, + cairo_translate (cr2, -alloc.x, -alloc.y); + + GtkStateFlags flags = gtk_widget_get_state_flags(windata->win); +- if (flags & GTK_STATE_FLAG_PRELIGHT) ++ if (flags & GTK_STATE_FLAG_PRELIGHT) + { + fill_background_when_pointer_enter(pie, windata ,cr2); + } +@@ -433,44 +420,43 @@ static void on_composited_changed (GtkWidget* window, WindowData* windata) + */ + GdkFilterReturn event_filter(GdkXEvent *xevent, GdkEvent *event, gpointer userdata) + { +- XEvent *x_event = (XEvent*)xevent; ++ XEvent *x_event = (XEvent*)xevent; + XGenericEvent *general_event = (XGenericEvent*)x_event; + GtkWidget *window = GTK_WIDGET(userdata); +- +- switch(x_event->type) { +- case EnterNotify: +- gtk_widget_set_state_flags(window, GTK_STATE_FLAG_PRELIGHT, FALSE); +- gtk_widget_queue_draw(window); +- break; +- case LeaveNotify: +- gtk_widget_set_state_flags(window, gtk_widget_get_state_flags(window) & ~GTK_STATE_FLAG_PRELIGHT, TRUE); +- gtk_widget_queue_draw(window); +- break; +- case GenericEvent: +- do +- { +- if (general_event->evtype == EnterNotify) { +- gtk_widget_set_state_flags(window, GTK_STATE_FLAG_PRELIGHT, FALSE); +- gtk_widget_queue_draw(window); +- } +- +- if (general_event->evtype == LeaveNotify) { +- gtk_widget_set_state_flags(window, gtk_widget_get_state_flags(window) & ~GTK_STATE_FLAG_PRELIGHT, TRUE); +- gtk_widget_queue_draw(window); +- } +- }while(0); +- break; +- default: +- break; +- } +- return GDK_FILTER_CONTINUE; ++ switch(x_event->type) { ++ case EnterNotify: ++ gtk_widget_set_state_flags(window, GTK_STATE_FLAG_PRELIGHT, FALSE); ++ gtk_widget_queue_draw(window); ++ break; ++ case LeaveNotify: ++ gtk_widget_set_state_flags(window, gtk_widget_get_state_flags(window) & ~GTK_STATE_FLAG_PRELIGHT, TRUE); ++ gtk_widget_queue_draw(window); ++ break; ++ case GenericEvent: ++ do ++ { ++ if (general_event->evtype == EnterNotify) { ++ gtk_widget_set_state_flags(window, GTK_STATE_FLAG_PRELIGHT, FALSE); ++ gtk_widget_queue_draw(window); ++ } ++ ++ if (general_event->evtype == LeaveNotify) { ++ gtk_widget_set_state_flags(window, gtk_widget_get_state_flags(window) & ~GTK_STATE_FLAG_PRELIGHT, TRUE); ++ gtk_widget_queue_draw(window); ++ } ++ }while(0); ++ break; ++ default: ++ break; ++ } ++ return GDK_FILTER_CONTINUE; + } + + static void + on_realize(GtkWidget *widget , gpointer userdata ) + { +- GdkWindow *window = gtk_widget_get_window(widget); +- gdk_window_add_filter(window, event_filter, widget); ++ GdkWindow *window = gtk_widget_get_window(widget); ++ gdk_window_add_filter(window, event_filter, widget); + } + + +@@ -513,7 +499,7 @@ get_theme_info(char **theme_name, + static void + set_css(GtkWidget* widget) + { +- GtkCssProvider *provider = gtk_css_provider_new (); ++ GtkCssProvider *provider = gtk_css_provider_new (); + + gtk_css_provider_load_from_resource (provider, "/kiran/themes/kiran.css"); + gtk_style_context_add_provider_for_screen (gtk_widget_get_screen(widget), +@@ -579,9 +565,6 @@ create_notification(UrlClickedCb url_clicked) + (GDestroyNotify)destroy_windata); + atk_object_set_role(gtk_widget_get_accessible(win), ATK_ROLE_ALERT); + +- g_signal_connect(G_OBJECT(win), "configure_event", +- G_CALLBACK(configure_event_cb), windata); +- + main_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); + gtk_widget_set_name(main_vbox , "main_vbox"); + gtk_widget_show(main_vbox); +@@ -681,7 +664,7 @@ create_notification(UrlClickedCb url_clicked) + gtk_label_set_yalign (GTK_LABEL (windata->body_label), 0.0); + gtk_label_set_line_wrap(GTK_LABEL(windata->body_label), TRUE); + gtk_label_set_line_wrap_mode (GTK_LABEL (windata->body_label), PANGO_WRAP_WORD_CHAR); +- gtk_label_set_max_width_chars (GTK_LABEL (windata->body_label), 50); ++ gtk_label_set_max_width_chars (GTK_LABEL (windata->body_label), 50); + gtk_widget_set_vexpand (windata->body_label, TRUE); + + g_signal_connect(G_OBJECT(windata->body_label), "activate-link", +@@ -776,7 +759,7 @@ add_notification_action(GtkWindow *nw, const char *text, const char *key, + char *buf; + + g_assert(windata != NULL); +- ++ + if (gtk_widget_get_visible(windata->actions_box)) + { + gtk_widget_show(windata->actions_box); +@@ -870,8 +853,8 @@ move_notification(GtkWidget *nw, int x, int y) + { + WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata"); + g_assert(windata != NULL); +- +- gtk_window_move(GTK_WINDOW(nw), x, y); ++ ++ gtk_window_move(GTK_WINDOW(nw), x, y); + } + + +-- +2.27.0 + diff --git a/0009-fix-theme-change-the-indent-of-kiran.c-and-add-notes-c35de938.patch b/0009-fix-theme-change-the-indent-of-kiran.c-and-add-notes-c35de938.patch new file mode 100644 index 0000000..a714430 --- /dev/null +++ b/0009-fix-theme-change-the-indent-of-kiran.c-and-add-notes-c35de938.patch @@ -0,0 +1,1187 @@ +From c35de938c793867a67d2297b209cc27805f9f527 Mon Sep 17 00:00:00 2001 +From: yuanxing +Date: Thu, 28 Jan 2021 20:07:09 +0800 +Subject: [PATCH 9/9] fix(theme):change the indent of kiran.c and add notes +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 修改kiran.c的缩进并且添加注释 +--- + src/daemon/daemon.c | 7 +- + src/themes/kiran/kiran.c | 701 ++++++++++++++++++++------------------- + 2 files changed, 365 insertions(+), 343 deletions(-) + +diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c +index 3ee2266..44572e3 100644 +--- a/src/daemon/daemon.c ++++ b/src/daemon/daemon.c +@@ -1351,7 +1351,12 @@ static gboolean notify_daemon_notify_handler(NotifyDaemonNotifications *object, + { + theme_clear_notification_actions (nw); + } +- ++ ++ /* ++ * Change the order of the following two statements: ++ * First set the message hints, then set the message content. ++ * If summary is not set, summary can be set according to hints ++ */ + theme_set_notification_hints (nw, hints); + theme_set_notification_text (nw, summary, body); + +diff --git a/src/themes/kiran/kiran.c b/src/themes/kiran/kiran.c +index 7858d52..732cb2e 100644 +--- a/src/themes/kiran/kiran.c ++++ b/src/themes/kiran/kiran.c +@@ -1,25 +1,7 @@ + /* + * kiran.c +- * This file is part of notification-daemon-engine-kiran +- * +- * Copyright (C) 2012 - Stefano Karapetsas +- * Copyright (C) 2010 - Eduardo Grajeda +- * Copyright (C) 2008 - Martin Sourada +- * +- * notification-daemon-engine-kiran is free software; you can redistribute it +- * and/or modify it under the terms of the GNU General Public License as +- * published by the Free Software Foundation; either version 3 of the License, +- * or (at your option) any later version. +- * +- * notification-daemon-engine-kiran is distributed in the hope that it will be +- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with notification-daemon-engine-kiran; if not, write to the Free +- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, +- * Boston, MA 02110-1301 USA ++ * A theme of notification ++ * Copyright ©2020 KylinSec. All rights reserved. + */ + + #include "config.h" +@@ -67,7 +49,6 @@ typedef struct + GtkTextDirection rtl; + } WindowData; + +- + enum + { + URGENCY_LOW, +@@ -76,45 +57,45 @@ enum + }; + + gboolean theme_check_init(unsigned int major_ver, unsigned int minor_ver, +- unsigned int micro_ver); ++ unsigned int micro_ver); + void get_theme_info(char **theme_name, char **theme_ver, char **author, +- char **homepage); +-GtkWindow* create_notification(UrlClickedCb url_clicked); ++ char **homepage); ++GtkWindow *create_notification(UrlClickedCb url_clicked); + void set_notification_text(GtkWindow *nw, const char *summary, +- const char *body); ++ const char *body); + void set_notification_icon(GtkWindow *nw, GdkPixbuf *pixbuf); + void set_notification_arrow(GtkWidget *nw, gboolean visible, int x, int y); + void add_notification_action(GtkWindow *nw, const char *text, const char *key, +- ActionInvokedCb cb); ++ ActionInvokedCb cb); + void clear_notification_actions(GtkWindow *nw); + void move_notification(GtkWidget *nw, int x, int y); + void set_notification_timeout(GtkWindow *nw, glong timeout); + void set_notification_hints(GtkWindow *nw, GVariant *hints); + void notification_tick(GtkWindow *nw, glong remaining); + +-#define STRIPE_WIDTH 32 +-#define WIDTH 380 +-#define IMAGE_SIZE 48 ++#define STRIPE_WIDTH 32 ++#define WIDTH 380 ++#define IMAGE_SIZE 48 + #define IMAGE_PADDING 12 +-#define SPACER_LEFT 30 +-#define PIE_RADIUS 7 +-#define PIE_WIDTH (2 * PIE_RADIUS) +-#define PIE_HEIGHT (2 * PIE_RADIUS) ++#define SPACER_LEFT 30 ++#define PIE_RADIUS 7 ++#define PIE_WIDTH (2 * PIE_RADIUS) ++#define PIE_HEIGHT (2 * PIE_RADIUS) + #define BODY_X_OFFSET (IMAGE_SIZE + 24) +-#define DEFAULT_ARROW_OFFSET (SPACER_LEFT + 12) +-#define DEFAULT_ARROW_HEIGHT 14 +-#define DEFAULT_ARROW_WIDTH 22 +-#define DEFAULT_ARROW_SKEW -6 +-#define BACKGROUND_OPACITY 1.0 ++#define DEFAULT_ARROW_OFFSET (SPACER_LEFT + 12) ++#define DEFAULT_ARROW_HEIGHT 14 ++#define DEFAULT_ARROW_WIDTH 22 ++#define DEFAULT_ARROW_SKEW -6 ++#define BACKGROUND_OPACITY 1.0 + #define GRADIENT_CENTER 0.7 + + /* Support Nodoka Functions */ + + /* Handle clicking on link */ + static gboolean +-activate_link (GtkLabel *label, const char *url, WindowData *windata) ++activate_link(GtkLabel *label, const char *url, WindowData *windata) + { +- windata->url_clicked (GTK_WINDOW (windata->win), url); ++ windata->url_clicked(GTK_WINDOW(windata->win), url); + return TRUE; + } + +@@ -127,15 +108,18 @@ destroy_windata(WindowData *windata) + /* Draw fuctions */ + /* Standard rounded rectangle */ + static void +-rounded_rectangle (cairo_t * cr, +- double x, double y, double w, double h, +- int radius) ++rounded_rectangle(cairo_t *cr, ++ double x, ++ double y, ++ double w, ++ double h, ++ int radius) + { +- cairo_move_to (cr, x + radius, y); +- cairo_arc (cr, x + w - radius, y + radius, radius, G_PI * 1.5, G_PI * 2); +- cairo_arc (cr, x + w - radius, y + h - radius, radius, 0, G_PI * 0.5); +- cairo_arc (cr, x + radius, y + h - radius, radius, G_PI * 0.5, G_PI); +- cairo_arc (cr, x + radius, y + radius, radius, G_PI, G_PI * 1.5); ++ cairo_move_to(cr, x + radius, y); ++ cairo_arc(cr, x + w - radius, y + radius, radius, G_PI * 1.5, G_PI * 2); ++ cairo_arc(cr, x + w - radius, y + h - radius, radius, 0, G_PI * 0.5); ++ cairo_arc(cr, x + radius, y + h - radius, radius, G_PI * 0.5, G_PI); ++ cairo_arc(cr, x + radius, y + radius, radius, G_PI, G_PI * 1.5); + } + + /* Fill background */ +@@ -149,23 +133,33 @@ fill_background(GtkWidget *widget, WindowData *windata, cairo_t *cr) + alpha = 1.0; + + cairo_pattern_t *pattern; +- pattern = cairo_pattern_create_linear (0, 0, 0, windata->height); +- cairo_pattern_add_color_stop_rgba (pattern, 0, +- 34/255.0, 34/255.0, 34/255.0, alpha); +- cairo_pattern_add_color_stop_rgba (pattern, GRADIENT_CENTER, +- 34/255.0, 34/255.0, 34/255.0, alpha); +- cairo_pattern_add_color_stop_rgba (pattern, 1, +- 34/255.0, 34/255.0, 34/255.0, alpha); +- cairo_set_source (cr, pattern); +- cairo_pattern_destroy (pattern); +- +- rounded_rectangle (cr, 0, 0, windata->width, +- windata->height, 8); +- +- cairo_fill (cr); ++ pattern = cairo_pattern_create_linear(0, 0, 0, windata->height); ++ cairo_pattern_add_color_stop_rgba(pattern, ++ 0, ++ 34 / 255.0, ++ 34 / 255.0, ++ 34 / 255.0, ++ alpha); ++ cairo_pattern_add_color_stop_rgba(pattern, ++ GRADIENT_CENTER, ++ 34 / 255.0, ++ 34 / 255.0, ++ 34 / 255.0, ++ alpha); ++ cairo_pattern_add_color_stop_rgba(pattern, ++ 1, ++ 34 / 255.0, ++ 34 / 255.0, ++ 34 / 255.0, ++ alpha); ++ cairo_set_source(cr, pattern); ++ cairo_pattern_destroy(pattern); ++ ++ rounded_rectangle(cr, 0, 0, windata->width, windata->height, 8); ++ ++ cairo_fill(cr); + } + +- + /** + * @brief 当鼠标进入消息框窗体时,重绘背景 + */ +@@ -179,20 +173,31 @@ fill_background_when_pointer_enter(GtkWidget *widget, WindowData *windata, cairo + alpha = 1.0; + + cairo_pattern_t *pattern; +- pattern = cairo_pattern_create_linear (0, 0, 0, windata->height); +- cairo_pattern_add_color_stop_rgba (pattern, 0, +- 51/255.0, 51/255.0, 51/255.0, alpha); +- cairo_pattern_add_color_stop_rgba (pattern, GRADIENT_CENTER, +- 51/255.0, 51/255.0, 51/255.0, alpha); +- cairo_pattern_add_color_stop_rgba (pattern, 1, +- 51/255.0, 51/255.0, 51/255.0, alpha); +- cairo_set_source (cr, pattern); +- cairo_pattern_destroy (pattern); +- +- rounded_rectangle (cr, 0, 0, windata->width, +- windata->height, 8); +- +- cairo_fill (cr); ++ pattern = cairo_pattern_create_linear(0, 0, 0, windata->height); ++ cairo_pattern_add_color_stop_rgba(pattern, ++ 0, ++ 51 / 255.0, ++ 51 / 255.0, ++ 51 / 255.0, ++ alpha); ++ cairo_pattern_add_color_stop_rgba(pattern, ++ GRADIENT_CENTER, ++ 51 / 255.0, ++ 51 / 255.0, ++ 51 / 255.0, ++ alpha); ++ cairo_pattern_add_color_stop_rgba(pattern, ++ 1, ++ 51 / 255.0, ++ 51 / 255.0, ++ 51 / 255.0, ++ alpha); ++ cairo_set_source(cr, pattern); ++ cairo_pattern_destroy(pattern); ++ ++ rounded_rectangle(cr, 0, 0, windata->width, windata->height, 8); ++ ++ cairo_fill(cr); + } + + static void +@@ -202,18 +207,23 @@ draw_pie(GtkWidget *pie, WindowData *windata, cairo_t *cr) + return; + + gdouble arc_angle = 1.0 - (gdouble)windata->remaining / (gdouble)windata->timeout; +- cairo_set_source_rgba (cr, 92/255.0, 92/255.0, 92/255.0, 1); ++ cairo_set_source_rgba(cr, ++ 92 / 255.0, ++ 92 / 255.0, ++ 92 / 255.0, 1); + cairo_move_to(cr, PIE_RADIUS, PIE_RADIUS); +- cairo_arc_negative(cr, PIE_RADIUS, PIE_RADIUS, PIE_RADIUS, +- -G_PI/2, (-0.25 + arc_angle)*2*G_PI); ++ cairo_arc_negative(cr, ++ PIE_RADIUS, PIE_RADIUS, ++ PIE_RADIUS, ++ -G_PI / 2, (-0.25 + arc_angle) * 2 * G_PI); + cairo_line_to(cr, PIE_RADIUS, PIE_RADIUS); +- +- cairo_fill (cr); ++ ++ cairo_fill(cr); + } + + static void +-update_shape_region (cairo_surface_t *surface, +- WindowData *windata) ++update_shape_region(cairo_surface_t *surface, ++ WindowData *windata) + { + if (windata->width == windata->last_width && windata->height == windata->last_height) + { +@@ -223,20 +233,23 @@ update_shape_region (cairo_surface_t *surface, + if (windata->width == 0 || windata->height == 0) + { + GtkAllocation allocation; +- gtk_widget_get_allocation (windata->win, &allocation); ++ gtk_widget_get_allocation(windata->win, &allocation); + +- windata->width = MAX (allocation.width, 1); +- windata->height = MAX (allocation.height, 1); ++ windata->width = MAX(allocation.width, 1); ++ windata->height = MAX(allocation.height, 1); + } + +- if (!windata->composited) { ++ if (!windata->composited) ++ { + cairo_region_t *region; + +- region = gdk_cairo_region_create_from_surface (surface); +- gtk_widget_shape_combine_region (windata->win, region); +- cairo_region_destroy (region); +- } else { +- gtk_widget_shape_combine_region (windata->win, NULL); ++ region = gdk_cairo_region_create_from_surface(surface); ++ gtk_widget_shape_combine_region(windata->win, region); ++ cairo_region_destroy(region); ++ } ++ else ++ { ++ gtk_widget_shape_combine_region(windata->win, NULL); + return; + } + +@@ -245,14 +258,15 @@ update_shape_region (cairo_surface_t *surface, + } + + static void +-paint_window (GtkWidget *widget, +- cairo_t *cr, +- WindowData *windata) ++paint_window(GtkWidget *widget, ++ cairo_t *cr, ++ WindowData *windata) + { + cairo_surface_t *surface; + cairo_t *cr2; + +- if (windata->width == 0 || windata->height == 0) { ++ if (windata->width == 0 || windata->height == 0) ++ { + GtkAllocation allocation; + + gtk_widget_get_allocation(windata->win, &allocation); +@@ -260,41 +274,39 @@ paint_window (GtkWidget *widget, + windata->height = allocation.height; + } + +- surface = cairo_surface_create_similar(cairo_get_target(cr), +- CAIRO_CONTENT_COLOR_ALPHA, +- windata->width, +- windata->height); ++ surface = cairo_surface_create_similar(cairo_get_target(cr), CAIRO_CONTENT_COLOR_ALPHA, windata->width, windata->height); + +- cr2 = cairo_create (surface); ++ cr2 = cairo_create(surface); + fill_background(widget, windata, cr2); +- cairo_fill (cr2); ++ cairo_fill(cr2); ++ ++ cairo_destroy(cr2); + +- cairo_destroy (cr2); ++ cairo_save(cr); + +- cairo_save (cr); +- +- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); +- cairo_set_source_surface (cr, surface, 0, 0); +- cairo_paint (cr); +- cairo_restore (cr); ++ cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); ++ cairo_set_source_surface(cr, surface, 0, 0); ++ cairo_paint(cr); ++ cairo_restore(cr); + +- update_shape_region (surface, windata); ++ update_shape_region(surface, windata); + +- cairo_surface_destroy (surface); ++ cairo_surface_destroy(surface); + } + + /** + * @brief 当鼠标进入消息框窗体时,给窗体加上边框 + */ + static void +-paint_window_when_pointer_enter(GtkWidget *widget, +- cairo_t *cr, +- WindowData *windata) ++paint_window_when_pointer_enter(GtkWidget *widget, ++ cairo_t *cr, ++ WindowData *windata) + { + cairo_surface_t *surface; + cairo_t *cr2; + +- if (windata->width == 0 || windata->height == 0) { ++ if (windata->width == 0 || windata->height == 0) ++ { + GtkAllocation allocation; + + gtk_widget_get_allocation(windata->win, &allocation); +@@ -302,34 +314,34 @@ paint_window_when_pointer_enter(GtkWidget *widget, + windata->height = allocation.height; + } + +- surface = cairo_surface_create_similar(cairo_get_target(cr), +- CAIRO_CONTENT_COLOR_ALPHA, +- windata->width, +- windata->height); ++ surface = cairo_surface_create_similar(cairo_get_target(cr), CAIRO_CONTENT_COLOR_ALPHA, windata->width, windata->height); + +- cr2 = cairo_create (surface); ++ cr2 = cairo_create(surface); + + fill_background_when_pointer_enter(widget, windata, cr2); +- cairo_fill (cr2); +- +- rounded_rectangle (cr2, 0, 0, windata->width , windata->height, 8); +- cairo_set_source_rgba (cr2, 40/255.0, 144/255.0, 216/255.0, 1.0); +- cairo_set_line_width (cr2, 4.0); +- cairo_stroke (cr2); ++ cairo_fill(cr2); + +- cairo_destroy (cr2); ++ rounded_rectangle(cr2, 0, 0, windata->width, windata->height, 8); ++ cairo_set_source_rgba(cr2, ++ 40 / 255.0, ++ 144 / 255.0, ++ 216 / 255.0, ++ 1.0); ++ cairo_set_line_width(cr2, 4.0); ++ cairo_stroke(cr2); + +- cairo_save (cr); +- +- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); +- cairo_set_source_surface (cr, surface, 0, 0); +- cairo_paint (cr); +- cairo_restore (cr); ++ cairo_destroy(cr2); + +- update_shape_region (surface, windata); ++ cairo_save(cr); + +- cairo_surface_destroy (surface); ++ cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); ++ cairo_set_source_surface(cr, surface, 0, 0); ++ cairo_paint(cr); ++ cairo_restore(cr); + ++ update_shape_region(surface, windata); ++ ++ cairo_surface_destroy(surface); + } + + /* Event handlers */ +@@ -337,16 +349,16 @@ paint_window_when_pointer_enter(GtkWidget *widget, + * @brief "draw"回调函数:根据窗体当前状态,判断绘制成鼠标移入样式 + */ + static gboolean +-on_draw (GtkWidget *widget, cairo_t *cr, WindowData *windata) ++on_draw(GtkWidget *widget, cairo_t *cr, WindowData *windata) + { + GtkStateFlags flags = gtk_widget_get_state_flags(windata->win); + if (flags & GTK_STATE_FLAG_PRELIGHT) + { +- paint_window_when_pointer_enter(widget , cr , windata); ++ paint_window_when_pointer_enter(widget, cr, windata); + } + else + { +- paint_window (widget, cr, windata); ++ paint_window(widget, cr, windata); + } + return FALSE; + } +@@ -360,111 +372,116 @@ countdown_expose_cb(GtkWidget *pie, + cairo_surface_t *surface; + GtkAllocation alloc; + +- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); ++ cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); + +- gtk_widget_get_allocation (pie, &alloc); ++ gtk_widget_get_allocation(pie, &alloc); + +- surface = cairo_surface_create_similar (cairo_get_target (cr), +- CAIRO_CONTENT_COLOR_ALPHA, +- alloc.width, +- alloc.height); ++ surface = cairo_surface_create_similar(cairo_get_target(cr), ++ CAIRO_CONTENT_COLOR_ALPHA, ++ alloc.width, ++ alloc.height); + +- cr2 = cairo_create (surface); ++ cr2 = cairo_create(surface); + +- cairo_translate (cr2, -alloc.x, -alloc.y); ++ cairo_translate(cr2, -alloc.x, -alloc.y); + + GtkStateFlags flags = gtk_widget_get_state_flags(windata->win); + if (flags & GTK_STATE_FLAG_PRELIGHT) + { +- fill_background_when_pointer_enter(pie, windata ,cr2); ++ fill_background_when_pointer_enter(pie, windata, cr2); + } + else + { +- fill_background (pie, windata, cr2); ++ fill_background(pie, windata, cr2); + } +- cairo_translate (cr2, alloc.x, alloc.y); +- draw_pie (pie, windata, cr2); +- cairo_fill (cr2); ++ cairo_translate(cr2, alloc.x, alloc.y); ++ draw_pie(pie, windata, cr2); ++ cairo_fill(cr2); + +- cairo_destroy (cr2); ++ cairo_destroy(cr2); + +- cairo_save (cr); +- cairo_set_source_surface (cr, surface, 0, 0); +- cairo_paint (cr); +- cairo_restore (cr); ++ cairo_save(cr); ++ cairo_set_source_surface(cr, surface, 0, 0); ++ cairo_paint(cr); ++ cairo_restore(cr); + +- cairo_surface_destroy (surface); ++ cairo_surface_destroy(surface); + return TRUE; + } + +-static gboolean on_configure_event (GtkWidget* widget, GdkEventConfigure* event, WindowData* windata) ++static gboolean ++on_configure_event(GtkWidget *widget, GdkEventConfigure *event, WindowData *windata) + { + windata->width = event->width; + windata->height = event->height; + +- gtk_widget_queue_draw (widget); ++ gtk_widget_queue_draw(widget); + + return FALSE; + } + +-static void on_composited_changed (GtkWidget* window, WindowData* windata) ++static void ++on_composited_changed(GtkWidget *window, WindowData *windata) + { +- windata->composited = gdk_screen_is_composited (gtk_widget_get_screen(window)); ++ windata->composited = gdk_screen_is_composited(gtk_widget_get_screen(window)); + +- gtk_widget_queue_draw (window); ++ gtk_widget_queue_draw(window); + } + +- + /** + * @brief 事件过滤:当鼠标移入或者离开消息框,绘制相应的消息框状态 + */ +-GdkFilterReturn event_filter(GdkXEvent *xevent, GdkEvent *event, gpointer userdata) ++GdkFilterReturn ++event_filter(GdkXEvent *xevent, GdkEvent *event, gpointer userdata) + { +- XEvent *x_event = (XEvent*)xevent; +- XGenericEvent *general_event = (XGenericEvent*)x_event; ++ XEvent *x_event = (XEvent *)xevent; ++ XGenericEvent *general_event = (XGenericEvent *)x_event; + GtkWidget *window = GTK_WIDGET(userdata); +- switch(x_event->type) { +- case EnterNotify: +- gtk_widget_set_state_flags(window, GTK_STATE_FLAG_PRELIGHT, FALSE); +- gtk_widget_queue_draw(window); +- break; +- case LeaveNotify: +- gtk_widget_set_state_flags(window, gtk_widget_get_state_flags(window) & ~GTK_STATE_FLAG_PRELIGHT, TRUE); +- gtk_widget_queue_draw(window); +- break; +- case GenericEvent: +- do ++ switch (x_event->type) ++ { ++ case EnterNotify: ++ gtk_widget_set_state_flags(window, GTK_STATE_FLAG_PRELIGHT, FALSE); ++ gtk_widget_queue_draw(window); ++ break; ++ case LeaveNotify: ++ gtk_widget_set_state_flags(window, gtk_widget_get_state_flags(window) & ~GTK_STATE_FLAG_PRELIGHT, TRUE); ++ gtk_widget_queue_draw(window); ++ break; ++ case GenericEvent: ++ do ++ { ++ if (general_event->evtype == EnterNotify) ++ { ++ gtk_widget_set_state_flags(window, GTK_STATE_FLAG_PRELIGHT, FALSE); ++ gtk_widget_queue_draw(window); ++ } ++ ++ if (general_event->evtype == LeaveNotify) + { +- if (general_event->evtype == EnterNotify) { +- gtk_widget_set_state_flags(window, GTK_STATE_FLAG_PRELIGHT, FALSE); +- gtk_widget_queue_draw(window); +- } +- +- if (general_event->evtype == LeaveNotify) { +- gtk_widget_set_state_flags(window, gtk_widget_get_state_flags(window) & ~GTK_STATE_FLAG_PRELIGHT, TRUE); +- gtk_widget_queue_draw(window); +- } +- }while(0); +- break; +- default: +- break; ++ gtk_widget_set_state_flags(window, gtk_widget_get_state_flags(window) & ~GTK_STATE_FLAG_PRELIGHT, TRUE); ++ gtk_widget_queue_draw(window); ++ } ++ } while (0); ++ break; ++ default: ++ break; + } + return GDK_FILTER_CONTINUE; + } + + static void +-on_realize(GtkWidget *widget , gpointer userdata ) ++on_realize(GtkWidget *widget, gpointer userdata) + { + GdkWindow *window = gtk_widget_get_window(widget); + gdk_window_add_filter(window, event_filter, widget); + } + +- + static void +-action_clicked_cb(GtkWidget *w, GdkEventButton *event, ++action_clicked_cb(GtkWidget *w, ++ GdkEventButton *event, + ActionInvokedCb action_cb) + { +- GtkWindow *nw = g_object_get_data(G_OBJECT(w), "_nw"); ++ GtkWindow *nw = g_object_get_data(G_OBJECT(w), "_nw"); + const char *key = g_object_get_data(G_OBJECT(w), "_action_key"); + + action_cb(nw, key); +@@ -474,51 +491,48 @@ action_clicked_cb(GtkWidget *w, GdkEventButton *event, + + /* Checking if we support this notification daemon version */ + gboolean +-theme_check_init(unsigned int major_ver, unsigned int minor_ver, ++theme_check_init(unsigned int major_ver, ++ unsigned int minor_ver, + unsigned int micro_ver) + { + return major_ver == NOTIFICATION_DAEMON_MAJOR_VERSION && minor_ver == NOTIFICATION_DAEMON_MINOR_VERSION && micro_ver == NOTIFICATION_DAEMON_MICRO_VERSION; + } + + /* Sending theme info to the notification daemon */ +-void +-get_theme_info(char **theme_name, +- char **theme_ver, +- char **author, +- char **homepage) ++void get_theme_info(char **theme_name, ++ char **theme_ver, ++ char **author, ++ char **homepage) + { + *theme_name = g_strdup("Kiran"); +- *theme_ver = g_strdup_printf("%d.%d.%d", NOTIFICATION_DAEMON_MAJOR_VERSION, +- NOTIFICATION_DAEMON_MINOR_VERSION, +- NOTIFICATION_DAEMON_MICRO_VERSION); ++ *theme_ver = g_strdup_printf("%d.%d.%d", NOTIFICATION_DAEMON_MAJOR_VERSION, NOTIFICATION_DAEMON_MINOR_VERSION, NOTIFICATION_DAEMON_MICRO_VERSION); + *author = g_strdup("Eduardo Grajeda"); + *homepage = g_strdup("http://github.com/tatofoo/"); + } +- ++ + /* set css*/ +-static void +-set_css(GtkWidget* widget) ++static void ++set_css(GtkWidget *widget) + { +- GtkCssProvider *provider = gtk_css_provider_new (); ++ GtkCssProvider *provider = gtk_css_provider_new(); + +- gtk_css_provider_load_from_resource (provider, "/kiran/themes/kiran.css"); +- gtk_style_context_add_provider_for_screen (gtk_widget_get_screen(widget), +- GTK_STYLE_PROVIDER(provider), +- GTK_STYLE_PROVIDER_PRIORITY_USER); ++ gtk_css_provider_load_from_resource(provider, "/kiran/themes/kiran.css"); ++ gtk_style_context_add_provider_for_screen(gtk_widget_get_screen(widget), ++ GTK_STYLE_PROVIDER(provider), ++ GTK_STYLE_PROVIDER_PRIORITY_USER); + gtk_style_context_reset_widgets(gtk_widget_get_screen(widget)); + +- g_object_unref (provider); ++ g_object_unref(provider); + } + +- + /* Create new notification */ + GtkWindow * + create_notification(UrlClickedCb url_clicked) + { + GtkWidget *win; + GtkWidget *main_vbox; +- GtkWidget* close_button; +- GtkWidget* action_vbox; ++ GtkWidget *close_button; ++ GtkWidget *action_vbox; + GtkWidget *vbox; + AtkObject *atkobj; + WindowData *windata; +@@ -532,16 +546,16 @@ create_notification(UrlClickedCb url_clicked) + + win = gtk_window_new(GTK_WINDOW_POPUP); + gtk_window_set_resizable(GTK_WINDOW(win), FALSE); +- gtk_window_set_decorated (GTK_WINDOW(win), TRUE); ++ gtk_window_set_decorated(GTK_WINDOW(win), TRUE); + windata->win = win; +- ++ + //register resource + resource = kiran_get_resource(); +- g_resources_register (resource); ++ g_resources_register(resource); + + set_css(windata->win); +- gtk_widget_set_name(windata->win , "notification_window"); +- gtk_widget_set_size_request(windata->win , WIDTH,70); ++ gtk_widget_set_name(windata->win, "notification_window"); ++ gtk_widget_set_size_request(windata->win, WIDTH, 70); + windata->rtl = gtk_widget_get_default_direction(); + windata->composited = FALSE; + screen = gtk_window_get_screen(GTK_WINDOW(win)); +@@ -556,9 +570,9 @@ create_notification(UrlClickedCb url_clicked) + gtk_window_set_title(GTK_WINDOW(win), "Notification"); + gtk_window_set_type_hint(GTK_WINDOW(win), GDK_WINDOW_TYPE_HINT_NOTIFICATION); + gtk_widget_add_events(win, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); +- +- g_signal_connect(G_OBJECT(win), "realize" , G_CALLBACK(on_realize) , NULL); +- ++ ++ g_signal_connect(G_OBJECT(win), "realize", G_CALLBACK(on_realize), NULL); ++ + gtk_widget_realize(win); + + g_object_set_data_full(G_OBJECT(win), "windata", windata, +@@ -566,142 +580,142 @@ create_notification(UrlClickedCb url_clicked) + atk_object_set_role(gtk_widget_get_accessible(win), ATK_ROLE_ALERT); + + main_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); +- gtk_widget_set_name(main_vbox , "main_vbox"); ++ gtk_widget_set_name(main_vbox, "main_vbox"); + gtk_widget_show(main_vbox); +- gtk_container_add (GTK_CONTAINER (win), main_vbox); ++ gtk_container_add(GTK_CONTAINER(win), main_vbox); ++ ++ g_signal_connect(G_OBJECT(main_vbox), "draw", G_CALLBACK(on_draw), windata); + +- g_signal_connect (G_OBJECT (main_vbox), "draw", +- G_CALLBACK (on_draw), windata); ++ g_signal_connect(G_OBJECT(win), "configure-event", G_CALLBACK(on_configure_event), windata); + +- g_signal_connect (G_OBJECT (win), "configure-event", G_CALLBACK (on_configure_event), windata); ++ g_signal_connect(G_OBJECT(win), "composited-changed", G_CALLBACK(on_composited_changed), windata); + +- g_signal_connect (G_OBJECT (win), "composited-changed", G_CALLBACK (on_composited_changed), windata); ++ windata->main_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); ++ gtk_widget_set_name(windata->main_hbox, "main_hbox"); ++ gtk_widget_set_halign(windata->main_hbox, GTK_ALIGN_FILL); ++ gtk_widget_set_valign(windata->main_hbox, GTK_ALIGN_START); ++ gtk_widget_show(windata->main_hbox); ++ gtk_box_pack_start(GTK_BOX(main_vbox), windata->main_hbox, ++ TRUE, TRUE, 0); + +- windata->main_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +- gtk_widget_set_name(windata->main_hbox , "main_hbox"); +- gtk_widget_set_halign (windata->main_hbox, GTK_ALIGN_FILL); +- gtk_widget_set_valign (windata->main_hbox, GTK_ALIGN_START); +- gtk_widget_show (windata->main_hbox); +- gtk_box_pack_start (GTK_BOX(main_vbox), windata->main_hbox, TRUE, TRUE, 0); +- +- /* The icon goes at the left */ ++ /* The icon goes at the left */ + windata->iconbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); +- gtk_widget_set_name(windata->iconbox , "icon_box"); ++ gtk_widget_set_name(windata->iconbox, "icon_box"); + gtk_widget_show(windata->iconbox); + gtk_box_pack_start(GTK_BOX(windata->main_hbox), windata->iconbox, + FALSE, FALSE, 0); +- gtk_widget_set_valign (GTK_WIDGET(windata->iconbox),GTK_ALIGN_START); +- ++ gtk_widget_set_valign(GTK_WIDGET(windata->iconbox), GTK_ALIGN_START); ++ + windata->icon = gtk_image_new(); + gtk_box_pack_start(GTK_BOX(windata->iconbox), windata->icon, + FALSE, FALSE, 0); + +- /* The title and the text at the right */ +- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); +- gtk_widget_set_name(vbox , "text_vbox"); +- gtk_widget_set_halign (vbox, GTK_ALIGN_FILL); +- gtk_widget_show (vbox); +- gtk_box_pack_start (GTK_BOX (windata->main_hbox), vbox, TRUE, TRUE, 0); +- gtk_widget_set_hexpand (vbox, TRUE); +- ++ /* The title and the text at the right */ ++ vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); ++ gtk_widget_set_name(vbox, "text_vbox"); ++ gtk_widget_set_halign(vbox, GTK_ALIGN_FILL); ++ gtk_widget_show(vbox); ++ gtk_box_pack_start(GTK_BOX(windata->main_hbox), vbox, ++ TRUE, TRUE, 0); ++ gtk_widget_set_hexpand(vbox, TRUE); + + /* Add action_vbox*/ +- action_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL , 0); +- gtk_widget_set_name(action_vbox , "action_vbox"); ++ action_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); ++ gtk_widget_set_name(action_vbox, "action_vbox"); + gtk_widget_show(action_vbox); +- gtk_box_pack_end(GTK_BOX(windata->main_hbox), action_vbox , FALSE , FALSE ,0); +- gtk_widget_set_halign (action_vbox, GTK_ALIGN_END); ++ gtk_box_pack_end(GTK_BOX(windata->main_hbox), action_vbox, ++ FALSE, FALSE, 0); ++ gtk_widget_set_halign(action_vbox, GTK_ALIGN_END); + +- /* Add the close button */ ++ /* Add the close button */ + close_button = gtk_button_new(); +- gtk_widget_set_name(GTK_WIDGET(close_button) ,"close_button" ); +- gtk_widget_set_size_request(GTK_WIDGET(close_button) , 16 , 16); +- gtk_widget_set_valign (close_button, GTK_ALIGN_START); +- gtk_widget_set_halign (close_button, GTK_ALIGN_END); +- gtk_widget_set_vexpand (close_button,FALSE); +- gtk_widget_set_hexpand(close_button , FALSE); ++ gtk_widget_set_name(GTK_WIDGET(close_button), "close_button"); ++ gtk_widget_set_size_request(GTK_WIDGET(close_button), 16, 16); ++ gtk_widget_set_valign(close_button, GTK_ALIGN_START); ++ gtk_widget_set_halign(close_button, GTK_ALIGN_END); ++ gtk_widget_set_vexpand(close_button, FALSE); ++ gtk_widget_set_hexpand(close_button, FALSE); + gtk_widget_show(close_button); + + windata->close_button = close_button; +- gtk_box_pack_start (GTK_BOX (action_vbox), +- windata->close_button, +- FALSE, FALSE, 0); ++ gtk_box_pack_start(GTK_BOX(action_vbox), windata->close_button, ++ FALSE, FALSE, 0); + + gtk_button_set_relief(GTK_BUTTON(close_button), GTK_RELIEF_NONE); + gtk_container_set_border_width(GTK_CONTAINER(close_button), 0); + g_signal_connect_swapped(G_OBJECT(close_button), "clicked", G_CALLBACK(gtk_widget_destroy), win); + + atkobj = gtk_widget_get_accessible(close_button); +- atk_action_set_description(ATK_ACTION(atkobj), 0, +- _("Closes the notification.")); ++ atk_action_set_description(ATK_ACTION(atkobj), 0, _("Closes the notification.")); + atk_object_set_name(atkobj, ""); +- atk_object_set_description (atkobj, _("Closes the notification.")); ++ atk_object_set_description(atkobj, _("Closes the notification.")); + +- windata->actions_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,10); +- gtk_widget_set_name(windata->actions_box , "actions_box"); ++ windata->actions_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 10); ++ gtk_widget_set_name(windata->actions_box, "actions_box"); + gtk_widget_set_halign(windata->actions_box, GTK_ALIGN_END); + gtk_widget_show(windata->actions_box); + gtk_box_pack_end(GTK_BOX(action_vbox), windata->actions_box, FALSE, FALSE, 0); +- gtk_widget_set_vexpand (windata->actions_box,FALSE); +- gtk_widget_set_hexpand (windata->actions_box,FALSE); ++ gtk_widget_set_vexpand(windata->actions_box, FALSE); ++ gtk_widget_set_hexpand(windata->actions_box, FALSE); + + windata->summary_label = gtk_label_new(NULL); + gtk_widget_set_name(windata->summary_label, "summary_label"); + gtk_widget_show(windata->summary_label); +- gtk_box_pack_start(GTK_BOX(vbox), windata->summary_label, FALSE, FALSE, 0); +- gtk_label_set_xalign (GTK_LABEL (windata->summary_label), 0.0); +- gtk_label_set_yalign (GTK_LABEL (windata->summary_label), 0.0); ++ gtk_box_pack_start(GTK_BOX(vbox), windata->summary_label, ++ FALSE, FALSE, 0); ++ gtk_label_set_xalign(GTK_LABEL(windata->summary_label), 0.0); ++ gtk_label_set_yalign(GTK_LABEL(windata->summary_label), 0.0); + gtk_label_set_line_wrap(GTK_LABEL(windata->summary_label), TRUE); +- gtk_label_set_line_wrap_mode (GTK_LABEL (windata->summary_label), PANGO_WRAP_WORD_CHAR); ++ gtk_label_set_line_wrap_mode(GTK_LABEL(windata->summary_label), PANGO_WRAP_WORD_CHAR); + + atkobj = gtk_widget_get_accessible(windata->summary_label); +- atk_object_set_description (atkobj, _("Notification summary text.")); ++ atk_object_set_description(atkobj, _("Notification summary text.")); + + windata->body_label = gtk_label_new(NULL); +- gtk_widget_set_name(windata->body_label , "body_label"); +- gtk_box_pack_start(GTK_BOX(vbox), windata->body_label, FALSE, FALSE, 0); +- gtk_label_set_xalign (GTK_LABEL (windata->body_label), 0.0); +- gtk_label_set_yalign (GTK_LABEL (windata->body_label), 0.0); ++ gtk_widget_set_name(windata->body_label, "body_label"); ++ gtk_box_pack_start(GTK_BOX(vbox), windata->body_label, ++ FALSE, FALSE, 0); ++ gtk_label_set_xalign(GTK_LABEL(windata->body_label), 0.0); ++ gtk_label_set_yalign(GTK_LABEL(windata->body_label), 0.0); + gtk_label_set_line_wrap(GTK_LABEL(windata->body_label), TRUE); +- gtk_label_set_line_wrap_mode (GTK_LABEL (windata->body_label), PANGO_WRAP_WORD_CHAR); +- gtk_label_set_max_width_chars (GTK_LABEL (windata->body_label), 50); +- gtk_widget_set_vexpand (windata->body_label, TRUE); ++ gtk_label_set_line_wrap_mode(GTK_LABEL(windata->body_label), PANGO_WRAP_WORD_CHAR); ++ gtk_label_set_max_width_chars(GTK_LABEL(windata->body_label), 50); ++ gtk_widget_set_vexpand(windata->body_label, TRUE); + + g_signal_connect(G_OBJECT(windata->body_label), "activate-link", +- G_CALLBACK(activate_link), windata); ++ G_CALLBACK(activate_link), windata); + + atkobj = gtk_widget_get_accessible(windata->body_label); +- atk_object_set_description (atkobj, _("Notification body text.")); ++ atk_object_set_description(atkobj, _("Notification body text.")); + +- g_resources_unregister (resource); ++ g_resources_unregister(resource); + return GTK_WINDOW(win); + } + + /* Set the notification text */ +-void +-set_notification_text(GtkWindow *nw, const char *summary, const char *body) ++void set_notification_text(GtkWindow *nw, const char *summary, const char *body) + { + WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata"); + g_assert(windata != NULL); + +- if(summary == NULL || *summary == '\0') ++ if (summary == NULL || *summary == '\0') + { +- if(windata->urgency == URGENCY_CRITICAL) ++ if (windata->urgency == URGENCY_CRITICAL) + { + summary = _("Normal Notification"); + } +- else if(windata->urgency == URGENCY_LOW) ++ else if (windata->urgency == URGENCY_LOW) + { + summary = _("Low Notification"); + } +- else if(windata->urgency == URGENCY_CRITICAL) ++ else if (windata->urgency == URGENCY_CRITICAL) + { + summary = _("Critical Notification"); + } + } +- +- gtk_label_set_text(GTK_LABEL(windata->summary_label) , summary); +- gtk_label_set_text (GTK_LABEL (windata->body_label), body); ++ ++ gtk_label_set_text(GTK_LABEL(windata->summary_label), summary); ++ gtk_label_set_text(GTK_LABEL(windata->body_label), body); + + if (body == NULL || *body == '\0') + gtk_widget_hide(windata->body_label); +@@ -710,15 +724,14 @@ set_notification_text(GtkWindow *nw, const char *summary, const char *body) + + gtk_widget_set_size_request( + ((body != NULL && *body != '\0') +- ? windata->body_label : windata->summary_label), +- WIDTH - (IMAGE_SIZE + IMAGE_PADDING*2) -80, ++ ? windata->body_label ++ : windata->summary_label), ++ WIDTH - (IMAGE_SIZE + IMAGE_PADDING * 2) - 80, + -1); +- + } + + /* Set notification icon */ +-void +-set_notification_icon(GtkWindow *nw, GdkPixbuf *pixbuf) ++void set_notification_icon(GtkWindow *nw, GdkPixbuf *pixbuf) + { + WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata"); + g_assert(windata != NULL); +@@ -729,8 +742,7 @@ set_notification_icon(GtkWindow *nw, GdkPixbuf *pixbuf) + int pixbuf_width = gdk_pixbuf_get_width(pixbuf); + + gtk_widget_show(windata->icon); +- gtk_widget_set_size_request(windata->iconbox, +- MAX(BODY_X_OFFSET, pixbuf_width), -1); ++ gtk_widget_set_size_request(windata->iconbox, MAX(BODY_X_OFFSET, pixbuf_width), -1); + } + else + { +@@ -740,16 +752,16 @@ set_notification_icon(GtkWindow *nw, GdkPixbuf *pixbuf) + } + + /* Set notification arrow */ +-void +-set_notification_arrow(GtkWidget *nw, gboolean visible, int x, int y) ++void set_notification_arrow(GtkWidget *nw, gboolean visible, int x, int y) + { +- /* nothing */ ++ /* nothing */ + } + + /* Add notification action */ +-void +-add_notification_action(GtkWindow *nw, const char *text, const char *key, +- ActionInvokedCb cb) ++void add_notification_action(GtkWindow *nw, ++ const char *text, ++ const char *key, ++ ActionInvokedCb cb) + { + WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata"); + GtkWidget *label; +@@ -759,26 +771,27 @@ add_notification_action(GtkWindow *nw, const char *text, const char *key, + char *buf; + + g_assert(windata != NULL); +- ++ + if (gtk_widget_get_visible(windata->actions_box)) + { + gtk_widget_show(windata->actions_box); + /* Don't try to re-add a pie_countdown */ +- if (!windata->pie_countdown) { ++ if (!windata->pie_countdown) ++ { + windata->pie_countdown = gtk_drawing_area_new(); +- gtk_widget_set_halign (windata->pie_countdown, GTK_ALIGN_END); +- gtk_widget_set_valign (windata->pie_countdown, GTK_ALIGN_END); ++ gtk_widget_set_halign(windata->pie_countdown, GTK_ALIGN_END); ++ gtk_widget_set_valign(windata->pie_countdown, GTK_ALIGN_END); + gtk_widget_show(windata->pie_countdown); + +- gtk_box_pack_end (GTK_BOX (windata->actions_box), windata->pie_countdown, FALSE, FALSE, 0); +- gtk_widget_set_size_request(windata->pie_countdown, +- PIE_WIDTH, PIE_HEIGHT); ++ gtk_box_pack_end(GTK_BOX(windata->actions_box), windata->pie_countdown, FALSE, FALSE, 0); ++ gtk_widget_set_size_request(windata->pie_countdown, PIE_WIDTH, PIE_HEIGHT); + g_signal_connect(G_OBJECT(windata->pie_countdown), "draw", +- G_CALLBACK(countdown_expose_cb), windata); ++ G_CALLBACK(countdown_expose_cb), windata); + } + } + +- if (windata->action_icons) { ++ if (windata->action_icons) ++ { + button = gtk_button_new_from_icon_name(key, GTK_ICON_SIZE_BUTTON); + goto add_button; + } +@@ -786,7 +799,7 @@ add_notification_action(GtkWindow *nw, const char *text, const char *key, + button = gtk_button_new(); + gtk_widget_show(button); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); +- gtk_widget_set_name(GTK_WIDGET(hbox) , "actions_hbox"); ++ gtk_widget_set_name(GTK_WIDGET(hbox), "actions_hbox"); + gtk_widget_set_valign(GTK_WIDGET(hbox), GTK_ALIGN_END); + gtk_container_set_border_width(GTK_CONTAINER(hbox), 0); + gtk_widget_show(hbox); +@@ -804,26 +817,29 @@ add_notification_action(GtkWindow *nw, const char *text, const char *key, + { + GtkWidget *image = gtk_image_new_from_pixbuf(pixbuf); + gtk_widget_show(image); +- gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0); +- gtk_widget_set_halign (image, GTK_ALIGN_END); +- gtk_widget_set_valign (image, GTK_ALIGN_END); ++ gtk_box_pack_start(GTK_BOX(hbox), image, ++ FALSE, FALSE, 0); ++ gtk_widget_set_halign(image, GTK_ALIGN_END); ++ gtk_widget_set_valign(image, GTK_ALIGN_END); + } + + label = gtk_label_new(NULL); +- gtk_widget_set_name(GTK_WIDGET(label) , "actions_label"); ++ gtk_widget_set_name(GTK_WIDGET(label), "actions_label"); + gtk_widget_show(label); +- gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0); +- gtk_label_set_xalign (GTK_LABEL (label), 0.0); +- gtk_label_set_yalign (GTK_LABEL (label), 1.0); ++ gtk_box_pack_start(GTK_BOX(hbox), label, ++ FALSE, TRUE, 0); ++ gtk_label_set_xalign(GTK_LABEL(label), 0.0); ++ gtk_label_set_yalign(GTK_LABEL(label), 1.0); + gtk_widget_set_valign(GTK_WIDGET(label), GTK_ALIGN_END); +- gtk_label_set_text(GTK_LABEL(label) , text); ++ gtk_label_set_text(GTK_LABEL(label), text); + + add_button: + gtk_widget_set_valign(GTK_WIDGET(button), GTK_ALIGN_END); + gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); +- +- gtk_widget_set_name(GTK_WIDGET(button) , "actions_button"); +- gtk_box_pack_start(GTK_BOX(windata->actions_box), button, FALSE, FALSE, 0); ++ ++ gtk_widget_set_name(GTK_WIDGET(button), "actions_button"); ++ gtk_box_pack_start(GTK_BOX(windata->actions_box), button, ++ FALSE, FALSE, 0); + + g_object_set_data(G_OBJECT(button), "_nw", nw); + g_object_set_data_full(G_OBJECT(button), +@@ -835,8 +851,7 @@ add_button: + } + + /* Clear notification actions */ +-void +-clear_notification_actions(GtkWindow *nw) ++void clear_notification_actions(GtkWindow *nw) + { + WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata"); + +@@ -848,16 +863,14 @@ clear_notification_actions(GtkWindow *nw) + } + + /* Move notification window */ +-void +-move_notification(GtkWidget *nw, int x, int y) ++void move_notification(GtkWidget *nw, int x, int y) + { + WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata"); + g_assert(windata != NULL); +- ++ + gtk_window_move(GTK_WINDOW(nw), x, y); + } + +- + /* Optional Functions */ + + /* Destroy notification */ +@@ -867,8 +880,7 @@ move_notification(GtkWidget *nw, int x, int y) + /* Hide notification */ + + /* Set notification timeout */ +-void +-set_notification_timeout(GtkWindow *nw, glong timeout) ++void set_notification_timeout(GtkWindow *nw, glong timeout) + { + WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata"); + g_assert(windata != NULL); +@@ -891,9 +903,12 @@ void set_notification_hints(GtkWindow *nw, GVariant *hints) + { + windata->urgency = g_variant_get_byte(value); + +- if (windata->urgency == URGENCY_CRITICAL) { ++ if (windata->urgency == URGENCY_CRITICAL) ++ { + gtk_window_set_title(GTK_WINDOW(nw), "Critical Notification"); +- } else { ++ } ++ else ++ { + gtk_window_set_title(GTK_WINDOW(nw), "Notification"); + } + } +@@ -906,15 +921,17 @@ void set_notification_hints(GtkWindow *nw, GVariant *hints) + } + + /* Notification tick */ +-void +-notification_tick(GtkWindow *nw, glong remaining) ++void notification_tick(GtkWindow *nw, glong remaining) + { + WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata"); + windata->remaining = remaining; + + if (windata->pie_countdown != NULL) + { +- gtk_widget_queue_draw_area(windata->pie_countdown, 0, 0, +- PIE_WIDTH, PIE_HEIGHT); ++ gtk_widget_queue_draw_area(windata->pie_countdown, ++ 0, ++ 0, ++ PIE_WIDTH, ++ PIE_HEIGHT); + } + } +-- +2.27.0 + diff --git a/1015-fix-css-modify-css-error-and-improve-style-of-kiran-0ee639d8.patch b/1015-fix-css-modify-css-error-and-improve-style-of-kiran-0ee639d8.patch new file mode 100644 index 0000000..1a3dd0f --- /dev/null +++ b/1015-fix-css-modify-css-error-and-improve-style-of-kiran-0ee639d8.patch @@ -0,0 +1,69 @@ +From 0ee639d8b071696adab45454713e7e3d497f5e7d Mon Sep 17 00:00:00 2001 +From: yuanxing +Date: Wed, 1 Dec 2021 11:40:57 +0800 +Subject: [PATCH] fix(css):modify css error and improve style of kiran +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 修改css文件的错误,完善kiran主题样式 + +Related #46120 +--- + src/themes/kiran/data/kiran.css | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/src/themes/kiran/data/kiran.css b/src/themes/kiran/data/kiran.css +index c1017d2..f733834 100644 +--- a/src/themes/kiran/data/kiran.css ++++ b/src/themes/kiran/data/kiran.css +@@ -12,7 +12,6 @@ + color: #919191; + font-size: 12px; + font-family: "Noto Sans CJK SC regular"; +- line-height:12px; + } + + #actions_label +@@ -32,11 +31,12 @@ + box-shadow:none; + margin:0px; + border: none; ++ border-radius: 0px; + } +- + #actions_button:hover + { + border-bottom:1px solid #3197DE; ++ background-color: transparent; + } + + #close_button +@@ -48,7 +48,7 @@ + padding: 0px; + border: none; + margin: 0px; +- box-shadow: 0px; ++ border-radius: 0px; + } + + #close_button:hover +@@ -70,13 +70,12 @@ + { + margin: 0px; + padding: 0px; +- box-shadow: 0px; + } + + #main_hbox + { +- margin-right: 14px; +- margin-bottom: 12px; ++ margin-right: 14px; ++ margin-bottom: 12px; + } + + #icon_box +-- +2.27.0 + diff --git a/1016-fix-control-center-fix-mate-notification-properties--5dc16c41.patch b/1016-fix-control-center-fix-mate-notification-properties--5dc16c41.patch new file mode 100644 index 0000000..91cb246 --- /dev/null +++ b/1016-fix-control-center-fix-mate-notification-properties--5dc16c41.patch @@ -0,0 +1,24 @@ +From 5dc16c4150373c7e2614bf336d88d08a0a33f3a3 Mon Sep 17 00:00:00 2001 +From: longcheng +Date: Fri, 14 Jan 2022 16:27:56 +0800 +Subject: [PATCH] fix(control center): fix mate notification properties is not + displayed in the control panel (#48482) + +--- + src/capplet/mate-notification-properties.desktop.in | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/capplet/mate-notification-properties.desktop.in b/src/capplet/mate-notification-properties.desktop.in +index 42a3a84..ec49a9b 100644 +--- a/src/capplet/mate-notification-properties.desktop.in ++++ b/src/capplet/mate-notification-properties.desktop.in +@@ -7,6 +7,5 @@ Terminal=false + Type=Application + StartupNotify=true + Categories=GTK;Settings;DesktopSettings;X-System-Server;X-System-Server; +-OnlyShowIn=MATE; + Keywords=MATE;Notification;Theme; + X-KIRAN-NoDisplay=true +-- +2.27.0 + diff --git a/1017-fix-daemon-return-false-while-dbus-proxy-init-failed.patch b/1017-fix-daemon-return-false-while-dbus-proxy-init-failed.patch new file mode 100644 index 0000000..c1116de --- /dev/null +++ b/1017-fix-daemon-return-false-while-dbus-proxy-init-failed.patch @@ -0,0 +1,30 @@ +From f31d22fe7b500f9cb1f2eeed474056e3f86514dd Mon Sep 17 00:00:00 2001 +From: XiaoWen +Date: Wed, 29 Jun 2022 16:42:19 +0800 +Subject: [PATCH] fix(daemon):return false while dbus proxy init failed +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 当dbus接口初始化失败后返回错误 + +Signed-off-by: XiaoWen +--- + src/daemon/daemon.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c +index 44572e3..18bd02e 100644 +--- a/src/daemon/daemon.c ++++ b/src/daemon/daemon.c +@@ -1114,6 +1114,7 @@ static gboolean screensaver_active(GtkWidget* nw) + if (proxy == NULL) { + g_warning("Failed to get dbus connection: %s", error->message); + g_error_free (error); ++ return False; + } + + variant = g_dbus_proxy_call_sync (proxy, +-- +2.27.0 + diff --git a/mate-notification-daemon.spec b/mate-notification-daemon.spec index 93df589..a074ef1 100644 --- a/mate-notification-daemon.spec +++ b/mate-notification-daemon.spec @@ -15,9 +15,9 @@ Name: mate-notification-daemon Version: %{branch}.1 %if 0%{?rel_build} -Release: 1%{?dist} +Release: 2 %else -Release: 0.13%{?git_rel}%{?dist} +Release: 0.13%{?git_rel} %endif Summary: Notification daemon for MATE Desktop License: GPLv2+ @@ -29,6 +29,24 @@ URL: http://mate-desktop.org # Source for snapshot-builds. %{!?rel_build:Source0: http://git.mate-desktop.org/%{name}/snapshot/%{name}-%{commit}.tar.xz#/%{git_tar}} +Patch1001: 0001-mate-notification-daemon-change-bottom_right.patch +Patch1002: 0001-notification-modify-categories-KY3.4.patch +Patch1003: 0001-add-X-System-Server-in-categories.patch +Patch1004: 0001-fix-move-mate-notification-properties-from-menus.patch +Patch1005: 0001-features-add-new-kiran-themes-in-mate-notification-p-507a6bf0.patch +Patch1006: 0002-fix-UI-improve-css-style-of-notification-window-725faa6b.patch +Patch1007: 0003-fix-UI-set-the-text-box-fill-the-extra-space-in-wind-19276cbc.patch +Patch1008: 0004-fix-ui-delete-some-unuseful-code-7e52eef1.patch +Patch1009: 0005-fix-generate-resource.mk-file-to-ensure-generate-gre-017d2922.patch +Patch1010: 0006-fix-themes-change-the-default-theme-to-kiran-89a7d9a1.patch +Patch1011: 0007-fix-themes-change-the-first-option-to-kiran-in-mate--0fa4d5ba.patch +Patch1012: 0008-fix-theme-adjust-the-code-indent-and-remove-the-usel-3f451b70.patch +Patch1013: 0009-fix-theme-change-the-indent-of-kiran.c-and-add-notes-c35de938.patch +Patch1014: 0001-fix-kiran-theme-Remove-the-blue-border-when-the-mous-e495941c.patch +Patch1015: 1015-fix-css-modify-css-error-and-improve-style-of-kiran-0ee639d8.patch +Patch1016: 1016-fix-control-center-fix-mate-notification-properties--5dc16c41.patch +Patch1017: 1017-fix-daemon-return-false-while-dbus-proxy-init-failed.patch + BuildRequires: desktop-file-utils BuildRequires: libcanberra-devel BuildRequires: libnotify-devel @@ -91,6 +109,17 @@ rm -f %{buildroot}%{_datadir}/applications/mate-notification-daemon.desktop %changelog +* Fri Jul 08 2022 longcheng - 1.22.1-2 +- KYOS-B: changed top_right to bottom_right +- KYOS-B: notification-modify-categories-KY3.4 (#20564) +- KYOS-F: add X-System-Server in Categories in mate-notification-properties.desktop file +- KYOS-F: fix-move-mate-notification-properties-from-menus (#28100) +- KYOS-F: add new kiran theme of notification (#33420) +- KYOS-F: Remove the blue border when the mouse enters the message box +- KYOS-F: modify css error and improve style of kiran (#46120) +- KYOS-F: fix mate notification properties is not displayed in the control panel (#48482) +- KYOS-F: Fix error while init DBus interface (#57298) + * Sat Sep 21 2019 Wolfgang Ulbrich - 1.22.1-1 - update to 1.22.1