Merge lp:~grindhold/sakura/fading into lp:~dabisu/sakura/sakura

Proposed by grindhold
Status: Merged
Merge reported by: David Gómez
Merged at revision: not available
Proposed branch: lp:~grindhold/sakura/fading
Merge into: lp:~dabisu/sakura/sakura
Diff against target: 695 lines (+160/-31)
21 files modified
AUTHORS (+1/-0)
po/ca.po (+4/-2)
po/cs.po (+4/-1)
po/de.po (+4/-2)
po/en_GB.po (+4/-2)
po/es.po (+4/-2)
po/fr.po (+4/-1)
po/he.po (+4/-1)
po/hr.po (+4/-2)
po/hu.po (+4/-1)
po/it.po (+4/-2)
po/ja.po (+4/-1)
po/ko.po (+4/-2)
po/pl.po (+4/-2)
po/pt.po (+4/-2)
po/pt_BR.po (+4/-2)
po/ru.po (+4/-1)
po/sv.po (+4/-1)
po/uk.po (+4/-2)
po/zh_CN.po (+4/-1)
src/sakura.c (+83/-1)
To merge this branch: bzr merge lp:~grindhold/sakura/fading
Reviewer Review Type Date Requested Status
David Gómez Approve
Review via email: mp+292099@code.launchpad.net

Description of the change

I implemented an urxvt-like feature for focus fading.

When sakura notices that it hasn't got the window manager's input focus anymore, it will darken the foreground color. When the sakura window retrieves the focus, it will turn the foreground color bright again.

It is the last feature I am missing for sakura, as I switched from urxvt 3 days ago.
I hope to see the feature in the main branch. sakura would be the perfect terminal emulator then.

To post a comment you must log in.
lp:~grindhold/sakura/fading updated
550. By grindhold

added my name to contributors

Revision history for this message
David Gómez (dabisu) wrote :

I've already merged your patch, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'AUTHORS'
2--- AUTHORS 2016-01-30 07:30:12 +0000
3+++ AUTHORS 2016-04-17 21:54:27 +0000
4@@ -59,6 +59,7 @@
5 Aron Xu <happyaron.xu@gmail.com>
6 Yuanyelele <yuanyelele@gmail.com>
7 Chidambar Zinnoury <illogict@online.fr>
8+ grindhold <grindhold@gmx.net>
9
10
11 Artwork
12
13=== modified file 'po/ca.po'
14--- po/ca.po 2016-01-30 07:30:12 +0000
15+++ po/ca.po 2016-04-17 21:54:27 +0000
16@@ -5,7 +5,7 @@
17 msgstr ""
18 "Project-Id-Version: sakura\n"
19 "Report-Msgid-Bugs-To: \n"
20-"POT-Creation-Date: 2016-01-28 20:29+0100\n"
21+"POT-Creation-Date: 2016-04-17 22:31+0200\n"
22 "PO-Revision-Date: 2015-07-26 17:52+0000\n"
23 "Last-Translator: David Gómez <david@pleyades.net>\n"
24 "Language-Team: Jordi Jané Cardo <jordi.jane@gmail.com>\n"
25@@ -202,6 +202,9 @@
26 msgid "Disable numbered tabswitch"
27 msgstr ""
28
29+msgid "Use focus fading"
30+msgstr ""
31+
32 msgid "Set cursor type"
33 msgstr ""
34
35@@ -235,4 +238,3 @@
36 #, c-format
37 msgid "sakura version is %s\n"
38 msgstr "La versió de sakura és %s\n"
39-
40
41=== modified file 'po/cs.po'
42--- po/cs.po 2016-01-30 07:30:12 +0000
43+++ po/cs.po 2016-04-17 21:54:27 +0000
44@@ -7,7 +7,7 @@
45 msgstr ""
46 "Project-Id-Version: sakura 2.3.8\n"
47 "Report-Msgid-Bugs-To: \n"
48-"POT-Creation-Date: 2016-01-28 20:29+0100\n"
49+"POT-Creation-Date: 2016-04-17 22:31+0200\n"
50 "PO-Revision-Date: 2014-06-23 01:17+0000\n"
51 "Last-Translator: David Gómez <david@pleyades.net>\n"
52 "Language-Team: Czech <gnome-cs-list@gnome.org>\n"
53@@ -215,6 +215,9 @@
54 msgid "Disable numbered tabswitch"
55 msgstr ""
56
57+msgid "Use focus fading"
58+msgstr ""
59+
60 msgid "Set cursor type"
61 msgstr ""
62
63
64=== modified file 'po/de.po'
65--- po/de.po 2016-01-30 07:30:12 +0000
66+++ po/de.po 2016-04-17 21:54:27 +0000
67@@ -7,7 +7,7 @@
68 msgstr ""
69 "Project-Id-Version: 2.3.4\n"
70 "Report-Msgid-Bugs-To: \n"
71-"POT-Creation-Date: 2016-01-28 20:29+0100\n"
72+"POT-Creation-Date: 2016-04-17 22:31+0200\n"
73 "PO-Revision-Date: 2015-07-26 17:00+0000\n"
74 "Last-Translator: David Gómez <david@pleyades.net>\n"
75 "Language-Team: Deutsch <de@li.org>\n"
76@@ -204,6 +204,9 @@
77 msgid "Disable numbered tabswitch"
78 msgstr ""
79
80+msgid "Use focus fading"
81+msgstr ""
82+
83 msgid "Set cursor type"
84 msgstr ""
85
86@@ -236,4 +239,3 @@
87 #, c-format
88 msgid "sakura version is %s\n"
89 msgstr "Sakura-Version ist %s\n"
90-
91
92=== modified file 'po/en_GB.po'
93--- po/en_GB.po 2016-01-30 07:30:12 +0000
94+++ po/en_GB.po 2016-04-17 21:54:27 +0000
95@@ -7,7 +7,7 @@
96 msgstr ""
97 "Project-Id-Version: sakura\n"
98 "Report-Msgid-Bugs-To: \n"
99-"POT-Creation-Date: 2016-01-28 20:29+0100\n"
100+"POT-Creation-Date: 2016-04-17 22:31+0200\n"
101 "PO-Revision-Date: 2015-11-24 16:05+0000\n"
102 "Last-Translator: David Gómez <david@pleyades.net>\n"
103 "Language-Team: English (United Kingdom) <en_GB@li.org>\n"
104@@ -198,6 +198,9 @@
105 msgid "Disable numbered tabswitch"
106 msgstr "Disable numbered tabswitch"
107
108+msgid "Use focus fading"
109+msgstr ""
110+
111 msgid "Set cursor type"
112 msgstr "Set cursor type"
113
114@@ -230,4 +233,3 @@
115 #, c-format
116 msgid "sakura version is %s\n"
117 msgstr "sakura version is %s\n"
118-
119
120=== modified file 'po/es.po'
121--- po/es.po 2016-01-30 07:30:12 +0000
122+++ po/es.po 2016-04-17 21:54:27 +0000
123@@ -5,7 +5,7 @@
124 msgstr ""
125 "Project-Id-Version: sakura\n"
126 "Report-Msgid-Bugs-To: \n"
127-"POT-Creation-Date: 2016-01-28 20:29+0100\n"
128+"POT-Creation-Date: 2016-04-17 22:31+0200\n"
129 "PO-Revision-Date: 2015-11-24 19:54+0000\n"
130 "Last-Translator: David Gómez <david@pleyades.net>\n"
131 "Language-Team: <davidge@pleyades.net>\n"
132@@ -196,6 +196,9 @@
133 msgid "Disable numbered tabswitch"
134 msgstr "Desactivar números para cambio de pestañas"
135
136+msgid "Use focus fading"
137+msgstr ""
138+
139 msgid "Set cursor type"
140 msgstr "Establecer tipo de cursor"
141
142@@ -229,4 +232,3 @@
143 #, c-format
144 msgid "sakura version is %s\n"
145 msgstr "La versión de sakura es %s\n"
146-
147
148=== modified file 'po/fr.po'
149--- po/fr.po 2016-01-30 07:54:10 +0000
150+++ po/fr.po 2016-04-17 21:54:27 +0000
151@@ -6,7 +6,7 @@
152 msgstr ""
153 "Project-Id-Version: sakura 1.2.0\n"
154 "Report-Msgid-Bugs-To: \n"
155-"POT-Creation-Date: 2016-01-30 08:53+0100\n"
156+"POT-Creation-Date: 2016-04-17 22:31+0200\n"
157 "PO-Revision-Date: 2015-07-26 16:54+0000\n"
158 "Last-Translator: David Gómez <david@pleyades.net>\n"
159 "Language-Team: <fabrice.thiroux@free.fr>\n"
160@@ -197,6 +197,9 @@
161 msgid "Disable numbered tabswitch"
162 msgstr ""
163
164+msgid "Use focus fading"
165+msgstr ""
166+
167 msgid "Set cursor type"
168 msgstr "Définir le type de curseur"
169
170
171=== modified file 'po/he.po'
172--- po/he.po 2016-01-30 07:30:12 +0000
173+++ po/he.po 2016-04-17 21:54:27 +0000
174@@ -7,7 +7,7 @@
175 msgstr ""
176 "Project-Id-Version: sakura 3.1.4\n"
177 "Report-Msgid-Bugs-To: \n"
178-"POT-Creation-Date: 2016-01-28 20:29+0100\n"
179+"POT-Creation-Date: 2016-04-17 22:31+0200\n"
180 "PO-Revision-Date: 2015-07-26 17:10+0000\n"
181 "Last-Translator: David Gómez <david@pleyades.net>\n"
182 "Language-Team: Rahut <genghiskhan@gmx.ca>\n"
183@@ -222,6 +222,9 @@
184 msgid "Disable numbered tabswitch"
185 msgstr ""
186
187+msgid "Use focus fading"
188+msgstr ""
189+
190 msgid "Set cursor type"
191 msgstr "קבע טיפוס סמן"
192
193
194=== modified file 'po/hr.po'
195--- po/hr.po 2016-01-30 07:30:12 +0000
196+++ po/hr.po 2016-04-17 21:54:27 +0000
197@@ -6,7 +6,7 @@
198 msgstr ""
199 "Project-Id-Version: Sakura 2.3.2\n"
200 "Report-Msgid-Bugs-To: \n"
201-"POT-Creation-Date: 2016-01-28 20:29+0100\n"
202+"POT-Creation-Date: 2016-04-17 22:31+0200\n"
203 "PO-Revision-Date: 2015-10-14 17:21+0000\n"
204 "Last-Translator: gogo <trebelnik2@gmail.com>\n"
205 "Language-Team: brentaal <Unknown>\n"
206@@ -210,6 +210,9 @@
207 msgid "Disable numbered tabswitch"
208 msgstr ""
209
210+msgid "Use focus fading"
211+msgstr ""
212+
213 msgid "Set cursor type"
214 msgstr "Postavi tip kursora"
215
216@@ -242,4 +245,3 @@
217 #, c-format
218 msgid "sakura version is %s\n"
219 msgstr "inačica Sakure je %s\n"
220-
221
222=== modified file 'po/hu.po'
223--- po/hu.po 2016-01-31 09:16:53 +0000
224+++ po/hu.po 2016-04-17 21:54:27 +0000
225@@ -5,7 +5,7 @@
226 msgstr ""
227 "Project-Id-Version: sakura\n"
228 "Report-Msgid-Bugs-To: \n"
229-"POT-Creation-Date: 2016-01-30 08:53+0100\n"
230+"POT-Creation-Date: 2016-04-17 22:31+0200\n"
231 "PO-Revision-Date: 2016-01-30 06:54+0000\n"
232 "Last-Translator: rezso <Unknown>\n"
233 "Language-Team: hu\n"
234@@ -196,6 +196,9 @@
235 msgid "Disable numbered tabswitch"
236 msgstr "Gyorsbillentyűs fülváltás tiltása"
237
238+msgid "Use focus fading"
239+msgstr ""
240+
241 msgid "Set cursor type"
242 msgstr "Kurzor típusának beállítása"
243
244
245=== modified file 'po/it.po'
246--- po/it.po 2016-01-30 07:30:12 +0000
247+++ po/it.po 2016-04-17 21:54:27 +0000
248@@ -5,7 +5,7 @@
249 msgstr ""
250 "Project-Id-Version: sakura\n"
251 "Report-Msgid-Bugs-To: \n"
252-"POT-Creation-Date: 2016-01-28 20:29+0100\n"
253+"POT-Creation-Date: 2016-04-17 22:31+0200\n"
254 "PO-Revision-Date: 2015-07-26 16:34+0000\n"
255 "Last-Translator: David Gómez <david@pleyades.net>\n"
256 "Language-Team: sakura-it <nicola@entidi.it>\n"
257@@ -205,6 +205,9 @@
258 msgid "Disable numbered tabswitch"
259 msgstr ""
260
261+msgid "Use focus fading"
262+msgstr ""
263+
264 msgid "Set cursor type"
265 msgstr "Imposta il modello di cursore"
266
267@@ -237,4 +240,3 @@
268 #, c-format
269 msgid "sakura version is %s\n"
270 msgstr "La versione di Sakura è %s\n"
271-
272
273=== modified file 'po/ja.po'
274--- po/ja.po 2016-01-31 09:16:53 +0000
275+++ po/ja.po 2016-04-17 21:54:27 +0000
276@@ -4,7 +4,7 @@
277 msgstr ""
278 "Project-Id-Version: ja\n"
279 "Report-Msgid-Bugs-To: \n"
280-"POT-Creation-Date: 2016-01-30 08:53+0100\n"
281+"POT-Creation-Date: 2016-04-17 22:31+0200\n"
282 "PO-Revision-Date: 2016-01-30 07:01+0000\n"
283 "Last-Translator: David Gómez <david@pleyades.net>\n"
284 "Language-Team: Japanese <ja@li.org>\n"
285@@ -195,6 +195,9 @@
286 msgid "Disable numbered tabswitch"
287 msgstr "番号のタブ切り替えを無効にする"
288
289+msgid "Use focus fading"
290+msgstr ""
291+
292 msgid "Set cursor type"
293 msgstr "カーソルタイプを設定"
294
295
296=== modified file 'po/ko.po'
297--- po/ko.po 2016-01-30 07:30:12 +0000
298+++ po/ko.po 2016-04-17 21:54:27 +0000
299@@ -7,7 +7,7 @@
300 msgstr ""
301 "Project-Id-Version: sakura\n"
302 "Report-Msgid-Bugs-To: \n"
303-"POT-Creation-Date: 2016-01-28 20:29+0100\n"
304+"POT-Creation-Date: 2016-04-17 22:31+0200\n"
305 "PO-Revision-Date: 2015-07-26 16:52+0000\n"
306 "Last-Translator: David Gómez <david@pleyades.net>\n"
307 "Language-Team: Korean <ko@li.org>\n"
308@@ -203,6 +203,9 @@
309 msgid "Disable numbered tabswitch"
310 msgstr ""
311
312+msgid "Use focus fading"
313+msgstr ""
314+
315 msgid "Set cursor type"
316 msgstr "커서 유형을 설정"
317
318@@ -235,4 +238,3 @@
319 #, c-format
320 msgid "sakura version is %s\n"
321 msgstr "sakura 버전은 %s 입니다\n"
322-
323
324=== modified file 'po/pl.po'
325--- po/pl.po 2016-01-30 07:30:12 +0000
326+++ po/pl.po 2016-04-17 21:54:27 +0000
327@@ -7,7 +7,7 @@
328 msgstr ""
329 "Project-Id-Version: sakura\n"
330 "Report-Msgid-Bugs-To: \n"
331-"POT-Creation-Date: 2016-01-28 20:29+0100\n"
332+"POT-Creation-Date: 2016-04-17 22:31+0200\n"
333 "PO-Revision-Date: 2014-06-23 01:17+0000\n"
334 "Last-Translator: David Gómez <david@pleyades.net>\n"
335 "Language-Team: Polish <pl@li.org>\n"
336@@ -215,6 +215,9 @@
337 msgid "Disable numbered tabswitch"
338 msgstr ""
339
340+msgid "Use focus fading"
341+msgstr ""
342+
343 msgid "Set cursor type"
344 msgstr ""
345
346@@ -247,4 +250,3 @@
347 #, c-format
348 msgid "sakura version is %s\n"
349 msgstr "wersja sakura to %s\n"
350-
351
352=== modified file 'po/pt.po'
353--- po/pt.po 2016-01-30 07:30:12 +0000
354+++ po/pt.po 2016-04-17 21:54:27 +0000
355@@ -7,7 +7,7 @@
356 msgstr ""
357 "Project-Id-Version: sakura\n"
358 "Report-Msgid-Bugs-To: \n"
359-"POT-Creation-Date: 2016-01-28 20:29+0100\n"
360+"POT-Creation-Date: 2016-04-17 22:31+0200\n"
361 "PO-Revision-Date: 2015-07-27 20:27+0000\n"
362 "Last-Translator: Sérgio Marques <Unknown>\n"
363 "Language-Team: Portuguese <pt@li.org>\n"
364@@ -203,6 +203,9 @@
365 msgid "Disable numbered tabswitch"
366 msgstr ""
367
368+msgid "Use focus fading"
369+msgstr ""
370+
371 msgid "Set cursor type"
372 msgstr "Definir tipo de cursor"
373
374@@ -235,4 +238,3 @@
375 #, c-format
376 msgid "sakura version is %s\n"
377 msgstr "a versão do sakura é a %s\n"
378-
379
380=== modified file 'po/pt_BR.po'
381--- po/pt_BR.po 2016-01-30 07:30:12 +0000
382+++ po/pt_BR.po 2016-04-17 21:54:27 +0000
383@@ -2,7 +2,7 @@
384 msgstr ""
385 "Project-Id-Version: sakura\n"
386 "Report-Msgid-Bugs-To: \n"
387-"POT-Creation-Date: 2016-01-28 20:29+0100\n"
388+"POT-Creation-Date: 2016-04-17 22:31+0200\n"
389 "PO-Revision-Date: 2015-07-26 17:44+0000\n"
390 "Last-Translator: David Gómez <david@pleyades.net>\n"
391 "Language-Team: fabio.antunes@hotmail.com <fabio.antunes@hotmail.com>\n"
392@@ -201,6 +201,9 @@
393 msgid "Disable numbered tabswitch"
394 msgstr ""
395
396+msgid "Use focus fading"
397+msgstr ""
398+
399 msgid "Set cursor type"
400 msgstr "Definir tipo de cursor"
401
402@@ -233,4 +236,3 @@
403 #, c-format
404 msgid "sakura version is %s\n"
405 msgstr "sakura versão %s\n"
406-
407
408=== modified file 'po/ru.po'
409--- po/ru.po 2016-01-30 07:54:10 +0000
410+++ po/ru.po 2016-04-17 21:54:27 +0000
411@@ -2,7 +2,7 @@
412 msgstr ""
413 "Project-Id-Version: sakura\n"
414 "Report-Msgid-Bugs-To: \n"
415-"POT-Creation-Date: 2016-01-30 08:52+0100\n"
416+"POT-Creation-Date: 2016-04-17 22:31+0200\n"
417 "PO-Revision-Date: 2015-11-23 14:11+0000\n"
418 "Last-Translator: ManDrive <roman_romul@mail.ru>\n"
419 "Language-Team: Evgenij Vdovin <evdovin@pochta.ru>\n"
420@@ -192,6 +192,9 @@
421 msgid "Disable numbered tabswitch"
422 msgstr "Отключить нумерованный переключатель вкладок"
423
424+msgid "Use focus fading"
425+msgstr ""
426+
427 msgid "Set cursor type"
428 msgstr "Установить вид курсора"
429
430
431=== modified file 'po/sv.po'
432--- po/sv.po 2016-01-30 07:54:10 +0000
433+++ po/sv.po 2016-04-17 21:54:27 +0000
434@@ -7,7 +7,7 @@
435 msgstr ""
436 "Project-Id-Version: sakura\n"
437 "Report-Msgid-Bugs-To: \n"
438-"POT-Creation-Date: 2016-01-30 08:53+0100\n"
439+"POT-Creation-Date: 2016-04-17 22:31+0200\n"
440 "PO-Revision-Date: 2015-11-26 19:08+0000\n"
441 "Last-Translator: Andreas Rönnquist <gusnan@openmailbox.org>\n"
442 "Language-Team: Swedish <sv@li.org>\n"
443@@ -198,6 +198,9 @@
444 msgid "Disable numbered tabswitch"
445 msgstr "Inaktivera numrerad flikväxlare"
446
447+msgid "Use focus fading"
448+msgstr ""
449+
450 msgid "Set cursor type"
451 msgstr "Sätt markörtyp"
452
453
454=== modified file 'po/uk.po'
455--- po/uk.po 2016-01-30 07:54:10 +0000
456+++ po/uk.po 2016-04-17 21:54:27 +0000
457@@ -7,7 +7,7 @@
458 msgstr ""
459 "Project-Id-Version: sakura\n"
460 "Report-Msgid-Bugs-To: \n"
461-"POT-Creation-Date: 2016-01-28 20:29+0100\n"
462+"POT-Creation-Date: 2016-04-17 22:31+0200\n"
463 "PO-Revision-Date: 2014-06-23 01:17+0000\n"
464 "Last-Translator: Andriy Nezhivy <adiynziy@gmail.com>\n"
465 "Language-Team: Ukrainian <uk@li.org>\n"
466@@ -210,6 +210,9 @@
467 msgid "Disable numbered tabswitch"
468 msgstr ""
469
470+msgid "Use focus fading"
471+msgstr ""
472+
473 msgid "Set cursor type"
474 msgstr "Оберіть тип курсора"
475
476@@ -242,4 +245,3 @@
477 #, c-format
478 msgid "sakura version is %s\n"
479 msgstr "версія Sakura %s\n"
480-
481
482=== modified file 'po/zh_CN.po'
483--- po/zh_CN.po 2016-01-31 09:16:53 +0000
484+++ po/zh_CN.po 2016-04-17 21:54:27 +0000
485@@ -7,7 +7,7 @@
486 msgstr ""
487 "Project-Id-Version: sakura 1.0.4\n"
488 "Report-Msgid-Bugs-To: \n"
489-"POT-Creation-Date: 2016-01-30 08:53+0100\n"
490+"POT-Creation-Date: 2016-04-17 22:31+0200\n"
491 "PO-Revision-Date: 2016-01-30 07:05+0000\n"
492 "Last-Translator: David Gómez <david@pleyades.net>\n"
493 "Language-Team: Chinese/Simplified <i18n-translation@lists.linux.net.cn>\n"
494@@ -198,6 +198,9 @@
495 msgid "Disable numbered tabswitch"
496 msgstr "禁用编号标签开关"
497
498+msgid "Use focus fading"
499+msgstr ""
500+
501 msgid "Set cursor type"
502 msgstr "设置光标类型"
503
504
505=== modified file 'src/sakura.c'
506--- src/sakura.c 2016-01-28 19:43:36 +0000
507+++ src/sakura.c 2016-04-17 21:54:27 +0000
508@@ -43,6 +43,7 @@
509 #define _(String) gettext(String)
510 #define N_(String) (String)
511 #define GETTEXT_PACKAGE "sakura"
512+#define FADE_PERCENT 50
513
514 #define SAY(format,...) do {\
515 if (strcmp("Debug", BUILDTYPE)==0) {\
516@@ -260,6 +261,9 @@
517 bool externally_modified; /* Configuration file has been modified by another proccess */
518 bool resized;
519 bool disable_numbered_tabswitch; /* For disabling direct tabswitching key */
520+ bool focused; /* For fading feature */
521+ bool first_focus; /* Did this window already register its first WM-focus? */
522+ bool use_fading;
523 GtkWidget *item_copy_link; /* We include here only the items which need to be hidden */
524 GtkWidget *item_open_link;
525 GtkWidget *open_link_separator;
526@@ -390,6 +394,7 @@
527 static gboolean sakura_delete_event (GtkWidget *, void *);
528 static void sakura_destroy_window (GtkWidget *, void *);
529 static gboolean sakura_resized_window( GtkWidget *, GdkEventConfigure *, void *);
530+static gboolean sakura_focus_change( GtkWidget *, GdkEvent *, void *);
531 static void sakura_closebutton_clicked (GtkWidget *, void *);
532 static void sakura_conf_changed (GtkWidget *, void *);
533 static void sakura_window_show_event (GtkWidget *, gpointer);
534@@ -412,6 +417,7 @@
535 static void sakura_show_close_button (GtkWidget *widget, void *data);
536 static void sakura_show_scrollbar(GtkWidget *, void *);
537 static void sakura_disable_numbered_tabswitch (GtkWidget *, void *);
538+static void sakura_use_fading (GtkWidget *, void *);
539 static void sakura_setname_entry_changed(GtkWidget *, void *);
540
541 /* Misc */
542@@ -1311,6 +1317,29 @@
543 gtk_widget_destroy(color_dialog);
544 }
545
546+static void
547+sakura_fade_out()
548+{
549+ for( int i=0; i<NUM_COLORSETS; i++) {
550+ GdkRGBA x = sakura.forecolors[i];
551+ x.red = x.red/100.0 * FADE_PERCENT;
552+ x.green = x.green/100.0 * FADE_PERCENT;
553+ x.blue = x.blue/100.0 * FADE_PERCENT;
554+ sakura.forecolors[i]=x;
555+ }
556+}
557+
558+static void
559+sakura_fade_in()
560+{
561+ for( int i=0; i<NUM_COLORSETS; i++) {
562+ GdkRGBA x = sakura.forecolors[i];
563+ x.red = x.red/FADE_PERCENT * 100.0;
564+ x.green = x.green/FADE_PERCENT * 100.0;
565+ x.blue = x.blue/FADE_PERCENT * 100.0;
566+ sakura.forecolors[i]=x;
567+ }
568+}
569
570 static void
571 sakura_set_title_dialog (GtkWidget *widget, void *data)
572@@ -1677,6 +1706,24 @@
573 return FALSE;
574 }
575
576+static gboolean sakura_focus_change(GtkWidget *widget, GdkEvent *event, void *data)
577+{
578+ if (sakura.use_fading && event->type == GDK_FOCUS_CHANGE) {
579+ sakura.focused = !sakura.focused;
580+ if (sakura.focused) {
581+ if (!sakura.first_focus){
582+ sakura.first_focus = true;
583+ } else {
584+ sakura_fade_in();
585+ }
586+ } else {
587+ sakura_fade_out();
588+ }
589+ sakura_set_colors();
590+
591+ }
592+ return FALSE;
593+}
594
595 static void
596 sakura_setname_entry_changed (GtkWidget *widget, void *data)
597@@ -1845,6 +1892,21 @@
598 }
599 }
600
601+static void
602+sakura_use_fading(GtkWidget *widget, void *data)
603+{
604+ if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) {
605+ sakura.use_fading = true;
606+ sakura_set_config_boolean("use_fading", TRUE);
607+ } else {
608+ sakura.use_fading = false;
609+ sakura_set_config_boolean("use_fading", FALSE);
610+ sakura_fade_in();
611+ sakura_set_colors();
612+ }
613+}
614+
615+
616
617 /******* Functions ********/
618
619@@ -1981,6 +2043,11 @@
620 }
621 sakura.disable_numbered_tabswitch = g_key_file_get_boolean(sakura.cfg, cfg_group, "disable_numbered_tabswitch", NULL);
622
623+ if (!g_key_file_has_key(sakura.cfg, cfg_group, "use_fading", NULL)) {
624+ sakura_set_config_boolean("use_fading", FALSE);
625+ }
626+ sakura.use_fading = g_key_file_get_boolean(sakura.cfg, cfg_group, "use_fading", NULL);
627+
628 if (!g_key_file_has_key(sakura.cfg, cfg_group, "urgent_bell", NULL)) {
629 sakura_set_config_string("urgent_bell", "Yes");
630 }
631@@ -2230,12 +2297,18 @@
632
633 gtk_container_add(GTK_CONTAINER(sakura.main_window), sakura.notebook);
634
635+ /* Adding mask to see wheter sakura window is focused or not */
636+ gtk_widget_add_events(sakura.main_window, GDK_FOCUS_CHANGE_MASK);
637+ sakura.focused = false;
638+ sakura.first_focus = false;
639+
640 sakura_init_popup();
641
642 g_signal_connect(G_OBJECT(sakura.main_window), "delete_event", G_CALLBACK(sakura_delete_event), NULL);
643 g_signal_connect(G_OBJECT(sakura.main_window), "destroy", G_CALLBACK(sakura_destroy_window), NULL);
644 g_signal_connect(G_OBJECT(sakura.main_window), "key-press-event", G_CALLBACK(sakura_key_press), NULL);
645 g_signal_connect(G_OBJECT(sakura.main_window), "configure-event", G_CALLBACK(sakura_resized_window), NULL);
646+ g_signal_connect(G_OBJECT(sakura.main_window), "event", G_CALLBACK(sakura_focus_change), NULL);
647 g_signal_connect(G_OBJECT(sakura.main_window), "show", G_CALLBACK(sakura_window_show_event), NULL);
648 g_signal_connect(G_OBJECT(sakura.notebook), "focus-in-event", G_CALLBACK(sakura_notebook_focus_in), NULL);
649 g_signal_connect(sakura.notebook, "scroll-event", G_CALLBACK(sakura_notebook_scroll), NULL);
650@@ -2255,7 +2328,7 @@
651 *item_palette, *item_palette_tango, *item_palette_linux, *item_palette_xterm,
652 *item_palette_solarized_dark, *item_palette_solarized_light, *item_palette_gruvbox,
653 *item_show_close_button, *item_tabs_on_bottom, *item_less_questions,
654- *item_disable_numbered_tabswitch;
655+ *item_disable_numbered_tabswitch, *item_use_fading;
656 GtkWidget *options_menu, *other_options_menu, *cursor_menu, *palette_menu;
657
658 sakura.item_open_link=gtk_menu_item_new_with_label(_("Open link"));
659@@ -2283,6 +2356,7 @@
660 item_blinking_cursor=gtk_check_menu_item_new_with_label(_("Set blinking cursor"));
661 item_allow_bold=gtk_check_menu_item_new_with_label(_("Enable bold font"));
662 item_disable_numbered_tabswitch=gtk_check_menu_item_new_with_label(_("Disable numbered tabswitch"));
663+ item_use_fading=gtk_check_menu_item_new_with_label(_("Use focus fading"));
664 item_cursor=gtk_menu_item_new_with_label(_("Set cursor type"));
665 item_cursor_block=gtk_radio_menu_item_new_with_label(NULL, _("Block"));
666 item_cursor_underline=gtk_radio_menu_item_new_with_label_from_widget(GTK_RADIO_MENU_ITEM(item_cursor_block), _("Underline"));
667@@ -2334,6 +2408,12 @@
668 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item_disable_numbered_tabswitch), FALSE);
669 }
670
671+ if (sakura.use_fading) {
672+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item_use_fading), TRUE);
673+ } else {
674+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item_use_fading), FALSE);
675+ }
676+
677 if (sakura.urgent_bell) {
678 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item_urgent_bell), TRUE);
679 }
680@@ -2416,6 +2496,7 @@
681 gtk_menu_shell_append(GTK_MENU_SHELL(other_options_menu), item_urgent_bell);
682 gtk_menu_shell_append(GTK_MENU_SHELL(other_options_menu), item_audible_bell);
683 gtk_menu_shell_append(GTK_MENU_SHELL(other_options_menu), item_disable_numbered_tabswitch);
684+ gtk_menu_shell_append(GTK_MENU_SHELL(other_options_menu), item_use_fading);
685 gtk_menu_shell_append(GTK_MENU_SHELL(other_options_menu), item_blinking_cursor);
686 gtk_menu_shell_append(GTK_MENU_SHELL(other_options_menu), item_allow_bold);
687 gtk_menu_shell_append(GTK_MENU_SHELL(other_options_menu), item_cursor);
688@@ -2455,6 +2536,7 @@
689 g_signal_connect(G_OBJECT(item_allow_bold), "activate", G_CALLBACK(sakura_allow_bold), NULL);
690 g_signal_connect(G_OBJECT(item_disable_numbered_tabswitch),
691 "activate", G_CALLBACK(sakura_disable_numbered_tabswitch), NULL);
692+ g_signal_connect(G_OBJECT(item_use_fading), "activate", G_CALLBACK(sakura_use_fading), NULL);
693 g_signal_connect(G_OBJECT(item_set_title), "activate", G_CALLBACK(sakura_set_title_dialog), NULL);
694 g_signal_connect(G_OBJECT(item_cursor_block), "activate", G_CALLBACK(sakura_set_cursor), "block");
695 g_signal_connect(G_OBJECT(item_cursor_underline), "activate", G_CALLBACK(sakura_set_cursor), "underline");

Subscribers

People subscribed via source and target branches