From 493e3656d5a51a9ae5aa32881103b8f222dfdd3b Mon Sep 17 00:00:00 2001 From: "raveit65 (via Travis CI)" Date: Sun, 13 Feb 2022 18:24:36 +0000 Subject: Deploy mate-desktop/mate-indicator-applet to github.com/mate-desktop/mate-indicator-applet.git:gh-pages --- .../0.html | 1224 ++++++++++ .../index.html | 117 + .../stats.html | 105 + .../style.css | 137 ++ .../0.html | 1224 ++++++++++ .../index.html | 117 + .../stats.html | 105 + .../style.css | 137 ++ .../0.html | 1224 ++++++++++ .../index.html | 117 + .../stats.html | 105 + .../style.css | 137 ++ .../0.html | 1224 ++++++++++ .../index.html | 117 + .../stats.html | 105 + .../style.css | 137 ++ .../0.html | 1224 ++++++++++ .../index.html | 117 + .../stats.html | 105 + .../style.css | 137 ++ .../0.html | 1224 ++++++++++ .../index.html | 117 + .../stats.html | 105 + .../style.css | 137 ++ .../0.html | 1224 ++++++++++ .../index.html | 117 + .../stats.html | 105 + .../style.css | 137 ++ .../0.html | 1224 ++++++++++ .../index.html | 117 + .../stats.html | 105 + .../style.css | 137 ++ .../0.html | 1224 ++++++++++ .../index.html | 117 + .../stats.html | 105 + .../style.css | 137 ++ .../0.html | 1224 ++++++++++ .../index.html | 117 + .../stats.html | 105 + .../style.css | 137 ++ .../0.html | 1224 ++++++++++ .../index.html | 117 + .../stats.html | 105 + .../style.css | 137 ++ .../0.html | 1224 ++++++++++ .../index.html | 117 + .../stats.html | 105 + .../style.css | 137 ++ .../0.html | 1224 ++++++++++ .../index.html | 117 + .../stats.html | 105 + .../style.css | 137 ++ .../0.html | 1229 ++++++++++ .../index.html | 117 + .../stats.html | 105 + .../style.css | 137 ++ .../0.html | 1229 ++++++++++ .../index.html | 117 + .../stats.html | 105 + .../style.css | 137 ++ .../0.html | 1229 ++++++++++ .../index.html | 117 + .../stats.html | 105 + .../style.css | 137 ++ .../0.html | 2301 +++++++++++++++++++ .../1.html | 1229 ++++++++++ .../2.html | 857 +++++++ .../index.html | 122 + .../stats.html | 107 + .../style.css | 137 ++ .../0.html | 2301 +++++++++++++++++++ .../1.html | 1229 ++++++++++ .../2.html | 857 +++++++ .../index.html | 122 + .../stats.html | 107 + .../style.css | 137 ++ .../0.html | 2381 ++++++++++++++++++++ .../1.html | 1229 ++++++++++ .../2.html | 857 +++++++ .../index.html | 122 + .../stats.html | 107 + .../style.css | 137 ++ .../0.html | 2381 ++++++++++++++++++++ .../1.html | 1229 ++++++++++ .../2.html | 857 +++++++ .../index.html | 122 + .../stats.html | 107 + .../style.css | 137 ++ CNAME | 1 + index.html | 46 + 90 files changed, 44562 insertions(+) create mode 100644 2020-11-16-162302-5116-cppcheck@5fc322d26c85_USE_MATE2_MACROS/0.html create mode 100644 2020-11-16-162302-5116-cppcheck@5fc322d26c85_USE_MATE2_MACROS/index.html create mode 100644 2020-11-16-162302-5116-cppcheck@5fc322d26c85_USE_MATE2_MACROS/stats.html create mode 100644 2020-11-16-162302-5116-cppcheck@5fc322d26c85_USE_MATE2_MACROS/style.css create mode 100644 2020-12-09-074436-2078-cppcheck@4c606290f9a0_master/0.html create mode 100644 2020-12-09-074436-2078-cppcheck@4c606290f9a0_master/index.html create mode 100644 2020-12-09-074436-2078-cppcheck@4c606290f9a0_master/stats.html create mode 100644 2020-12-09-074436-2078-cppcheck@4c606290f9a0_master/style.css create mode 100644 2020-12-29-143045-9052-cppcheck@8a959f452cee_master/0.html create mode 100644 2020-12-29-143045-9052-cppcheck@8a959f452cee_master/index.html create mode 100644 2020-12-29-143045-9052-cppcheck@8a959f452cee_master/stats.html create mode 100644 2020-12-29-143045-9052-cppcheck@8a959f452cee_master/style.css create mode 100644 2021-01-16-140208-7678-cppcheck@ce8f2c9d4365_master/0.html create mode 100644 2021-01-16-140208-7678-cppcheck@ce8f2c9d4365_master/index.html create mode 100644 2021-01-16-140208-7678-cppcheck@ce8f2c9d4365_master/stats.html create mode 100644 2021-01-16-140208-7678-cppcheck@ce8f2c9d4365_master/style.css create mode 100644 2021-01-20-212148-4058-cppcheck@7a29100586b6_stock-icon/0.html create mode 100644 2021-01-20-212148-4058-cppcheck@7a29100586b6_stock-icon/index.html create mode 100644 2021-01-20-212148-4058-cppcheck@7a29100586b6_stock-icon/stats.html create mode 100644 2021-01-20-212148-4058-cppcheck@7a29100586b6_stock-icon/style.css create mode 100644 2021-01-21-060147-7874-cppcheck@0810727595b0_debian-ci-fix/0.html create mode 100644 2021-01-21-060147-7874-cppcheck@0810727595b0_debian-ci-fix/index.html create mode 100644 2021-01-21-060147-7874-cppcheck@0810727595b0_debian-ci-fix/stats.html create mode 100644 2021-01-21-060147-7874-cppcheck@0810727595b0_debian-ci-fix/style.css create mode 100644 2021-01-28-113540-2945-cppcheck@763e4e355532_PACKAGE_URL/0.html create mode 100644 2021-01-28-113540-2945-cppcheck@763e4e355532_PACKAGE_URL/index.html create mode 100644 2021-01-28-113540-2945-cppcheck@763e4e355532_PACKAGE_URL/stats.html create mode 100644 2021-01-28-113540-2945-cppcheck@763e4e355532_PACKAGE_URL/style.css create mode 100644 2021-01-31-144137-4382-cppcheck@eea6c04110f3_master/0.html create mode 100644 2021-01-31-144137-4382-cppcheck@eea6c04110f3_master/index.html create mode 100644 2021-01-31-144137-4382-cppcheck@eea6c04110f3_master/stats.html create mode 100644 2021-01-31-144137-4382-cppcheck@eea6c04110f3_master/style.css create mode 100644 2021-02-22-213320-6330-cppcheck@5105756a01af_master/0.html create mode 100644 2021-02-22-213320-6330-cppcheck@5105756a01af_master/index.html create mode 100644 2021-02-22-213320-6330-cppcheck@5105756a01af_master/stats.html create mode 100644 2021-02-22-213320-6330-cppcheck@5105756a01af_master/style.css create mode 100644 2021-02-22-214239-8048-cppcheck@5b999d3d40b8_secondary-activate/0.html create mode 100644 2021-02-22-214239-8048-cppcheck@5b999d3d40b8_secondary-activate/index.html create mode 100644 2021-02-22-214239-8048-cppcheck@5b999d3d40b8_secondary-activate/stats.html create mode 100644 2021-02-22-214239-8048-cppcheck@5b999d3d40b8_secondary-activate/style.css create mode 100644 2021-02-22-225725-0240-cppcheck@24b898a0111f_master/0.html create mode 100644 2021-02-22-225725-0240-cppcheck@24b898a0111f_master/index.html create mode 100644 2021-02-22-225725-0240-cppcheck@24b898a0111f_master/stats.html create mode 100644 2021-02-22-225725-0240-cppcheck@24b898a0111f_master/style.css create mode 100644 2021-03-08-213753-5997-cppcheck@0e63a44d86f9_master/0.html create mode 100644 2021-03-08-213753-5997-cppcheck@0e63a44d86f9_master/index.html create mode 100644 2021-03-08-213753-5997-cppcheck@0e63a44d86f9_master/stats.html create mode 100644 2021-03-08-213753-5997-cppcheck@0e63a44d86f9_master/style.css create mode 100644 2021-04-24-225231-0061-cppcheck@9971c97b5889_master/0.html create mode 100644 2021-04-24-225231-0061-cppcheck@9971c97b5889_master/index.html create mode 100644 2021-04-24-225231-0061-cppcheck@9971c97b5889_master/stats.html create mode 100644 2021-04-24-225231-0061-cppcheck@9971c97b5889_master/style.css create mode 100644 2021-05-30-124245-2675-cppcheck@59a81f1e8886_master/0.html create mode 100644 2021-05-30-124245-2675-cppcheck@59a81f1e8886_master/index.html create mode 100644 2021-05-30-124245-2675-cppcheck@59a81f1e8886_master/stats.html create mode 100644 2021-05-30-124245-2675-cppcheck@59a81f1e8886_master/style.css create mode 100644 2021-05-30-124445-8034-cppcheck@dfc13f9fbb3a_secondary-activate/0.html create mode 100644 2021-05-30-124445-8034-cppcheck@dfc13f9fbb3a_secondary-activate/index.html create mode 100644 2021-05-30-124445-8034-cppcheck@dfc13f9fbb3a_secondary-activate/stats.html create mode 100644 2021-05-30-124445-8034-cppcheck@dfc13f9fbb3a_secondary-activate/style.css create mode 100644 2021-08-08-214944-2244-cppcheck@7abc48e094fa_master/0.html create mode 100644 2021-08-08-214944-2244-cppcheck@7abc48e094fa_master/index.html create mode 100644 2021-08-08-214944-2244-cppcheck@7abc48e094fa_master/stats.html create mode 100644 2021-08-08-214944-2244-cppcheck@7abc48e094fa_master/style.css create mode 100644 2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/0.html create mode 100644 2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/1.html create mode 100644 2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/2.html create mode 100644 2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/index.html create mode 100644 2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/stats.html create mode 100644 2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/style.css create mode 100644 2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/0.html create mode 100644 2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/1.html create mode 100644 2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/2.html create mode 100644 2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/index.html create mode 100644 2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/stats.html create mode 100644 2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/style.css create mode 100644 2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/0.html create mode 100644 2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/1.html create mode 100644 2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/2.html create mode 100644 2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/index.html create mode 100644 2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/stats.html create mode 100644 2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/style.css create mode 100644 2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/0.html create mode 100644 2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/1.html create mode 100644 2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/2.html create mode 100644 2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/index.html create mode 100644 2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/stats.html create mode 100644 2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/style.css create mode 100644 CNAME create mode 100644 index.html diff --git a/2020-11-16-162302-5116-cppcheck@5fc322d26c85_USE_MATE2_MACROS/0.html b/2020-11-16-162302-5116-cppcheck@5fc322d26c85_USE_MATE2_MACROS/0.html new file mode 100644 index 0000000..eb5d8e4 --- /dev/null +++ b/2020-11-16-162302-5116-cppcheck@5fc322d26c85_USE_MATE2_MACROS/0.html @@ -0,0 +1,1224 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
/* eggaccelerators.c
+ * Copyright (C) 2002  Red Hat, Inc.; Copyright 1998, 2001 Tim Janik
+ * Developed by Havoc Pennington, Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+
+#include "eggaccelerators.h"
+
+#include <string.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
+
+enum
+{
+  EGG_MODMAP_ENTRY_SHIFT   = 0,
+  EGG_MODMAP_ENTRY_LOCK    = 1,
+  EGG_MODMAP_ENTRY_CONTROL = 2,
+  EGG_MODMAP_ENTRY_MOD1    = 3,
+  EGG_MODMAP_ENTRY_MOD2    = 4,
+  EGG_MODMAP_ENTRY_MOD3    = 5,
+  EGG_MODMAP_ENTRY_MOD4    = 6,
+  EGG_MODMAP_ENTRY_MOD5    = 7,
+  EGG_MODMAP_ENTRY_LAST    = 8
+};
+
+#define MODMAP_ENTRY_TO_MODIFIER(x) (1 << (x))
+
+typedef struct
+{
+  EggVirtualModifierType mapping[EGG_MODMAP_ENTRY_LAST];
+
+} EggModmap;
+
+const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap);
+
+static inline gboolean
+is_alt (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'a' || string[1] == 'A') &&
+	  (string[2] == 'l' || string[2] == 'L') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_ctl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_modx (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'd' || string[3] == 'D') &&
+	  (string[4] >= '1' && string[4] <= '5') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_ctrl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'r' || string[3] == 'R') &&
+	  (string[4] == 'l' || string[4] == 'L') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shft (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'f' || string[3] == 'F') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shift (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'i' || string[3] == 'I') &&
+	  (string[4] == 'f' || string[4] == 'F') &&
+	  (string[5] == 't' || string[5] == 'T') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_control (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'n' || string[3] == 'N') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == 'o' || string[6] == 'O') &&
+	  (string[7] == 'l' || string[7] == 'L') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_release (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'r' || string[1] == 'R') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'a' || string[5] == 'A') &&
+	  (string[6] == 's' || string[6] == 'S') &&
+	  (string[7] == 'e' || string[7] == 'E') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_meta (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == 'a' || string[4] == 'A') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_super (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'u' || string[2] == 'U') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_hyper (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'h' || string[1] == 'H') &&
+	  (string[2] == 'y' || string[2] == 'Y') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+/**
+ * egg_accelerator_parse_virtual:
+ * @accelerator:      string representing an accelerator
+ * @accelerator_key:  return location for accelerator keyval
+ * @accelerator_mods: return location for accelerator modifier mask
+ *
+ * Parses a string representing a virtual accelerator. The format
+ * looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1" or
+ * "&lt;Release&gt;z" (the last one is for key release).  The parser
+ * is fairly liberal and allows lower or upper case, and also
+ * abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;".
+ *
+ * If the parse fails, @accelerator_key and @accelerator_mods will
+ * be set to 0 (zero) and %FALSE will be returned. If the string contains
+ * only modifiers, @accelerator_key will be set to 0 but %TRUE will be
+ * returned.
+ *
+ * The virtual vs. concrete accelerator distinction is a relic of
+ * how the X Window System works; there are modifiers Mod2-Mod5 that
+ * can represent various keyboard keys (numlock, meta, hyper, etc.),
+ * the virtual modifier represents the keyboard key, the concrete
+ * modifier the actual Mod2-Mod5 bits in the key press event.
+ *
+ * Returns: %TRUE on success.
+ */
+gboolean
+egg_accelerator_parse_virtual (const gchar            *accelerator,
+                               guint                  *accelerator_key,
+                               EggVirtualModifierType *accelerator_mods)
+{
+  guint keyval;
+  GdkModifierType mods;
+  gint len;
+  gboolean bad_keyval;
+
+  if (accelerator_key)
+    *accelerator_key = 0;
+  if (accelerator_mods)
+    *accelerator_mods = 0;
+
+  g_return_val_if_fail (accelerator != NULL, FALSE);
+
+  bad_keyval = FALSE;
+
+  keyval = 0;
+  mods = 0;
+  len = strlen (accelerator);
+  while (len)
+    {
+      if (*accelerator == '<')
+	{
+	  if (len >= 9 && is_release (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_RELEASE_MASK;
+	    }
+	  else if (len >= 9 && is_control (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 7 && is_shift (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_shft (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_ctrl (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 6 && is_modx (accelerator))
+	    {
+	      static const guint mod_vals[] = {
+		EGG_VIRTUAL_ALT_MASK, EGG_VIRTUAL_MOD2_MASK, EGG_VIRTUAL_MOD3_MASK,
+		EGG_VIRTUAL_MOD4_MASK, EGG_VIRTUAL_MOD5_MASK
+	      };
+
+	      len -= 6;
+	      accelerator += 4;
+	      mods |= mod_vals[*accelerator - '1'];
+	      accelerator += 2;
+	    }
+	  else if (len >= 5 && is_ctl (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 5 && is_alt (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_ALT_MASK;
+	    }
+          else if (len >= 6 && is_meta (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_META_MASK;
+	    }
+          else if (len >= 7 && is_hyper (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_HYPER_MASK;
+	    }
+          else if (len >= 7 && is_super (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SUPER_MASK;
+	    }
+	  else
+	    {
+	      gchar last_ch;
+
+	      last_ch = *accelerator;
+	      while (last_ch && last_ch != '>')
+		{
+		  last_ch = *accelerator;
+		  accelerator += 1;
+		  len -= 1;
+		}
+	    }
+	}
+      else
+	{
+          keyval = gdk_keyval_from_name (accelerator);
+
+          if (keyval == 0)
+            bad_keyval = TRUE;
+
+          accelerator += len;
+          len -= len;
+	}
+    }
+
+  if (accelerator_key)
+    *accelerator_key = gdk_keyval_to_lower (keyval);
+  if (accelerator_mods)
+    *accelerator_mods = mods;
+
+  return !bad_keyval;
+}
+
+void
+egg_keymap_resolve_virtual_modifiers (GdkKeymap              *keymap,
+                                      EggVirtualModifierType  virtual_mods,
+                                      GdkModifierType        *concrete_mods)
+{
+  GdkModifierType concrete;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (concrete_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  concrete = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if (modmap->mapping[i] & virtual_mods)
+        concrete |= (1 << i);
+
+      ++i;
+    }
+
+  *concrete_mods = concrete;
+}
+
+void
+egg_keymap_virtualize_modifiers (GdkKeymap              *keymap,
+                                 GdkModifierType         concrete_mods,
+                                 EggVirtualModifierType *virtual_mods)
+{
+  GdkModifierType virtual;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (virtual_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  virtual = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if ((1 << i) & concrete_mods)
+        {
+          EggVirtualModifierType cleaned;
+
+          cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK |
+                                           EGG_VIRTUAL_MOD3_MASK |
+                                           EGG_VIRTUAL_MOD4_MASK |
+                                           EGG_VIRTUAL_MOD5_MASK);
+
+          if (cleaned != 0)
+            {
+              virtual |= cleaned;
+            }
+          else
+            {
+              /* Rather than dropping mod2->mod5 if not bound,
+               * go ahead and use the concrete names
+               */
+              virtual |= modmap->mapping[i];
+            }
+        }
+
+      ++i;
+    }
+
+  *virtual_mods = virtual;
+}
+
+static void
+reload_modmap (GdkKeymap *keymap,
+               EggModmap *modmap)
+{
+  XModifierKeymap *xmodmap;
+  int map_size;
+  int i;
+
+  /* FIXME multihead */
+  xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ());
+
+  memset (modmap->mapping, 0, sizeof (modmap->mapping));
+
+  /* there are 8 modifiers, and the first 3 are shift, shift lock,
+   * and control
+   */
+  map_size = 8 * xmodmap->max_keypermod;
+  i = 3 * xmodmap->max_keypermod;
+  while (i < map_size)
+    {
+      /* get the key code at this point in the map,
+       * see if its keysym is one we're interested in
+       */
+      int keycode = xmodmap->modifiermap[i];
+      GdkKeymapKey *keys;
+      guint *keyvals;
+      int n_entries;
+      int j;
+      EggVirtualModifierType mask;
+
+      keys = NULL;
+      keyvals = NULL;
+      n_entries = 0;
+
+      gdk_keymap_get_entries_for_keycode (keymap,
+                                          keycode,
+                                          &keys, &keyvals, &n_entries);
+
+      mask = 0;
+      j = 0;
+      while (j < n_entries)
+        {
+          if (keyvals[j] == GDK_KEY_Num_Lock)
+            mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Scroll_Lock)
+            mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Meta_L ||
+                   keyvals[j] == GDK_KEY_Meta_R)
+            mask |= EGG_VIRTUAL_META_MASK;
+          else if (keyvals[j] == GDK_KEY_Hyper_L ||
+                   keyvals[j] == GDK_KEY_Hyper_R)
+            mask |= EGG_VIRTUAL_HYPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Super_L ||
+                   keyvals[j] == GDK_KEY_Super_R)
+            mask |= EGG_VIRTUAL_SUPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Mode_switch)
+            mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
+
+          ++j;
+        }
+
+      /* Mod1Mask is 1 << 3 for example, i.e. the
+       * fourth modifier, i / keyspermod is the modifier
+       * index
+       */
+      modmap->mapping[i/xmodmap->max_keypermod] |= mask;
+
+      g_free (keyvals);
+      g_free (keys);
+
+      ++i;
+    }
+
+  /* Add in the not-really-virtual fixed entries */
+  modmap->mapping[EGG_MODMAP_ENTRY_SHIFT] |= EGG_VIRTUAL_SHIFT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_CONTROL] |= EGG_VIRTUAL_CONTROL_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_LOCK] |= EGG_VIRTUAL_LOCK_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD1] |= EGG_VIRTUAL_ALT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD2] |= EGG_VIRTUAL_MOD2_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK;
+
+  XFreeModifiermap (xmodmap);
+}
+
+const EggModmap*
+egg_keymap_get_modmap (GdkKeymap *keymap)
+{
+  EggModmap *modmap;
+
+  /* This is all a hack, much simpler when we can just
+   * modify GDK directly.
+   */
+
+  modmap = g_object_get_data (G_OBJECT (keymap),
+                              "egg-modmap");
+
+  if (modmap == NULL)
+    {
+      modmap = g_new0 (EggModmap, 1);
+
+      /* FIXME modify keymap change events with an event filter
+       * and force a reload if we get one
+       */
+
+      reload_modmap (keymap, modmap);
+
+      g_object_set_data_full (G_OBJECT (keymap),
+                              "egg-modmap",
+                              modmap,
+                              g_free);
+    }
+
+  g_assert (modmap != NULL);
+
+  return modmap;
+}
+
+
+
+
+ + + diff --git a/2020-11-16-162302-5116-cppcheck@5fc322d26c85_USE_MATE2_MACROS/index.html b/2020-11-16-162302-5116-cppcheck@5fc322d26c85_USE_MATE2_MACROS/index.html new file mode 100644 index 0000000..a0f0e6e --- /dev/null +++ b/2020-11-16-162302-5116-cppcheck@5fc322d26c85_USE_MATE2_MACROS/index.html @@ -0,0 +1,117 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+ + + + + + + +
LineIdCWESeverityMessage
0missingIncludeSysteminformationCppcheck cannot find all the include files (use --check-config for details)
src/eggaccelerators.c
321duplicateExpression398styleSame expression on both sides of '-='.
+
+
+ + + diff --git a/2020-11-16-162302-5116-cppcheck@5fc322d26c85_USE_MATE2_MACROS/stats.html b/2020-11-16-162302-5116-cppcheck@5fc322d26c85_USE_MATE2_MACROS/stats.html new file mode 100644 index 0000000..17224ca --- /dev/null +++ b/2020-11-16-162302-5116-cppcheck@5fc322d26c85_USE_MATE2_MACROS/stats.html @@ -0,0 +1,105 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+

Top 10 files for style severity, total findings: 1
+   1  src/eggaccelerators.c
+

+ +
+
+ + + diff --git a/2020-11-16-162302-5116-cppcheck@5fc322d26c85_USE_MATE2_MACROS/style.css b/2020-11-16-162302-5116-cppcheck@5fc322d26c85_USE_MATE2_MACROS/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2020-11-16-162302-5116-cppcheck@5fc322d26c85_USE_MATE2_MACROS/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2020-12-09-074436-2078-cppcheck@4c606290f9a0_master/0.html b/2020-12-09-074436-2078-cppcheck@4c606290f9a0_master/0.html new file mode 100644 index 0000000..eb5d8e4 --- /dev/null +++ b/2020-12-09-074436-2078-cppcheck@4c606290f9a0_master/0.html @@ -0,0 +1,1224 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
/* eggaccelerators.c
+ * Copyright (C) 2002  Red Hat, Inc.; Copyright 1998, 2001 Tim Janik
+ * Developed by Havoc Pennington, Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+
+#include "eggaccelerators.h"
+
+#include <string.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
+
+enum
+{
+  EGG_MODMAP_ENTRY_SHIFT   = 0,
+  EGG_MODMAP_ENTRY_LOCK    = 1,
+  EGG_MODMAP_ENTRY_CONTROL = 2,
+  EGG_MODMAP_ENTRY_MOD1    = 3,
+  EGG_MODMAP_ENTRY_MOD2    = 4,
+  EGG_MODMAP_ENTRY_MOD3    = 5,
+  EGG_MODMAP_ENTRY_MOD4    = 6,
+  EGG_MODMAP_ENTRY_MOD5    = 7,
+  EGG_MODMAP_ENTRY_LAST    = 8
+};
+
+#define MODMAP_ENTRY_TO_MODIFIER(x) (1 << (x))
+
+typedef struct
+{
+  EggVirtualModifierType mapping[EGG_MODMAP_ENTRY_LAST];
+
+} EggModmap;
+
+const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap);
+
+static inline gboolean
+is_alt (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'a' || string[1] == 'A') &&
+	  (string[2] == 'l' || string[2] == 'L') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_ctl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_modx (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'd' || string[3] == 'D') &&
+	  (string[4] >= '1' && string[4] <= '5') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_ctrl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'r' || string[3] == 'R') &&
+	  (string[4] == 'l' || string[4] == 'L') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shft (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'f' || string[3] == 'F') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shift (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'i' || string[3] == 'I') &&
+	  (string[4] == 'f' || string[4] == 'F') &&
+	  (string[5] == 't' || string[5] == 'T') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_control (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'n' || string[3] == 'N') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == 'o' || string[6] == 'O') &&
+	  (string[7] == 'l' || string[7] == 'L') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_release (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'r' || string[1] == 'R') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'a' || string[5] == 'A') &&
+	  (string[6] == 's' || string[6] == 'S') &&
+	  (string[7] == 'e' || string[7] == 'E') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_meta (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == 'a' || string[4] == 'A') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_super (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'u' || string[2] == 'U') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_hyper (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'h' || string[1] == 'H') &&
+	  (string[2] == 'y' || string[2] == 'Y') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+/**
+ * egg_accelerator_parse_virtual:
+ * @accelerator:      string representing an accelerator
+ * @accelerator_key:  return location for accelerator keyval
+ * @accelerator_mods: return location for accelerator modifier mask
+ *
+ * Parses a string representing a virtual accelerator. The format
+ * looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1" or
+ * "&lt;Release&gt;z" (the last one is for key release).  The parser
+ * is fairly liberal and allows lower or upper case, and also
+ * abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;".
+ *
+ * If the parse fails, @accelerator_key and @accelerator_mods will
+ * be set to 0 (zero) and %FALSE will be returned. If the string contains
+ * only modifiers, @accelerator_key will be set to 0 but %TRUE will be
+ * returned.
+ *
+ * The virtual vs. concrete accelerator distinction is a relic of
+ * how the X Window System works; there are modifiers Mod2-Mod5 that
+ * can represent various keyboard keys (numlock, meta, hyper, etc.),
+ * the virtual modifier represents the keyboard key, the concrete
+ * modifier the actual Mod2-Mod5 bits in the key press event.
+ *
+ * Returns: %TRUE on success.
+ */
+gboolean
+egg_accelerator_parse_virtual (const gchar            *accelerator,
+                               guint                  *accelerator_key,
+                               EggVirtualModifierType *accelerator_mods)
+{
+  guint keyval;
+  GdkModifierType mods;
+  gint len;
+  gboolean bad_keyval;
+
+  if (accelerator_key)
+    *accelerator_key = 0;
+  if (accelerator_mods)
+    *accelerator_mods = 0;
+
+  g_return_val_if_fail (accelerator != NULL, FALSE);
+
+  bad_keyval = FALSE;
+
+  keyval = 0;
+  mods = 0;
+  len = strlen (accelerator);
+  while (len)
+    {
+      if (*accelerator == '<')
+	{
+	  if (len >= 9 && is_release (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_RELEASE_MASK;
+	    }
+	  else if (len >= 9 && is_control (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 7 && is_shift (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_shft (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_ctrl (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 6 && is_modx (accelerator))
+	    {
+	      static const guint mod_vals[] = {
+		EGG_VIRTUAL_ALT_MASK, EGG_VIRTUAL_MOD2_MASK, EGG_VIRTUAL_MOD3_MASK,
+		EGG_VIRTUAL_MOD4_MASK, EGG_VIRTUAL_MOD5_MASK
+	      };
+
+	      len -= 6;
+	      accelerator += 4;
+	      mods |= mod_vals[*accelerator - '1'];
+	      accelerator += 2;
+	    }
+	  else if (len >= 5 && is_ctl (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 5 && is_alt (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_ALT_MASK;
+	    }
+          else if (len >= 6 && is_meta (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_META_MASK;
+	    }
+          else if (len >= 7 && is_hyper (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_HYPER_MASK;
+	    }
+          else if (len >= 7 && is_super (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SUPER_MASK;
+	    }
+	  else
+	    {
+	      gchar last_ch;
+
+	      last_ch = *accelerator;
+	      while (last_ch && last_ch != '>')
+		{
+		  last_ch = *accelerator;
+		  accelerator += 1;
+		  len -= 1;
+		}
+	    }
+	}
+      else
+	{
+          keyval = gdk_keyval_from_name (accelerator);
+
+          if (keyval == 0)
+            bad_keyval = TRUE;
+
+          accelerator += len;
+          len -= len;
+	}
+    }
+
+  if (accelerator_key)
+    *accelerator_key = gdk_keyval_to_lower (keyval);
+  if (accelerator_mods)
+    *accelerator_mods = mods;
+
+  return !bad_keyval;
+}
+
+void
+egg_keymap_resolve_virtual_modifiers (GdkKeymap              *keymap,
+                                      EggVirtualModifierType  virtual_mods,
+                                      GdkModifierType        *concrete_mods)
+{
+  GdkModifierType concrete;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (concrete_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  concrete = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if (modmap->mapping[i] & virtual_mods)
+        concrete |= (1 << i);
+
+      ++i;
+    }
+
+  *concrete_mods = concrete;
+}
+
+void
+egg_keymap_virtualize_modifiers (GdkKeymap              *keymap,
+                                 GdkModifierType         concrete_mods,
+                                 EggVirtualModifierType *virtual_mods)
+{
+  GdkModifierType virtual;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (virtual_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  virtual = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if ((1 << i) & concrete_mods)
+        {
+          EggVirtualModifierType cleaned;
+
+          cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK |
+                                           EGG_VIRTUAL_MOD3_MASK |
+                                           EGG_VIRTUAL_MOD4_MASK |
+                                           EGG_VIRTUAL_MOD5_MASK);
+
+          if (cleaned != 0)
+            {
+              virtual |= cleaned;
+            }
+          else
+            {
+              /* Rather than dropping mod2->mod5 if not bound,
+               * go ahead and use the concrete names
+               */
+              virtual |= modmap->mapping[i];
+            }
+        }
+
+      ++i;
+    }
+
+  *virtual_mods = virtual;
+}
+
+static void
+reload_modmap (GdkKeymap *keymap,
+               EggModmap *modmap)
+{
+  XModifierKeymap *xmodmap;
+  int map_size;
+  int i;
+
+  /* FIXME multihead */
+  xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ());
+
+  memset (modmap->mapping, 0, sizeof (modmap->mapping));
+
+  /* there are 8 modifiers, and the first 3 are shift, shift lock,
+   * and control
+   */
+  map_size = 8 * xmodmap->max_keypermod;
+  i = 3 * xmodmap->max_keypermod;
+  while (i < map_size)
+    {
+      /* get the key code at this point in the map,
+       * see if its keysym is one we're interested in
+       */
+      int keycode = xmodmap->modifiermap[i];
+      GdkKeymapKey *keys;
+      guint *keyvals;
+      int n_entries;
+      int j;
+      EggVirtualModifierType mask;
+
+      keys = NULL;
+      keyvals = NULL;
+      n_entries = 0;
+
+      gdk_keymap_get_entries_for_keycode (keymap,
+                                          keycode,
+                                          &keys, &keyvals, &n_entries);
+
+      mask = 0;
+      j = 0;
+      while (j < n_entries)
+        {
+          if (keyvals[j] == GDK_KEY_Num_Lock)
+            mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Scroll_Lock)
+            mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Meta_L ||
+                   keyvals[j] == GDK_KEY_Meta_R)
+            mask |= EGG_VIRTUAL_META_MASK;
+          else if (keyvals[j] == GDK_KEY_Hyper_L ||
+                   keyvals[j] == GDK_KEY_Hyper_R)
+            mask |= EGG_VIRTUAL_HYPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Super_L ||
+                   keyvals[j] == GDK_KEY_Super_R)
+            mask |= EGG_VIRTUAL_SUPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Mode_switch)
+            mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
+
+          ++j;
+        }
+
+      /* Mod1Mask is 1 << 3 for example, i.e. the
+       * fourth modifier, i / keyspermod is the modifier
+       * index
+       */
+      modmap->mapping[i/xmodmap->max_keypermod] |= mask;
+
+      g_free (keyvals);
+      g_free (keys);
+
+      ++i;
+    }
+
+  /* Add in the not-really-virtual fixed entries */
+  modmap->mapping[EGG_MODMAP_ENTRY_SHIFT] |= EGG_VIRTUAL_SHIFT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_CONTROL] |= EGG_VIRTUAL_CONTROL_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_LOCK] |= EGG_VIRTUAL_LOCK_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD1] |= EGG_VIRTUAL_ALT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD2] |= EGG_VIRTUAL_MOD2_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK;
+
+  XFreeModifiermap (xmodmap);
+}
+
+const EggModmap*
+egg_keymap_get_modmap (GdkKeymap *keymap)
+{
+  EggModmap *modmap;
+
+  /* This is all a hack, much simpler when we can just
+   * modify GDK directly.
+   */
+
+  modmap = g_object_get_data (G_OBJECT (keymap),
+                              "egg-modmap");
+
+  if (modmap == NULL)
+    {
+      modmap = g_new0 (EggModmap, 1);
+
+      /* FIXME modify keymap change events with an event filter
+       * and force a reload if we get one
+       */
+
+      reload_modmap (keymap, modmap);
+
+      g_object_set_data_full (G_OBJECT (keymap),
+                              "egg-modmap",
+                              modmap,
+                              g_free);
+    }
+
+  g_assert (modmap != NULL);
+
+  return modmap;
+}
+
+
+
+
+ + + diff --git a/2020-12-09-074436-2078-cppcheck@4c606290f9a0_master/index.html b/2020-12-09-074436-2078-cppcheck@4c606290f9a0_master/index.html new file mode 100644 index 0000000..a0f0e6e --- /dev/null +++ b/2020-12-09-074436-2078-cppcheck@4c606290f9a0_master/index.html @@ -0,0 +1,117 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+ + + + + + + +
LineIdCWESeverityMessage
0missingIncludeSysteminformationCppcheck cannot find all the include files (use --check-config for details)
src/eggaccelerators.c
321duplicateExpression398styleSame expression on both sides of '-='.
+
+
+ + + diff --git a/2020-12-09-074436-2078-cppcheck@4c606290f9a0_master/stats.html b/2020-12-09-074436-2078-cppcheck@4c606290f9a0_master/stats.html new file mode 100644 index 0000000..17224ca --- /dev/null +++ b/2020-12-09-074436-2078-cppcheck@4c606290f9a0_master/stats.html @@ -0,0 +1,105 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+

Top 10 files for style severity, total findings: 1
+   1  src/eggaccelerators.c
+

+ +
+
+ + + diff --git a/2020-12-09-074436-2078-cppcheck@4c606290f9a0_master/style.css b/2020-12-09-074436-2078-cppcheck@4c606290f9a0_master/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2020-12-09-074436-2078-cppcheck@4c606290f9a0_master/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2020-12-29-143045-9052-cppcheck@8a959f452cee_master/0.html b/2020-12-29-143045-9052-cppcheck@8a959f452cee_master/0.html new file mode 100644 index 0000000..0ea3181 --- /dev/null +++ b/2020-12-29-143045-9052-cppcheck@8a959f452cee_master/0.html @@ -0,0 +1,1224 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
/* eggaccelerators.c
+ * Copyright (C) 2002  Red Hat, Inc.; Copyright 1998, 2001 Tim Janik
+ * Developed by Havoc Pennington, Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+
+#include "eggaccelerators.h"
+
+#include <string.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
+
+enum
+{
+  EGG_MODMAP_ENTRY_SHIFT   = 0,
+  EGG_MODMAP_ENTRY_LOCK    = 1,
+  EGG_MODMAP_ENTRY_CONTROL = 2,
+  EGG_MODMAP_ENTRY_MOD1    = 3,
+  EGG_MODMAP_ENTRY_MOD2    = 4,
+  EGG_MODMAP_ENTRY_MOD3    = 5,
+  EGG_MODMAP_ENTRY_MOD4    = 6,
+  EGG_MODMAP_ENTRY_MOD5    = 7,
+  EGG_MODMAP_ENTRY_LAST    = 8
+};
+
+#define MODMAP_ENTRY_TO_MODIFIER(x) (1 << (x))
+
+typedef struct
+{
+  EggVirtualModifierType mapping[EGG_MODMAP_ENTRY_LAST];
+
+} EggModmap;
+
+const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap);
+
+static inline gboolean
+is_alt (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'a' || string[1] == 'A') &&
+	  (string[2] == 'l' || string[2] == 'L') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_ctl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_modx (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'd' || string[3] == 'D') &&
+	  (string[4] >= '1' && string[4] <= '5') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_ctrl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'r' || string[3] == 'R') &&
+	  (string[4] == 'l' || string[4] == 'L') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shft (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'f' || string[3] == 'F') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shift (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'i' || string[3] == 'I') &&
+	  (string[4] == 'f' || string[4] == 'F') &&
+	  (string[5] == 't' || string[5] == 'T') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_control (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'n' || string[3] == 'N') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == 'o' || string[6] == 'O') &&
+	  (string[7] == 'l' || string[7] == 'L') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_release (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'r' || string[1] == 'R') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'a' || string[5] == 'A') &&
+	  (string[6] == 's' || string[6] == 'S') &&
+	  (string[7] == 'e' || string[7] == 'E') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_meta (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == 'a' || string[4] == 'A') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_super (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'u' || string[2] == 'U') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_hyper (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'h' || string[1] == 'H') &&
+	  (string[2] == 'y' || string[2] == 'Y') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+/**
+ * egg_accelerator_parse_virtual:
+ * @accelerator:      string representing an accelerator
+ * @accelerator_key:  return location for accelerator keyval
+ * @accelerator_mods: return location for accelerator modifier mask
+ *
+ * Parses a string representing a virtual accelerator. The format
+ * looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1" or
+ * "&lt;Release&gt;z" (the last one is for key release).  The parser
+ * is fairly liberal and allows lower or upper case, and also
+ * abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;".
+ *
+ * If the parse fails, @accelerator_key and @accelerator_mods will
+ * be set to 0 (zero) and %FALSE will be returned. If the string contains
+ * only modifiers, @accelerator_key will be set to 0 but %TRUE will be
+ * returned.
+ *
+ * The virtual vs. concrete accelerator distinction is a relic of
+ * how the X Window System works; there are modifiers Mod2-Mod5 that
+ * can represent various keyboard keys (numlock, meta, hyper, etc.),
+ * the virtual modifier represents the keyboard key, the concrete
+ * modifier the actual Mod2-Mod5 bits in the key press event.
+ *
+ * Returns: %TRUE on success.
+ */
+gboolean
+egg_accelerator_parse_virtual (const gchar            *accelerator,
+                               guint                  *accelerator_key,
+                               EggVirtualModifierType *accelerator_mods)
+{
+  guint keyval;
+  GdkModifierType mods;
+  gint len;
+  gboolean bad_keyval;
+
+  if (accelerator_key)
+    *accelerator_key = 0;
+  if (accelerator_mods)
+    *accelerator_mods = 0;
+
+  g_return_val_if_fail (accelerator != NULL, FALSE);
+
+  bad_keyval = FALSE;
+
+  keyval = 0;
+  mods = 0;
+  len = strlen (accelerator);
+  while (len)
+    {
+      if (*accelerator == '<')
+	{
+	  if (len >= 9 && is_release (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_RELEASE_MASK;
+	    }
+	  else if (len >= 9 && is_control (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 7 && is_shift (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_shft (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_ctrl (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 6 && is_modx (accelerator))
+	    {
+	      static const guint mod_vals[] = {
+		EGG_VIRTUAL_ALT_MASK, EGG_VIRTUAL_MOD2_MASK, EGG_VIRTUAL_MOD3_MASK,
+		EGG_VIRTUAL_MOD4_MASK, EGG_VIRTUAL_MOD5_MASK
+	      };
+
+	      len -= 6;
+	      accelerator += 4;
+	      mods |= mod_vals[*accelerator - '1'];
+	      accelerator += 2;
+	    }
+	  else if (len >= 5 && is_ctl (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 5 && is_alt (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_ALT_MASK;
+	    }
+          else if (len >= 6 && is_meta (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_META_MASK;
+	    }
+          else if (len >= 7 && is_hyper (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_HYPER_MASK;
+	    }
+          else if (len >= 7 && is_super (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SUPER_MASK;
+	    }
+	  else
+	    {
+	      gchar last_ch;
+
+	      last_ch = *accelerator;
+	      while (last_ch && last_ch != '>')
+		{
+		  last_ch = *accelerator;
+		  accelerator += 1;
+		  len -= 1;
+		}
+	    }
+	}
+      else
+	{
+          keyval = gdk_keyval_from_name (accelerator);
+
+          if (keyval == 0)
+            bad_keyval = TRUE;
+
+          accelerator += len;
+          len -= len;
+	}
+    }
+
+  if (accelerator_key)
+    *accelerator_key = gdk_keyval_to_lower (keyval);
+  if (accelerator_mods)
+    *accelerator_mods = mods;
+
+  return !bad_keyval;
+}
+
+void
+egg_keymap_resolve_virtual_modifiers (GdkKeymap              *keymap,
+                                      EggVirtualModifierType  virtual_mods,
+                                      GdkModifierType        *concrete_mods)
+{
+  GdkModifierType concrete;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (concrete_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  concrete = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if (modmap->mapping[i] & virtual_mods)
+        concrete |= (1 << i);
+
+      ++i;
+    }
+
+  *concrete_mods = concrete;
+}
+
+void
+egg_keymap_virtualize_modifiers (GdkKeymap              *keymap,
+                                 GdkModifierType         concrete_mods,
+                                 EggVirtualModifierType *virtual_mods)
+{
+  GdkModifierType virtual;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (virtual_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  virtual = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if ((1 << i) & concrete_mods)
+        {
+          EggVirtualModifierType cleaned;
+
+          cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK |
+                                           EGG_VIRTUAL_MOD3_MASK |
+                                           EGG_VIRTUAL_MOD4_MASK |
+                                           EGG_VIRTUAL_MOD5_MASK);
+
+          if (cleaned != 0)
+            {
+              virtual |= cleaned;
+            }
+          else
+            {
+              /* Rather than dropping mod2->mod5 if not bound,
+               * go ahead and use the concrete names
+               */
+              virtual |= modmap->mapping[i];
+            }
+        }
+
+      ++i;
+    }
+
+  *virtual_mods = virtual;
+}
+
+static void
+reload_modmap (GdkKeymap *keymap,
+               EggModmap *modmap)
+{
+  XModifierKeymap *xmodmap;
+  int map_size;
+  int i;
+
+  /* FIXME multihead */
+  xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ());
+
+  memset (modmap->mapping, 0, sizeof (modmap->mapping));
+
+  /* there are 8 modifiers, and the first 3 are shift, shift lock,
+   * and control
+   */
+  map_size = 8 * xmodmap->max_keypermod;
+  i = 3 * xmodmap->max_keypermod;
+  while (i < map_size)
+    {
+      /* get the key code at this point in the map,
+       * see if its keysym is one we're interested in
+       */
+      int keycode = xmodmap->modifiermap[i];
+      GdkKeymapKey *keys;
+      guint *keyvals;
+      int n_entries;
+      int j;
+      EggVirtualModifierType mask;
+
+      keys = NULL;
+      keyvals = NULL;
+      n_entries = 0;
+
+      gdk_keymap_get_entries_for_keycode (keymap,
+                                          keycode,
+                                          &keys, &keyvals, &n_entries);
+
+      mask = 0;
+      j = 0;
+      while (j < n_entries)
+        {
+          if (keyvals[j] == GDK_KEY_Num_Lock)
+            mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Scroll_Lock)
+            mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Meta_L ||
+                   keyvals[j] == GDK_KEY_Meta_R)
+            mask |= EGG_VIRTUAL_META_MASK;
+          else if (keyvals[j] == GDK_KEY_Hyper_L ||
+                   keyvals[j] == GDK_KEY_Hyper_R)
+            mask |= EGG_VIRTUAL_HYPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Super_L ||
+                   keyvals[j] == GDK_KEY_Super_R)
+            mask |= EGG_VIRTUAL_SUPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Mode_switch)
+            mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
+
+          ++j;
+        }
+
+      /* Mod1Mask is 1 << 3 for example, i.e. the
+       * fourth modifier, i / keyspermod is the modifier
+       * index
+       */
+      modmap->mapping[i/xmodmap->max_keypermod] |= mask;
+
+      g_free (keyvals);
+      g_free (keys);
+
+      ++i;
+    }
+
+  /* Add in the not-really-virtual fixed entries */
+  modmap->mapping[EGG_MODMAP_ENTRY_SHIFT] |= EGG_VIRTUAL_SHIFT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_CONTROL] |= EGG_VIRTUAL_CONTROL_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_LOCK] |= EGG_VIRTUAL_LOCK_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD1] |= EGG_VIRTUAL_ALT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD2] |= EGG_VIRTUAL_MOD2_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK;
+
+  XFreeModifiermap (xmodmap);
+}
+
+const EggModmap*
+egg_keymap_get_modmap (GdkKeymap *keymap)
+{
+  EggModmap *modmap;
+
+  /* This is all a hack, much simpler when we can just
+   * modify GDK directly.
+   */
+
+  modmap = g_object_get_data (G_OBJECT (keymap),
+                              "egg-modmap");
+
+  if (modmap == NULL)
+    {
+      modmap = g_new0 (EggModmap, 1);
+
+      /* FIXME modify keymap change events with an event filter
+       * and force a reload if we get one
+       */
+
+      reload_modmap (keymap, modmap);
+
+      g_object_set_data_full (G_OBJECT (keymap),
+                              "egg-modmap",
+                              modmap,
+                              g_free);
+    }
+
+  g_assert (modmap != NULL);
+
+  return modmap;
+}
+
+
+
+
+ + + diff --git a/2020-12-29-143045-9052-cppcheck@8a959f452cee_master/index.html b/2020-12-29-143045-9052-cppcheck@8a959f452cee_master/index.html new file mode 100644 index 0000000..fee3cf9 --- /dev/null +++ b/2020-12-29-143045-9052-cppcheck@8a959f452cee_master/index.html @@ -0,0 +1,117 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+ + + + + + + +
LineIdCWESeverityMessage
0missingIncludeSysteminformationCppcheck cannot find all the include files (use --check-config for details)
src/eggaccelerators.c
321duplicateExpression398styleSame expression on both sides of '-='.
+
+
+ + + diff --git a/2020-12-29-143045-9052-cppcheck@8a959f452cee_master/stats.html b/2020-12-29-143045-9052-cppcheck@8a959f452cee_master/stats.html new file mode 100644 index 0000000..68c7d7b --- /dev/null +++ b/2020-12-29-143045-9052-cppcheck@8a959f452cee_master/stats.html @@ -0,0 +1,105 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+

Top 10 files for style severity, total findings: 1
+   1  src/eggaccelerators.c
+

+ +
+
+ + + diff --git a/2020-12-29-143045-9052-cppcheck@8a959f452cee_master/style.css b/2020-12-29-143045-9052-cppcheck@8a959f452cee_master/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2020-12-29-143045-9052-cppcheck@8a959f452cee_master/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-01-16-140208-7678-cppcheck@ce8f2c9d4365_master/0.html b/2021-01-16-140208-7678-cppcheck@ce8f2c9d4365_master/0.html new file mode 100644 index 0000000..0ea3181 --- /dev/null +++ b/2021-01-16-140208-7678-cppcheck@ce8f2c9d4365_master/0.html @@ -0,0 +1,1224 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
/* eggaccelerators.c
+ * Copyright (C) 2002  Red Hat, Inc.; Copyright 1998, 2001 Tim Janik
+ * Developed by Havoc Pennington, Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+
+#include "eggaccelerators.h"
+
+#include <string.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
+
+enum
+{
+  EGG_MODMAP_ENTRY_SHIFT   = 0,
+  EGG_MODMAP_ENTRY_LOCK    = 1,
+  EGG_MODMAP_ENTRY_CONTROL = 2,
+  EGG_MODMAP_ENTRY_MOD1    = 3,
+  EGG_MODMAP_ENTRY_MOD2    = 4,
+  EGG_MODMAP_ENTRY_MOD3    = 5,
+  EGG_MODMAP_ENTRY_MOD4    = 6,
+  EGG_MODMAP_ENTRY_MOD5    = 7,
+  EGG_MODMAP_ENTRY_LAST    = 8
+};
+
+#define MODMAP_ENTRY_TO_MODIFIER(x) (1 << (x))
+
+typedef struct
+{
+  EggVirtualModifierType mapping[EGG_MODMAP_ENTRY_LAST];
+
+} EggModmap;
+
+const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap);
+
+static inline gboolean
+is_alt (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'a' || string[1] == 'A') &&
+	  (string[2] == 'l' || string[2] == 'L') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_ctl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_modx (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'd' || string[3] == 'D') &&
+	  (string[4] >= '1' && string[4] <= '5') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_ctrl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'r' || string[3] == 'R') &&
+	  (string[4] == 'l' || string[4] == 'L') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shft (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'f' || string[3] == 'F') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shift (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'i' || string[3] == 'I') &&
+	  (string[4] == 'f' || string[4] == 'F') &&
+	  (string[5] == 't' || string[5] == 'T') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_control (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'n' || string[3] == 'N') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == 'o' || string[6] == 'O') &&
+	  (string[7] == 'l' || string[7] == 'L') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_release (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'r' || string[1] == 'R') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'a' || string[5] == 'A') &&
+	  (string[6] == 's' || string[6] == 'S') &&
+	  (string[7] == 'e' || string[7] == 'E') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_meta (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == 'a' || string[4] == 'A') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_super (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'u' || string[2] == 'U') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_hyper (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'h' || string[1] == 'H') &&
+	  (string[2] == 'y' || string[2] == 'Y') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+/**
+ * egg_accelerator_parse_virtual:
+ * @accelerator:      string representing an accelerator
+ * @accelerator_key:  return location for accelerator keyval
+ * @accelerator_mods: return location for accelerator modifier mask
+ *
+ * Parses a string representing a virtual accelerator. The format
+ * looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1" or
+ * "&lt;Release&gt;z" (the last one is for key release).  The parser
+ * is fairly liberal and allows lower or upper case, and also
+ * abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;".
+ *
+ * If the parse fails, @accelerator_key and @accelerator_mods will
+ * be set to 0 (zero) and %FALSE will be returned. If the string contains
+ * only modifiers, @accelerator_key will be set to 0 but %TRUE will be
+ * returned.
+ *
+ * The virtual vs. concrete accelerator distinction is a relic of
+ * how the X Window System works; there are modifiers Mod2-Mod5 that
+ * can represent various keyboard keys (numlock, meta, hyper, etc.),
+ * the virtual modifier represents the keyboard key, the concrete
+ * modifier the actual Mod2-Mod5 bits in the key press event.
+ *
+ * Returns: %TRUE on success.
+ */
+gboolean
+egg_accelerator_parse_virtual (const gchar            *accelerator,
+                               guint                  *accelerator_key,
+                               EggVirtualModifierType *accelerator_mods)
+{
+  guint keyval;
+  GdkModifierType mods;
+  gint len;
+  gboolean bad_keyval;
+
+  if (accelerator_key)
+    *accelerator_key = 0;
+  if (accelerator_mods)
+    *accelerator_mods = 0;
+
+  g_return_val_if_fail (accelerator != NULL, FALSE);
+
+  bad_keyval = FALSE;
+
+  keyval = 0;
+  mods = 0;
+  len = strlen (accelerator);
+  while (len)
+    {
+      if (*accelerator == '<')
+	{
+	  if (len >= 9 && is_release (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_RELEASE_MASK;
+	    }
+	  else if (len >= 9 && is_control (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 7 && is_shift (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_shft (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_ctrl (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 6 && is_modx (accelerator))
+	    {
+	      static const guint mod_vals[] = {
+		EGG_VIRTUAL_ALT_MASK, EGG_VIRTUAL_MOD2_MASK, EGG_VIRTUAL_MOD3_MASK,
+		EGG_VIRTUAL_MOD4_MASK, EGG_VIRTUAL_MOD5_MASK
+	      };
+
+	      len -= 6;
+	      accelerator += 4;
+	      mods |= mod_vals[*accelerator - '1'];
+	      accelerator += 2;
+	    }
+	  else if (len >= 5 && is_ctl (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 5 && is_alt (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_ALT_MASK;
+	    }
+          else if (len >= 6 && is_meta (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_META_MASK;
+	    }
+          else if (len >= 7 && is_hyper (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_HYPER_MASK;
+	    }
+          else if (len >= 7 && is_super (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SUPER_MASK;
+	    }
+	  else
+	    {
+	      gchar last_ch;
+
+	      last_ch = *accelerator;
+	      while (last_ch && last_ch != '>')
+		{
+		  last_ch = *accelerator;
+		  accelerator += 1;
+		  len -= 1;
+		}
+	    }
+	}
+      else
+	{
+          keyval = gdk_keyval_from_name (accelerator);
+
+          if (keyval == 0)
+            bad_keyval = TRUE;
+
+          accelerator += len;
+          len -= len;
+	}
+    }
+
+  if (accelerator_key)
+    *accelerator_key = gdk_keyval_to_lower (keyval);
+  if (accelerator_mods)
+    *accelerator_mods = mods;
+
+  return !bad_keyval;
+}
+
+void
+egg_keymap_resolve_virtual_modifiers (GdkKeymap              *keymap,
+                                      EggVirtualModifierType  virtual_mods,
+                                      GdkModifierType        *concrete_mods)
+{
+  GdkModifierType concrete;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (concrete_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  concrete = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if (modmap->mapping[i] & virtual_mods)
+        concrete |= (1 << i);
+
+      ++i;
+    }
+
+  *concrete_mods = concrete;
+}
+
+void
+egg_keymap_virtualize_modifiers (GdkKeymap              *keymap,
+                                 GdkModifierType         concrete_mods,
+                                 EggVirtualModifierType *virtual_mods)
+{
+  GdkModifierType virtual;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (virtual_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  virtual = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if ((1 << i) & concrete_mods)
+        {
+          EggVirtualModifierType cleaned;
+
+          cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK |
+                                           EGG_VIRTUAL_MOD3_MASK |
+                                           EGG_VIRTUAL_MOD4_MASK |
+                                           EGG_VIRTUAL_MOD5_MASK);
+
+          if (cleaned != 0)
+            {
+              virtual |= cleaned;
+            }
+          else
+            {
+              /* Rather than dropping mod2->mod5 if not bound,
+               * go ahead and use the concrete names
+               */
+              virtual |= modmap->mapping[i];
+            }
+        }
+
+      ++i;
+    }
+
+  *virtual_mods = virtual;
+}
+
+static void
+reload_modmap (GdkKeymap *keymap,
+               EggModmap *modmap)
+{
+  XModifierKeymap *xmodmap;
+  int map_size;
+  int i;
+
+  /* FIXME multihead */
+  xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ());
+
+  memset (modmap->mapping, 0, sizeof (modmap->mapping));
+
+  /* there are 8 modifiers, and the first 3 are shift, shift lock,
+   * and control
+   */
+  map_size = 8 * xmodmap->max_keypermod;
+  i = 3 * xmodmap->max_keypermod;
+  while (i < map_size)
+    {
+      /* get the key code at this point in the map,
+       * see if its keysym is one we're interested in
+       */
+      int keycode = xmodmap->modifiermap[i];
+      GdkKeymapKey *keys;
+      guint *keyvals;
+      int n_entries;
+      int j;
+      EggVirtualModifierType mask;
+
+      keys = NULL;
+      keyvals = NULL;
+      n_entries = 0;
+
+      gdk_keymap_get_entries_for_keycode (keymap,
+                                          keycode,
+                                          &keys, &keyvals, &n_entries);
+
+      mask = 0;
+      j = 0;
+      while (j < n_entries)
+        {
+          if (keyvals[j] == GDK_KEY_Num_Lock)
+            mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Scroll_Lock)
+            mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Meta_L ||
+                   keyvals[j] == GDK_KEY_Meta_R)
+            mask |= EGG_VIRTUAL_META_MASK;
+          else if (keyvals[j] == GDK_KEY_Hyper_L ||
+                   keyvals[j] == GDK_KEY_Hyper_R)
+            mask |= EGG_VIRTUAL_HYPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Super_L ||
+                   keyvals[j] == GDK_KEY_Super_R)
+            mask |= EGG_VIRTUAL_SUPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Mode_switch)
+            mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
+
+          ++j;
+        }
+
+      /* Mod1Mask is 1 << 3 for example, i.e. the
+       * fourth modifier, i / keyspermod is the modifier
+       * index
+       */
+      modmap->mapping[i/xmodmap->max_keypermod] |= mask;
+
+      g_free (keyvals);
+      g_free (keys);
+
+      ++i;
+    }
+
+  /* Add in the not-really-virtual fixed entries */
+  modmap->mapping[EGG_MODMAP_ENTRY_SHIFT] |= EGG_VIRTUAL_SHIFT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_CONTROL] |= EGG_VIRTUAL_CONTROL_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_LOCK] |= EGG_VIRTUAL_LOCK_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD1] |= EGG_VIRTUAL_ALT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD2] |= EGG_VIRTUAL_MOD2_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK;
+
+  XFreeModifiermap (xmodmap);
+}
+
+const EggModmap*
+egg_keymap_get_modmap (GdkKeymap *keymap)
+{
+  EggModmap *modmap;
+
+  /* This is all a hack, much simpler when we can just
+   * modify GDK directly.
+   */
+
+  modmap = g_object_get_data (G_OBJECT (keymap),
+                              "egg-modmap");
+
+  if (modmap == NULL)
+    {
+      modmap = g_new0 (EggModmap, 1);
+
+      /* FIXME modify keymap change events with an event filter
+       * and force a reload if we get one
+       */
+
+      reload_modmap (keymap, modmap);
+
+      g_object_set_data_full (G_OBJECT (keymap),
+                              "egg-modmap",
+                              modmap,
+                              g_free);
+    }
+
+  g_assert (modmap != NULL);
+
+  return modmap;
+}
+
+
+
+
+ + + diff --git a/2021-01-16-140208-7678-cppcheck@ce8f2c9d4365_master/index.html b/2021-01-16-140208-7678-cppcheck@ce8f2c9d4365_master/index.html new file mode 100644 index 0000000..fee3cf9 --- /dev/null +++ b/2021-01-16-140208-7678-cppcheck@ce8f2c9d4365_master/index.html @@ -0,0 +1,117 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+ + + + + + + +
LineIdCWESeverityMessage
0missingIncludeSysteminformationCppcheck cannot find all the include files (use --check-config for details)
src/eggaccelerators.c
321duplicateExpression398styleSame expression on both sides of '-='.
+
+
+ + + diff --git a/2021-01-16-140208-7678-cppcheck@ce8f2c9d4365_master/stats.html b/2021-01-16-140208-7678-cppcheck@ce8f2c9d4365_master/stats.html new file mode 100644 index 0000000..68c7d7b --- /dev/null +++ b/2021-01-16-140208-7678-cppcheck@ce8f2c9d4365_master/stats.html @@ -0,0 +1,105 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+

Top 10 files for style severity, total findings: 1
+   1  src/eggaccelerators.c
+

+ +
+
+ + + diff --git a/2021-01-16-140208-7678-cppcheck@ce8f2c9d4365_master/style.css b/2021-01-16-140208-7678-cppcheck@ce8f2c9d4365_master/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-01-16-140208-7678-cppcheck@ce8f2c9d4365_master/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-01-20-212148-4058-cppcheck@7a29100586b6_stock-icon/0.html b/2021-01-20-212148-4058-cppcheck@7a29100586b6_stock-icon/0.html new file mode 100644 index 0000000..0ea3181 --- /dev/null +++ b/2021-01-20-212148-4058-cppcheck@7a29100586b6_stock-icon/0.html @@ -0,0 +1,1224 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
/* eggaccelerators.c
+ * Copyright (C) 2002  Red Hat, Inc.; Copyright 1998, 2001 Tim Janik
+ * Developed by Havoc Pennington, Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+
+#include "eggaccelerators.h"
+
+#include <string.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
+
+enum
+{
+  EGG_MODMAP_ENTRY_SHIFT   = 0,
+  EGG_MODMAP_ENTRY_LOCK    = 1,
+  EGG_MODMAP_ENTRY_CONTROL = 2,
+  EGG_MODMAP_ENTRY_MOD1    = 3,
+  EGG_MODMAP_ENTRY_MOD2    = 4,
+  EGG_MODMAP_ENTRY_MOD3    = 5,
+  EGG_MODMAP_ENTRY_MOD4    = 6,
+  EGG_MODMAP_ENTRY_MOD5    = 7,
+  EGG_MODMAP_ENTRY_LAST    = 8
+};
+
+#define MODMAP_ENTRY_TO_MODIFIER(x) (1 << (x))
+
+typedef struct
+{
+  EggVirtualModifierType mapping[EGG_MODMAP_ENTRY_LAST];
+
+} EggModmap;
+
+const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap);
+
+static inline gboolean
+is_alt (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'a' || string[1] == 'A') &&
+	  (string[2] == 'l' || string[2] == 'L') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_ctl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_modx (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'd' || string[3] == 'D') &&
+	  (string[4] >= '1' && string[4] <= '5') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_ctrl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'r' || string[3] == 'R') &&
+	  (string[4] == 'l' || string[4] == 'L') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shft (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'f' || string[3] == 'F') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shift (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'i' || string[3] == 'I') &&
+	  (string[4] == 'f' || string[4] == 'F') &&
+	  (string[5] == 't' || string[5] == 'T') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_control (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'n' || string[3] == 'N') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == 'o' || string[6] == 'O') &&
+	  (string[7] == 'l' || string[7] == 'L') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_release (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'r' || string[1] == 'R') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'a' || string[5] == 'A') &&
+	  (string[6] == 's' || string[6] == 'S') &&
+	  (string[7] == 'e' || string[7] == 'E') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_meta (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == 'a' || string[4] == 'A') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_super (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'u' || string[2] == 'U') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_hyper (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'h' || string[1] == 'H') &&
+	  (string[2] == 'y' || string[2] == 'Y') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+/**
+ * egg_accelerator_parse_virtual:
+ * @accelerator:      string representing an accelerator
+ * @accelerator_key:  return location for accelerator keyval
+ * @accelerator_mods: return location for accelerator modifier mask
+ *
+ * Parses a string representing a virtual accelerator. The format
+ * looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1" or
+ * "&lt;Release&gt;z" (the last one is for key release).  The parser
+ * is fairly liberal and allows lower or upper case, and also
+ * abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;".
+ *
+ * If the parse fails, @accelerator_key and @accelerator_mods will
+ * be set to 0 (zero) and %FALSE will be returned. If the string contains
+ * only modifiers, @accelerator_key will be set to 0 but %TRUE will be
+ * returned.
+ *
+ * The virtual vs. concrete accelerator distinction is a relic of
+ * how the X Window System works; there are modifiers Mod2-Mod5 that
+ * can represent various keyboard keys (numlock, meta, hyper, etc.),
+ * the virtual modifier represents the keyboard key, the concrete
+ * modifier the actual Mod2-Mod5 bits in the key press event.
+ *
+ * Returns: %TRUE on success.
+ */
+gboolean
+egg_accelerator_parse_virtual (const gchar            *accelerator,
+                               guint                  *accelerator_key,
+                               EggVirtualModifierType *accelerator_mods)
+{
+  guint keyval;
+  GdkModifierType mods;
+  gint len;
+  gboolean bad_keyval;
+
+  if (accelerator_key)
+    *accelerator_key = 0;
+  if (accelerator_mods)
+    *accelerator_mods = 0;
+
+  g_return_val_if_fail (accelerator != NULL, FALSE);
+
+  bad_keyval = FALSE;
+
+  keyval = 0;
+  mods = 0;
+  len = strlen (accelerator);
+  while (len)
+    {
+      if (*accelerator == '<')
+	{
+	  if (len >= 9 && is_release (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_RELEASE_MASK;
+	    }
+	  else if (len >= 9 && is_control (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 7 && is_shift (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_shft (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_ctrl (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 6 && is_modx (accelerator))
+	    {
+	      static const guint mod_vals[] = {
+		EGG_VIRTUAL_ALT_MASK, EGG_VIRTUAL_MOD2_MASK, EGG_VIRTUAL_MOD3_MASK,
+		EGG_VIRTUAL_MOD4_MASK, EGG_VIRTUAL_MOD5_MASK
+	      };
+
+	      len -= 6;
+	      accelerator += 4;
+	      mods |= mod_vals[*accelerator - '1'];
+	      accelerator += 2;
+	    }
+	  else if (len >= 5 && is_ctl (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 5 && is_alt (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_ALT_MASK;
+	    }
+          else if (len >= 6 && is_meta (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_META_MASK;
+	    }
+          else if (len >= 7 && is_hyper (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_HYPER_MASK;
+	    }
+          else if (len >= 7 && is_super (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SUPER_MASK;
+	    }
+	  else
+	    {
+	      gchar last_ch;
+
+	      last_ch = *accelerator;
+	      while (last_ch && last_ch != '>')
+		{
+		  last_ch = *accelerator;
+		  accelerator += 1;
+		  len -= 1;
+		}
+	    }
+	}
+      else
+	{
+          keyval = gdk_keyval_from_name (accelerator);
+
+          if (keyval == 0)
+            bad_keyval = TRUE;
+
+          accelerator += len;
+          len -= len;
+	}
+    }
+
+  if (accelerator_key)
+    *accelerator_key = gdk_keyval_to_lower (keyval);
+  if (accelerator_mods)
+    *accelerator_mods = mods;
+
+  return !bad_keyval;
+}
+
+void
+egg_keymap_resolve_virtual_modifiers (GdkKeymap              *keymap,
+                                      EggVirtualModifierType  virtual_mods,
+                                      GdkModifierType        *concrete_mods)
+{
+  GdkModifierType concrete;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (concrete_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  concrete = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if (modmap->mapping[i] & virtual_mods)
+        concrete |= (1 << i);
+
+      ++i;
+    }
+
+  *concrete_mods = concrete;
+}
+
+void
+egg_keymap_virtualize_modifiers (GdkKeymap              *keymap,
+                                 GdkModifierType         concrete_mods,
+                                 EggVirtualModifierType *virtual_mods)
+{
+  GdkModifierType virtual;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (virtual_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  virtual = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if ((1 << i) & concrete_mods)
+        {
+          EggVirtualModifierType cleaned;
+
+          cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK |
+                                           EGG_VIRTUAL_MOD3_MASK |
+                                           EGG_VIRTUAL_MOD4_MASK |
+                                           EGG_VIRTUAL_MOD5_MASK);
+
+          if (cleaned != 0)
+            {
+              virtual |= cleaned;
+            }
+          else
+            {
+              /* Rather than dropping mod2->mod5 if not bound,
+               * go ahead and use the concrete names
+               */
+              virtual |= modmap->mapping[i];
+            }
+        }
+
+      ++i;
+    }
+
+  *virtual_mods = virtual;
+}
+
+static void
+reload_modmap (GdkKeymap *keymap,
+               EggModmap *modmap)
+{
+  XModifierKeymap *xmodmap;
+  int map_size;
+  int i;
+
+  /* FIXME multihead */
+  xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ());
+
+  memset (modmap->mapping, 0, sizeof (modmap->mapping));
+
+  /* there are 8 modifiers, and the first 3 are shift, shift lock,
+   * and control
+   */
+  map_size = 8 * xmodmap->max_keypermod;
+  i = 3 * xmodmap->max_keypermod;
+  while (i < map_size)
+    {
+      /* get the key code at this point in the map,
+       * see if its keysym is one we're interested in
+       */
+      int keycode = xmodmap->modifiermap[i];
+      GdkKeymapKey *keys;
+      guint *keyvals;
+      int n_entries;
+      int j;
+      EggVirtualModifierType mask;
+
+      keys = NULL;
+      keyvals = NULL;
+      n_entries = 0;
+
+      gdk_keymap_get_entries_for_keycode (keymap,
+                                          keycode,
+                                          &keys, &keyvals, &n_entries);
+
+      mask = 0;
+      j = 0;
+      while (j < n_entries)
+        {
+          if (keyvals[j] == GDK_KEY_Num_Lock)
+            mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Scroll_Lock)
+            mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Meta_L ||
+                   keyvals[j] == GDK_KEY_Meta_R)
+            mask |= EGG_VIRTUAL_META_MASK;
+          else if (keyvals[j] == GDK_KEY_Hyper_L ||
+                   keyvals[j] == GDK_KEY_Hyper_R)
+            mask |= EGG_VIRTUAL_HYPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Super_L ||
+                   keyvals[j] == GDK_KEY_Super_R)
+            mask |= EGG_VIRTUAL_SUPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Mode_switch)
+            mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
+
+          ++j;
+        }
+
+      /* Mod1Mask is 1 << 3 for example, i.e. the
+       * fourth modifier, i / keyspermod is the modifier
+       * index
+       */
+      modmap->mapping[i/xmodmap->max_keypermod] |= mask;
+
+      g_free (keyvals);
+      g_free (keys);
+
+      ++i;
+    }
+
+  /* Add in the not-really-virtual fixed entries */
+  modmap->mapping[EGG_MODMAP_ENTRY_SHIFT] |= EGG_VIRTUAL_SHIFT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_CONTROL] |= EGG_VIRTUAL_CONTROL_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_LOCK] |= EGG_VIRTUAL_LOCK_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD1] |= EGG_VIRTUAL_ALT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD2] |= EGG_VIRTUAL_MOD2_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK;
+
+  XFreeModifiermap (xmodmap);
+}
+
+const EggModmap*
+egg_keymap_get_modmap (GdkKeymap *keymap)
+{
+  EggModmap *modmap;
+
+  /* This is all a hack, much simpler when we can just
+   * modify GDK directly.
+   */
+
+  modmap = g_object_get_data (G_OBJECT (keymap),
+                              "egg-modmap");
+
+  if (modmap == NULL)
+    {
+      modmap = g_new0 (EggModmap, 1);
+
+      /* FIXME modify keymap change events with an event filter
+       * and force a reload if we get one
+       */
+
+      reload_modmap (keymap, modmap);
+
+      g_object_set_data_full (G_OBJECT (keymap),
+                              "egg-modmap",
+                              modmap,
+                              g_free);
+    }
+
+  g_assert (modmap != NULL);
+
+  return modmap;
+}
+
+
+
+
+ + + diff --git a/2021-01-20-212148-4058-cppcheck@7a29100586b6_stock-icon/index.html b/2021-01-20-212148-4058-cppcheck@7a29100586b6_stock-icon/index.html new file mode 100644 index 0000000..fee3cf9 --- /dev/null +++ b/2021-01-20-212148-4058-cppcheck@7a29100586b6_stock-icon/index.html @@ -0,0 +1,117 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+ + + + + + + +
LineIdCWESeverityMessage
0missingIncludeSysteminformationCppcheck cannot find all the include files (use --check-config for details)
src/eggaccelerators.c
321duplicateExpression398styleSame expression on both sides of '-='.
+
+
+ + + diff --git a/2021-01-20-212148-4058-cppcheck@7a29100586b6_stock-icon/stats.html b/2021-01-20-212148-4058-cppcheck@7a29100586b6_stock-icon/stats.html new file mode 100644 index 0000000..68c7d7b --- /dev/null +++ b/2021-01-20-212148-4058-cppcheck@7a29100586b6_stock-icon/stats.html @@ -0,0 +1,105 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+

Top 10 files for style severity, total findings: 1
+   1  src/eggaccelerators.c
+

+ +
+
+ + + diff --git a/2021-01-20-212148-4058-cppcheck@7a29100586b6_stock-icon/style.css b/2021-01-20-212148-4058-cppcheck@7a29100586b6_stock-icon/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-01-20-212148-4058-cppcheck@7a29100586b6_stock-icon/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-01-21-060147-7874-cppcheck@0810727595b0_debian-ci-fix/0.html b/2021-01-21-060147-7874-cppcheck@0810727595b0_debian-ci-fix/0.html new file mode 100644 index 0000000..0ea3181 --- /dev/null +++ b/2021-01-21-060147-7874-cppcheck@0810727595b0_debian-ci-fix/0.html @@ -0,0 +1,1224 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
/* eggaccelerators.c
+ * Copyright (C) 2002  Red Hat, Inc.; Copyright 1998, 2001 Tim Janik
+ * Developed by Havoc Pennington, Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+
+#include "eggaccelerators.h"
+
+#include <string.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
+
+enum
+{
+  EGG_MODMAP_ENTRY_SHIFT   = 0,
+  EGG_MODMAP_ENTRY_LOCK    = 1,
+  EGG_MODMAP_ENTRY_CONTROL = 2,
+  EGG_MODMAP_ENTRY_MOD1    = 3,
+  EGG_MODMAP_ENTRY_MOD2    = 4,
+  EGG_MODMAP_ENTRY_MOD3    = 5,
+  EGG_MODMAP_ENTRY_MOD4    = 6,
+  EGG_MODMAP_ENTRY_MOD5    = 7,
+  EGG_MODMAP_ENTRY_LAST    = 8
+};
+
+#define MODMAP_ENTRY_TO_MODIFIER(x) (1 << (x))
+
+typedef struct
+{
+  EggVirtualModifierType mapping[EGG_MODMAP_ENTRY_LAST];
+
+} EggModmap;
+
+const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap);
+
+static inline gboolean
+is_alt (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'a' || string[1] == 'A') &&
+	  (string[2] == 'l' || string[2] == 'L') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_ctl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_modx (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'd' || string[3] == 'D') &&
+	  (string[4] >= '1' && string[4] <= '5') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_ctrl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'r' || string[3] == 'R') &&
+	  (string[4] == 'l' || string[4] == 'L') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shft (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'f' || string[3] == 'F') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shift (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'i' || string[3] == 'I') &&
+	  (string[4] == 'f' || string[4] == 'F') &&
+	  (string[5] == 't' || string[5] == 'T') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_control (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'n' || string[3] == 'N') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == 'o' || string[6] == 'O') &&
+	  (string[7] == 'l' || string[7] == 'L') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_release (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'r' || string[1] == 'R') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'a' || string[5] == 'A') &&
+	  (string[6] == 's' || string[6] == 'S') &&
+	  (string[7] == 'e' || string[7] == 'E') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_meta (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == 'a' || string[4] == 'A') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_super (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'u' || string[2] == 'U') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_hyper (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'h' || string[1] == 'H') &&
+	  (string[2] == 'y' || string[2] == 'Y') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+/**
+ * egg_accelerator_parse_virtual:
+ * @accelerator:      string representing an accelerator
+ * @accelerator_key:  return location for accelerator keyval
+ * @accelerator_mods: return location for accelerator modifier mask
+ *
+ * Parses a string representing a virtual accelerator. The format
+ * looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1" or
+ * "&lt;Release&gt;z" (the last one is for key release).  The parser
+ * is fairly liberal and allows lower or upper case, and also
+ * abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;".
+ *
+ * If the parse fails, @accelerator_key and @accelerator_mods will
+ * be set to 0 (zero) and %FALSE will be returned. If the string contains
+ * only modifiers, @accelerator_key will be set to 0 but %TRUE will be
+ * returned.
+ *
+ * The virtual vs. concrete accelerator distinction is a relic of
+ * how the X Window System works; there are modifiers Mod2-Mod5 that
+ * can represent various keyboard keys (numlock, meta, hyper, etc.),
+ * the virtual modifier represents the keyboard key, the concrete
+ * modifier the actual Mod2-Mod5 bits in the key press event.
+ *
+ * Returns: %TRUE on success.
+ */
+gboolean
+egg_accelerator_parse_virtual (const gchar            *accelerator,
+                               guint                  *accelerator_key,
+                               EggVirtualModifierType *accelerator_mods)
+{
+  guint keyval;
+  GdkModifierType mods;
+  gint len;
+  gboolean bad_keyval;
+
+  if (accelerator_key)
+    *accelerator_key = 0;
+  if (accelerator_mods)
+    *accelerator_mods = 0;
+
+  g_return_val_if_fail (accelerator != NULL, FALSE);
+
+  bad_keyval = FALSE;
+
+  keyval = 0;
+  mods = 0;
+  len = strlen (accelerator);
+  while (len)
+    {
+      if (*accelerator == '<')
+	{
+	  if (len >= 9 && is_release (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_RELEASE_MASK;
+	    }
+	  else if (len >= 9 && is_control (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 7 && is_shift (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_shft (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_ctrl (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 6 && is_modx (accelerator))
+	    {
+	      static const guint mod_vals[] = {
+		EGG_VIRTUAL_ALT_MASK, EGG_VIRTUAL_MOD2_MASK, EGG_VIRTUAL_MOD3_MASK,
+		EGG_VIRTUAL_MOD4_MASK, EGG_VIRTUAL_MOD5_MASK
+	      };
+
+	      len -= 6;
+	      accelerator += 4;
+	      mods |= mod_vals[*accelerator - '1'];
+	      accelerator += 2;
+	    }
+	  else if (len >= 5 && is_ctl (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 5 && is_alt (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_ALT_MASK;
+	    }
+          else if (len >= 6 && is_meta (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_META_MASK;
+	    }
+          else if (len >= 7 && is_hyper (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_HYPER_MASK;
+	    }
+          else if (len >= 7 && is_super (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SUPER_MASK;
+	    }
+	  else
+	    {
+	      gchar last_ch;
+
+	      last_ch = *accelerator;
+	      while (last_ch && last_ch != '>')
+		{
+		  last_ch = *accelerator;
+		  accelerator += 1;
+		  len -= 1;
+		}
+	    }
+	}
+      else
+	{
+          keyval = gdk_keyval_from_name (accelerator);
+
+          if (keyval == 0)
+            bad_keyval = TRUE;
+
+          accelerator += len;
+          len -= len;
+	}
+    }
+
+  if (accelerator_key)
+    *accelerator_key = gdk_keyval_to_lower (keyval);
+  if (accelerator_mods)
+    *accelerator_mods = mods;
+
+  return !bad_keyval;
+}
+
+void
+egg_keymap_resolve_virtual_modifiers (GdkKeymap              *keymap,
+                                      EggVirtualModifierType  virtual_mods,
+                                      GdkModifierType        *concrete_mods)
+{
+  GdkModifierType concrete;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (concrete_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  concrete = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if (modmap->mapping[i] & virtual_mods)
+        concrete |= (1 << i);
+
+      ++i;
+    }
+
+  *concrete_mods = concrete;
+}
+
+void
+egg_keymap_virtualize_modifiers (GdkKeymap              *keymap,
+                                 GdkModifierType         concrete_mods,
+                                 EggVirtualModifierType *virtual_mods)
+{
+  GdkModifierType virtual;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (virtual_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  virtual = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if ((1 << i) & concrete_mods)
+        {
+          EggVirtualModifierType cleaned;
+
+          cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK |
+                                           EGG_VIRTUAL_MOD3_MASK |
+                                           EGG_VIRTUAL_MOD4_MASK |
+                                           EGG_VIRTUAL_MOD5_MASK);
+
+          if (cleaned != 0)
+            {
+              virtual |= cleaned;
+            }
+          else
+            {
+              /* Rather than dropping mod2->mod5 if not bound,
+               * go ahead and use the concrete names
+               */
+              virtual |= modmap->mapping[i];
+            }
+        }
+
+      ++i;
+    }
+
+  *virtual_mods = virtual;
+}
+
+static void
+reload_modmap (GdkKeymap *keymap,
+               EggModmap *modmap)
+{
+  XModifierKeymap *xmodmap;
+  int map_size;
+  int i;
+
+  /* FIXME multihead */
+  xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ());
+
+  memset (modmap->mapping, 0, sizeof (modmap->mapping));
+
+  /* there are 8 modifiers, and the first 3 are shift, shift lock,
+   * and control
+   */
+  map_size = 8 * xmodmap->max_keypermod;
+  i = 3 * xmodmap->max_keypermod;
+  while (i < map_size)
+    {
+      /* get the key code at this point in the map,
+       * see if its keysym is one we're interested in
+       */
+      int keycode = xmodmap->modifiermap[i];
+      GdkKeymapKey *keys;
+      guint *keyvals;
+      int n_entries;
+      int j;
+      EggVirtualModifierType mask;
+
+      keys = NULL;
+      keyvals = NULL;
+      n_entries = 0;
+
+      gdk_keymap_get_entries_for_keycode (keymap,
+                                          keycode,
+                                          &keys, &keyvals, &n_entries);
+
+      mask = 0;
+      j = 0;
+      while (j < n_entries)
+        {
+          if (keyvals[j] == GDK_KEY_Num_Lock)
+            mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Scroll_Lock)
+            mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Meta_L ||
+                   keyvals[j] == GDK_KEY_Meta_R)
+            mask |= EGG_VIRTUAL_META_MASK;
+          else if (keyvals[j] == GDK_KEY_Hyper_L ||
+                   keyvals[j] == GDK_KEY_Hyper_R)
+            mask |= EGG_VIRTUAL_HYPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Super_L ||
+                   keyvals[j] == GDK_KEY_Super_R)
+            mask |= EGG_VIRTUAL_SUPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Mode_switch)
+            mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
+
+          ++j;
+        }
+
+      /* Mod1Mask is 1 << 3 for example, i.e. the
+       * fourth modifier, i / keyspermod is the modifier
+       * index
+       */
+      modmap->mapping[i/xmodmap->max_keypermod] |= mask;
+
+      g_free (keyvals);
+      g_free (keys);
+
+      ++i;
+    }
+
+  /* Add in the not-really-virtual fixed entries */
+  modmap->mapping[EGG_MODMAP_ENTRY_SHIFT] |= EGG_VIRTUAL_SHIFT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_CONTROL] |= EGG_VIRTUAL_CONTROL_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_LOCK] |= EGG_VIRTUAL_LOCK_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD1] |= EGG_VIRTUAL_ALT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD2] |= EGG_VIRTUAL_MOD2_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK;
+
+  XFreeModifiermap (xmodmap);
+}
+
+const EggModmap*
+egg_keymap_get_modmap (GdkKeymap *keymap)
+{
+  EggModmap *modmap;
+
+  /* This is all a hack, much simpler when we can just
+   * modify GDK directly.
+   */
+
+  modmap = g_object_get_data (G_OBJECT (keymap),
+                              "egg-modmap");
+
+  if (modmap == NULL)
+    {
+      modmap = g_new0 (EggModmap, 1);
+
+      /* FIXME modify keymap change events with an event filter
+       * and force a reload if we get one
+       */
+
+      reload_modmap (keymap, modmap);
+
+      g_object_set_data_full (G_OBJECT (keymap),
+                              "egg-modmap",
+                              modmap,
+                              g_free);
+    }
+
+  g_assert (modmap != NULL);
+
+  return modmap;
+}
+
+
+
+
+ + + diff --git a/2021-01-21-060147-7874-cppcheck@0810727595b0_debian-ci-fix/index.html b/2021-01-21-060147-7874-cppcheck@0810727595b0_debian-ci-fix/index.html new file mode 100644 index 0000000..fee3cf9 --- /dev/null +++ b/2021-01-21-060147-7874-cppcheck@0810727595b0_debian-ci-fix/index.html @@ -0,0 +1,117 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+ + + + + + + +
LineIdCWESeverityMessage
0missingIncludeSysteminformationCppcheck cannot find all the include files (use --check-config for details)
src/eggaccelerators.c
321duplicateExpression398styleSame expression on both sides of '-='.
+
+
+ + + diff --git a/2021-01-21-060147-7874-cppcheck@0810727595b0_debian-ci-fix/stats.html b/2021-01-21-060147-7874-cppcheck@0810727595b0_debian-ci-fix/stats.html new file mode 100644 index 0000000..68c7d7b --- /dev/null +++ b/2021-01-21-060147-7874-cppcheck@0810727595b0_debian-ci-fix/stats.html @@ -0,0 +1,105 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+

Top 10 files for style severity, total findings: 1
+   1  src/eggaccelerators.c
+

+ +
+
+ + + diff --git a/2021-01-21-060147-7874-cppcheck@0810727595b0_debian-ci-fix/style.css b/2021-01-21-060147-7874-cppcheck@0810727595b0_debian-ci-fix/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-01-21-060147-7874-cppcheck@0810727595b0_debian-ci-fix/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-01-28-113540-2945-cppcheck@763e4e355532_PACKAGE_URL/0.html b/2021-01-28-113540-2945-cppcheck@763e4e355532_PACKAGE_URL/0.html new file mode 100644 index 0000000..0ea3181 --- /dev/null +++ b/2021-01-28-113540-2945-cppcheck@763e4e355532_PACKAGE_URL/0.html @@ -0,0 +1,1224 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
/* eggaccelerators.c
+ * Copyright (C) 2002  Red Hat, Inc.; Copyright 1998, 2001 Tim Janik
+ * Developed by Havoc Pennington, Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+
+#include "eggaccelerators.h"
+
+#include <string.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
+
+enum
+{
+  EGG_MODMAP_ENTRY_SHIFT   = 0,
+  EGG_MODMAP_ENTRY_LOCK    = 1,
+  EGG_MODMAP_ENTRY_CONTROL = 2,
+  EGG_MODMAP_ENTRY_MOD1    = 3,
+  EGG_MODMAP_ENTRY_MOD2    = 4,
+  EGG_MODMAP_ENTRY_MOD3    = 5,
+  EGG_MODMAP_ENTRY_MOD4    = 6,
+  EGG_MODMAP_ENTRY_MOD5    = 7,
+  EGG_MODMAP_ENTRY_LAST    = 8
+};
+
+#define MODMAP_ENTRY_TO_MODIFIER(x) (1 << (x))
+
+typedef struct
+{
+  EggVirtualModifierType mapping[EGG_MODMAP_ENTRY_LAST];
+
+} EggModmap;
+
+const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap);
+
+static inline gboolean
+is_alt (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'a' || string[1] == 'A') &&
+	  (string[2] == 'l' || string[2] == 'L') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_ctl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_modx (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'd' || string[3] == 'D') &&
+	  (string[4] >= '1' && string[4] <= '5') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_ctrl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'r' || string[3] == 'R') &&
+	  (string[4] == 'l' || string[4] == 'L') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shft (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'f' || string[3] == 'F') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shift (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'i' || string[3] == 'I') &&
+	  (string[4] == 'f' || string[4] == 'F') &&
+	  (string[5] == 't' || string[5] == 'T') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_control (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'n' || string[3] == 'N') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == 'o' || string[6] == 'O') &&
+	  (string[7] == 'l' || string[7] == 'L') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_release (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'r' || string[1] == 'R') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'a' || string[5] == 'A') &&
+	  (string[6] == 's' || string[6] == 'S') &&
+	  (string[7] == 'e' || string[7] == 'E') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_meta (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == 'a' || string[4] == 'A') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_super (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'u' || string[2] == 'U') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_hyper (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'h' || string[1] == 'H') &&
+	  (string[2] == 'y' || string[2] == 'Y') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+/**
+ * egg_accelerator_parse_virtual:
+ * @accelerator:      string representing an accelerator
+ * @accelerator_key:  return location for accelerator keyval
+ * @accelerator_mods: return location for accelerator modifier mask
+ *
+ * Parses a string representing a virtual accelerator. The format
+ * looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1" or
+ * "&lt;Release&gt;z" (the last one is for key release).  The parser
+ * is fairly liberal and allows lower or upper case, and also
+ * abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;".
+ *
+ * If the parse fails, @accelerator_key and @accelerator_mods will
+ * be set to 0 (zero) and %FALSE will be returned. If the string contains
+ * only modifiers, @accelerator_key will be set to 0 but %TRUE will be
+ * returned.
+ *
+ * The virtual vs. concrete accelerator distinction is a relic of
+ * how the X Window System works; there are modifiers Mod2-Mod5 that
+ * can represent various keyboard keys (numlock, meta, hyper, etc.),
+ * the virtual modifier represents the keyboard key, the concrete
+ * modifier the actual Mod2-Mod5 bits in the key press event.
+ *
+ * Returns: %TRUE on success.
+ */
+gboolean
+egg_accelerator_parse_virtual (const gchar            *accelerator,
+                               guint                  *accelerator_key,
+                               EggVirtualModifierType *accelerator_mods)
+{
+  guint keyval;
+  GdkModifierType mods;
+  gint len;
+  gboolean bad_keyval;
+
+  if (accelerator_key)
+    *accelerator_key = 0;
+  if (accelerator_mods)
+    *accelerator_mods = 0;
+
+  g_return_val_if_fail (accelerator != NULL, FALSE);
+
+  bad_keyval = FALSE;
+
+  keyval = 0;
+  mods = 0;
+  len = strlen (accelerator);
+  while (len)
+    {
+      if (*accelerator == '<')
+	{
+	  if (len >= 9 && is_release (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_RELEASE_MASK;
+	    }
+	  else if (len >= 9 && is_control (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 7 && is_shift (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_shft (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_ctrl (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 6 && is_modx (accelerator))
+	    {
+	      static const guint mod_vals[] = {
+		EGG_VIRTUAL_ALT_MASK, EGG_VIRTUAL_MOD2_MASK, EGG_VIRTUAL_MOD3_MASK,
+		EGG_VIRTUAL_MOD4_MASK, EGG_VIRTUAL_MOD5_MASK
+	      };
+
+	      len -= 6;
+	      accelerator += 4;
+	      mods |= mod_vals[*accelerator - '1'];
+	      accelerator += 2;
+	    }
+	  else if (len >= 5 && is_ctl (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 5 && is_alt (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_ALT_MASK;
+	    }
+          else if (len >= 6 && is_meta (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_META_MASK;
+	    }
+          else if (len >= 7 && is_hyper (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_HYPER_MASK;
+	    }
+          else if (len >= 7 && is_super (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SUPER_MASK;
+	    }
+	  else
+	    {
+	      gchar last_ch;
+
+	      last_ch = *accelerator;
+	      while (last_ch && last_ch != '>')
+		{
+		  last_ch = *accelerator;
+		  accelerator += 1;
+		  len -= 1;
+		}
+	    }
+	}
+      else
+	{
+          keyval = gdk_keyval_from_name (accelerator);
+
+          if (keyval == 0)
+            bad_keyval = TRUE;
+
+          accelerator += len;
+          len -= len;
+	}
+    }
+
+  if (accelerator_key)
+    *accelerator_key = gdk_keyval_to_lower (keyval);
+  if (accelerator_mods)
+    *accelerator_mods = mods;
+
+  return !bad_keyval;
+}
+
+void
+egg_keymap_resolve_virtual_modifiers (GdkKeymap              *keymap,
+                                      EggVirtualModifierType  virtual_mods,
+                                      GdkModifierType        *concrete_mods)
+{
+  GdkModifierType concrete;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (concrete_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  concrete = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if (modmap->mapping[i] & virtual_mods)
+        concrete |= (1 << i);
+
+      ++i;
+    }
+
+  *concrete_mods = concrete;
+}
+
+void
+egg_keymap_virtualize_modifiers (GdkKeymap              *keymap,
+                                 GdkModifierType         concrete_mods,
+                                 EggVirtualModifierType *virtual_mods)
+{
+  GdkModifierType virtual;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (virtual_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  virtual = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if ((1 << i) & concrete_mods)
+        {
+          EggVirtualModifierType cleaned;
+
+          cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK |
+                                           EGG_VIRTUAL_MOD3_MASK |
+                                           EGG_VIRTUAL_MOD4_MASK |
+                                           EGG_VIRTUAL_MOD5_MASK);
+
+          if (cleaned != 0)
+            {
+              virtual |= cleaned;
+            }
+          else
+            {
+              /* Rather than dropping mod2->mod5 if not bound,
+               * go ahead and use the concrete names
+               */
+              virtual |= modmap->mapping[i];
+            }
+        }
+
+      ++i;
+    }
+
+  *virtual_mods = virtual;
+}
+
+static void
+reload_modmap (GdkKeymap *keymap,
+               EggModmap *modmap)
+{
+  XModifierKeymap *xmodmap;
+  int map_size;
+  int i;
+
+  /* FIXME multihead */
+  xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ());
+
+  memset (modmap->mapping, 0, sizeof (modmap->mapping));
+
+  /* there are 8 modifiers, and the first 3 are shift, shift lock,
+   * and control
+   */
+  map_size = 8 * xmodmap->max_keypermod;
+  i = 3 * xmodmap->max_keypermod;
+  while (i < map_size)
+    {
+      /* get the key code at this point in the map,
+       * see if its keysym is one we're interested in
+       */
+      int keycode = xmodmap->modifiermap[i];
+      GdkKeymapKey *keys;
+      guint *keyvals;
+      int n_entries;
+      int j;
+      EggVirtualModifierType mask;
+
+      keys = NULL;
+      keyvals = NULL;
+      n_entries = 0;
+
+      gdk_keymap_get_entries_for_keycode (keymap,
+                                          keycode,
+                                          &keys, &keyvals, &n_entries);
+
+      mask = 0;
+      j = 0;
+      while (j < n_entries)
+        {
+          if (keyvals[j] == GDK_KEY_Num_Lock)
+            mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Scroll_Lock)
+            mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Meta_L ||
+                   keyvals[j] == GDK_KEY_Meta_R)
+            mask |= EGG_VIRTUAL_META_MASK;
+          else if (keyvals[j] == GDK_KEY_Hyper_L ||
+                   keyvals[j] == GDK_KEY_Hyper_R)
+            mask |= EGG_VIRTUAL_HYPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Super_L ||
+                   keyvals[j] == GDK_KEY_Super_R)
+            mask |= EGG_VIRTUAL_SUPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Mode_switch)
+            mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
+
+          ++j;
+        }
+
+      /* Mod1Mask is 1 << 3 for example, i.e. the
+       * fourth modifier, i / keyspermod is the modifier
+       * index
+       */
+      modmap->mapping[i/xmodmap->max_keypermod] |= mask;
+
+      g_free (keyvals);
+      g_free (keys);
+
+      ++i;
+    }
+
+  /* Add in the not-really-virtual fixed entries */
+  modmap->mapping[EGG_MODMAP_ENTRY_SHIFT] |= EGG_VIRTUAL_SHIFT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_CONTROL] |= EGG_VIRTUAL_CONTROL_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_LOCK] |= EGG_VIRTUAL_LOCK_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD1] |= EGG_VIRTUAL_ALT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD2] |= EGG_VIRTUAL_MOD2_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK;
+
+  XFreeModifiermap (xmodmap);
+}
+
+const EggModmap*
+egg_keymap_get_modmap (GdkKeymap *keymap)
+{
+  EggModmap *modmap;
+
+  /* This is all a hack, much simpler when we can just
+   * modify GDK directly.
+   */
+
+  modmap = g_object_get_data (G_OBJECT (keymap),
+                              "egg-modmap");
+
+  if (modmap == NULL)
+    {
+      modmap = g_new0 (EggModmap, 1);
+
+      /* FIXME modify keymap change events with an event filter
+       * and force a reload if we get one
+       */
+
+      reload_modmap (keymap, modmap);
+
+      g_object_set_data_full (G_OBJECT (keymap),
+                              "egg-modmap",
+                              modmap,
+                              g_free);
+    }
+
+  g_assert (modmap != NULL);
+
+  return modmap;
+}
+
+
+
+
+ + + diff --git a/2021-01-28-113540-2945-cppcheck@763e4e355532_PACKAGE_URL/index.html b/2021-01-28-113540-2945-cppcheck@763e4e355532_PACKAGE_URL/index.html new file mode 100644 index 0000000..fee3cf9 --- /dev/null +++ b/2021-01-28-113540-2945-cppcheck@763e4e355532_PACKAGE_URL/index.html @@ -0,0 +1,117 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+ + + + + + + +
LineIdCWESeverityMessage
0missingIncludeSysteminformationCppcheck cannot find all the include files (use --check-config for details)
src/eggaccelerators.c
321duplicateExpression398styleSame expression on both sides of '-='.
+
+
+ + + diff --git a/2021-01-28-113540-2945-cppcheck@763e4e355532_PACKAGE_URL/stats.html b/2021-01-28-113540-2945-cppcheck@763e4e355532_PACKAGE_URL/stats.html new file mode 100644 index 0000000..68c7d7b --- /dev/null +++ b/2021-01-28-113540-2945-cppcheck@763e4e355532_PACKAGE_URL/stats.html @@ -0,0 +1,105 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+

Top 10 files for style severity, total findings: 1
+   1  src/eggaccelerators.c
+

+ +
+
+ + + diff --git a/2021-01-28-113540-2945-cppcheck@763e4e355532_PACKAGE_URL/style.css b/2021-01-28-113540-2945-cppcheck@763e4e355532_PACKAGE_URL/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-01-28-113540-2945-cppcheck@763e4e355532_PACKAGE_URL/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-01-31-144137-4382-cppcheck@eea6c04110f3_master/0.html b/2021-01-31-144137-4382-cppcheck@eea6c04110f3_master/0.html new file mode 100644 index 0000000..0ea3181 --- /dev/null +++ b/2021-01-31-144137-4382-cppcheck@eea6c04110f3_master/0.html @@ -0,0 +1,1224 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
/* eggaccelerators.c
+ * Copyright (C) 2002  Red Hat, Inc.; Copyright 1998, 2001 Tim Janik
+ * Developed by Havoc Pennington, Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+
+#include "eggaccelerators.h"
+
+#include <string.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
+
+enum
+{
+  EGG_MODMAP_ENTRY_SHIFT   = 0,
+  EGG_MODMAP_ENTRY_LOCK    = 1,
+  EGG_MODMAP_ENTRY_CONTROL = 2,
+  EGG_MODMAP_ENTRY_MOD1    = 3,
+  EGG_MODMAP_ENTRY_MOD2    = 4,
+  EGG_MODMAP_ENTRY_MOD3    = 5,
+  EGG_MODMAP_ENTRY_MOD4    = 6,
+  EGG_MODMAP_ENTRY_MOD5    = 7,
+  EGG_MODMAP_ENTRY_LAST    = 8
+};
+
+#define MODMAP_ENTRY_TO_MODIFIER(x) (1 << (x))
+
+typedef struct
+{
+  EggVirtualModifierType mapping[EGG_MODMAP_ENTRY_LAST];
+
+} EggModmap;
+
+const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap);
+
+static inline gboolean
+is_alt (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'a' || string[1] == 'A') &&
+	  (string[2] == 'l' || string[2] == 'L') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_ctl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_modx (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'd' || string[3] == 'D') &&
+	  (string[4] >= '1' && string[4] <= '5') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_ctrl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'r' || string[3] == 'R') &&
+	  (string[4] == 'l' || string[4] == 'L') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shft (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'f' || string[3] == 'F') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shift (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'i' || string[3] == 'I') &&
+	  (string[4] == 'f' || string[4] == 'F') &&
+	  (string[5] == 't' || string[5] == 'T') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_control (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'n' || string[3] == 'N') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == 'o' || string[6] == 'O') &&
+	  (string[7] == 'l' || string[7] == 'L') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_release (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'r' || string[1] == 'R') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'a' || string[5] == 'A') &&
+	  (string[6] == 's' || string[6] == 'S') &&
+	  (string[7] == 'e' || string[7] == 'E') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_meta (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == 'a' || string[4] == 'A') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_super (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'u' || string[2] == 'U') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_hyper (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'h' || string[1] == 'H') &&
+	  (string[2] == 'y' || string[2] == 'Y') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+/**
+ * egg_accelerator_parse_virtual:
+ * @accelerator:      string representing an accelerator
+ * @accelerator_key:  return location for accelerator keyval
+ * @accelerator_mods: return location for accelerator modifier mask
+ *
+ * Parses a string representing a virtual accelerator. The format
+ * looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1" or
+ * "&lt;Release&gt;z" (the last one is for key release).  The parser
+ * is fairly liberal and allows lower or upper case, and also
+ * abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;".
+ *
+ * If the parse fails, @accelerator_key and @accelerator_mods will
+ * be set to 0 (zero) and %FALSE will be returned. If the string contains
+ * only modifiers, @accelerator_key will be set to 0 but %TRUE will be
+ * returned.
+ *
+ * The virtual vs. concrete accelerator distinction is a relic of
+ * how the X Window System works; there are modifiers Mod2-Mod5 that
+ * can represent various keyboard keys (numlock, meta, hyper, etc.),
+ * the virtual modifier represents the keyboard key, the concrete
+ * modifier the actual Mod2-Mod5 bits in the key press event.
+ *
+ * Returns: %TRUE on success.
+ */
+gboolean
+egg_accelerator_parse_virtual (const gchar            *accelerator,
+                               guint                  *accelerator_key,
+                               EggVirtualModifierType *accelerator_mods)
+{
+  guint keyval;
+  GdkModifierType mods;
+  gint len;
+  gboolean bad_keyval;
+
+  if (accelerator_key)
+    *accelerator_key = 0;
+  if (accelerator_mods)
+    *accelerator_mods = 0;
+
+  g_return_val_if_fail (accelerator != NULL, FALSE);
+
+  bad_keyval = FALSE;
+
+  keyval = 0;
+  mods = 0;
+  len = strlen (accelerator);
+  while (len)
+    {
+      if (*accelerator == '<')
+	{
+	  if (len >= 9 && is_release (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_RELEASE_MASK;
+	    }
+	  else if (len >= 9 && is_control (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 7 && is_shift (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_shft (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_ctrl (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 6 && is_modx (accelerator))
+	    {
+	      static const guint mod_vals[] = {
+		EGG_VIRTUAL_ALT_MASK, EGG_VIRTUAL_MOD2_MASK, EGG_VIRTUAL_MOD3_MASK,
+		EGG_VIRTUAL_MOD4_MASK, EGG_VIRTUAL_MOD5_MASK
+	      };
+
+	      len -= 6;
+	      accelerator += 4;
+	      mods |= mod_vals[*accelerator - '1'];
+	      accelerator += 2;
+	    }
+	  else if (len >= 5 && is_ctl (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 5 && is_alt (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_ALT_MASK;
+	    }
+          else if (len >= 6 && is_meta (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_META_MASK;
+	    }
+          else if (len >= 7 && is_hyper (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_HYPER_MASK;
+	    }
+          else if (len >= 7 && is_super (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SUPER_MASK;
+	    }
+	  else
+	    {
+	      gchar last_ch;
+
+	      last_ch = *accelerator;
+	      while (last_ch && last_ch != '>')
+		{
+		  last_ch = *accelerator;
+		  accelerator += 1;
+		  len -= 1;
+		}
+	    }
+	}
+      else
+	{
+          keyval = gdk_keyval_from_name (accelerator);
+
+          if (keyval == 0)
+            bad_keyval = TRUE;
+
+          accelerator += len;
+          len -= len;
+	}
+    }
+
+  if (accelerator_key)
+    *accelerator_key = gdk_keyval_to_lower (keyval);
+  if (accelerator_mods)
+    *accelerator_mods = mods;
+
+  return !bad_keyval;
+}
+
+void
+egg_keymap_resolve_virtual_modifiers (GdkKeymap              *keymap,
+                                      EggVirtualModifierType  virtual_mods,
+                                      GdkModifierType        *concrete_mods)
+{
+  GdkModifierType concrete;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (concrete_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  concrete = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if (modmap->mapping[i] & virtual_mods)
+        concrete |= (1 << i);
+
+      ++i;
+    }
+
+  *concrete_mods = concrete;
+}
+
+void
+egg_keymap_virtualize_modifiers (GdkKeymap              *keymap,
+                                 GdkModifierType         concrete_mods,
+                                 EggVirtualModifierType *virtual_mods)
+{
+  GdkModifierType virtual;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (virtual_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  virtual = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if ((1 << i) & concrete_mods)
+        {
+          EggVirtualModifierType cleaned;
+
+          cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK |
+                                           EGG_VIRTUAL_MOD3_MASK |
+                                           EGG_VIRTUAL_MOD4_MASK |
+                                           EGG_VIRTUAL_MOD5_MASK);
+
+          if (cleaned != 0)
+            {
+              virtual |= cleaned;
+            }
+          else
+            {
+              /* Rather than dropping mod2->mod5 if not bound,
+               * go ahead and use the concrete names
+               */
+              virtual |= modmap->mapping[i];
+            }
+        }
+
+      ++i;
+    }
+
+  *virtual_mods = virtual;
+}
+
+static void
+reload_modmap (GdkKeymap *keymap,
+               EggModmap *modmap)
+{
+  XModifierKeymap *xmodmap;
+  int map_size;
+  int i;
+
+  /* FIXME multihead */
+  xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ());
+
+  memset (modmap->mapping, 0, sizeof (modmap->mapping));
+
+  /* there are 8 modifiers, and the first 3 are shift, shift lock,
+   * and control
+   */
+  map_size = 8 * xmodmap->max_keypermod;
+  i = 3 * xmodmap->max_keypermod;
+  while (i < map_size)
+    {
+      /* get the key code at this point in the map,
+       * see if its keysym is one we're interested in
+       */
+      int keycode = xmodmap->modifiermap[i];
+      GdkKeymapKey *keys;
+      guint *keyvals;
+      int n_entries;
+      int j;
+      EggVirtualModifierType mask;
+
+      keys = NULL;
+      keyvals = NULL;
+      n_entries = 0;
+
+      gdk_keymap_get_entries_for_keycode (keymap,
+                                          keycode,
+                                          &keys, &keyvals, &n_entries);
+
+      mask = 0;
+      j = 0;
+      while (j < n_entries)
+        {
+          if (keyvals[j] == GDK_KEY_Num_Lock)
+            mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Scroll_Lock)
+            mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Meta_L ||
+                   keyvals[j] == GDK_KEY_Meta_R)
+            mask |= EGG_VIRTUAL_META_MASK;
+          else if (keyvals[j] == GDK_KEY_Hyper_L ||
+                   keyvals[j] == GDK_KEY_Hyper_R)
+            mask |= EGG_VIRTUAL_HYPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Super_L ||
+                   keyvals[j] == GDK_KEY_Super_R)
+            mask |= EGG_VIRTUAL_SUPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Mode_switch)
+            mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
+
+          ++j;
+        }
+
+      /* Mod1Mask is 1 << 3 for example, i.e. the
+       * fourth modifier, i / keyspermod is the modifier
+       * index
+       */
+      modmap->mapping[i/xmodmap->max_keypermod] |= mask;
+
+      g_free (keyvals);
+      g_free (keys);
+
+      ++i;
+    }
+
+  /* Add in the not-really-virtual fixed entries */
+  modmap->mapping[EGG_MODMAP_ENTRY_SHIFT] |= EGG_VIRTUAL_SHIFT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_CONTROL] |= EGG_VIRTUAL_CONTROL_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_LOCK] |= EGG_VIRTUAL_LOCK_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD1] |= EGG_VIRTUAL_ALT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD2] |= EGG_VIRTUAL_MOD2_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK;
+
+  XFreeModifiermap (xmodmap);
+}
+
+const EggModmap*
+egg_keymap_get_modmap (GdkKeymap *keymap)
+{
+  EggModmap *modmap;
+
+  /* This is all a hack, much simpler when we can just
+   * modify GDK directly.
+   */
+
+  modmap = g_object_get_data (G_OBJECT (keymap),
+                              "egg-modmap");
+
+  if (modmap == NULL)
+    {
+      modmap = g_new0 (EggModmap, 1);
+
+      /* FIXME modify keymap change events with an event filter
+       * and force a reload if we get one
+       */
+
+      reload_modmap (keymap, modmap);
+
+      g_object_set_data_full (G_OBJECT (keymap),
+                              "egg-modmap",
+                              modmap,
+                              g_free);
+    }
+
+  g_assert (modmap != NULL);
+
+  return modmap;
+}
+
+
+
+
+ + + diff --git a/2021-01-31-144137-4382-cppcheck@eea6c04110f3_master/index.html b/2021-01-31-144137-4382-cppcheck@eea6c04110f3_master/index.html new file mode 100644 index 0000000..fee3cf9 --- /dev/null +++ b/2021-01-31-144137-4382-cppcheck@eea6c04110f3_master/index.html @@ -0,0 +1,117 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+ + + + + + + +
LineIdCWESeverityMessage
0missingIncludeSysteminformationCppcheck cannot find all the include files (use --check-config for details)
src/eggaccelerators.c
321duplicateExpression398styleSame expression on both sides of '-='.
+
+
+ + + diff --git a/2021-01-31-144137-4382-cppcheck@eea6c04110f3_master/stats.html b/2021-01-31-144137-4382-cppcheck@eea6c04110f3_master/stats.html new file mode 100644 index 0000000..68c7d7b --- /dev/null +++ b/2021-01-31-144137-4382-cppcheck@eea6c04110f3_master/stats.html @@ -0,0 +1,105 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+

Top 10 files for style severity, total findings: 1
+   1  src/eggaccelerators.c
+

+ +
+
+ + + diff --git a/2021-01-31-144137-4382-cppcheck@eea6c04110f3_master/style.css b/2021-01-31-144137-4382-cppcheck@eea6c04110f3_master/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-01-31-144137-4382-cppcheck@eea6c04110f3_master/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-02-22-213320-6330-cppcheck@5105756a01af_master/0.html b/2021-02-22-213320-6330-cppcheck@5105756a01af_master/0.html new file mode 100644 index 0000000..0ea3181 --- /dev/null +++ b/2021-02-22-213320-6330-cppcheck@5105756a01af_master/0.html @@ -0,0 +1,1224 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
/* eggaccelerators.c
+ * Copyright (C) 2002  Red Hat, Inc.; Copyright 1998, 2001 Tim Janik
+ * Developed by Havoc Pennington, Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+
+#include "eggaccelerators.h"
+
+#include <string.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
+
+enum
+{
+  EGG_MODMAP_ENTRY_SHIFT   = 0,
+  EGG_MODMAP_ENTRY_LOCK    = 1,
+  EGG_MODMAP_ENTRY_CONTROL = 2,
+  EGG_MODMAP_ENTRY_MOD1    = 3,
+  EGG_MODMAP_ENTRY_MOD2    = 4,
+  EGG_MODMAP_ENTRY_MOD3    = 5,
+  EGG_MODMAP_ENTRY_MOD4    = 6,
+  EGG_MODMAP_ENTRY_MOD5    = 7,
+  EGG_MODMAP_ENTRY_LAST    = 8
+};
+
+#define MODMAP_ENTRY_TO_MODIFIER(x) (1 << (x))
+
+typedef struct
+{
+  EggVirtualModifierType mapping[EGG_MODMAP_ENTRY_LAST];
+
+} EggModmap;
+
+const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap);
+
+static inline gboolean
+is_alt (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'a' || string[1] == 'A') &&
+	  (string[2] == 'l' || string[2] == 'L') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_ctl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_modx (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'd' || string[3] == 'D') &&
+	  (string[4] >= '1' && string[4] <= '5') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_ctrl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'r' || string[3] == 'R') &&
+	  (string[4] == 'l' || string[4] == 'L') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shft (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'f' || string[3] == 'F') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shift (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'i' || string[3] == 'I') &&
+	  (string[4] == 'f' || string[4] == 'F') &&
+	  (string[5] == 't' || string[5] == 'T') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_control (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'n' || string[3] == 'N') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == 'o' || string[6] == 'O') &&
+	  (string[7] == 'l' || string[7] == 'L') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_release (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'r' || string[1] == 'R') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'a' || string[5] == 'A') &&
+	  (string[6] == 's' || string[6] == 'S') &&
+	  (string[7] == 'e' || string[7] == 'E') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_meta (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == 'a' || string[4] == 'A') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_super (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'u' || string[2] == 'U') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_hyper (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'h' || string[1] == 'H') &&
+	  (string[2] == 'y' || string[2] == 'Y') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+/**
+ * egg_accelerator_parse_virtual:
+ * @accelerator:      string representing an accelerator
+ * @accelerator_key:  return location for accelerator keyval
+ * @accelerator_mods: return location for accelerator modifier mask
+ *
+ * Parses a string representing a virtual accelerator. The format
+ * looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1" or
+ * "&lt;Release&gt;z" (the last one is for key release).  The parser
+ * is fairly liberal and allows lower or upper case, and also
+ * abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;".
+ *
+ * If the parse fails, @accelerator_key and @accelerator_mods will
+ * be set to 0 (zero) and %FALSE will be returned. If the string contains
+ * only modifiers, @accelerator_key will be set to 0 but %TRUE will be
+ * returned.
+ *
+ * The virtual vs. concrete accelerator distinction is a relic of
+ * how the X Window System works; there are modifiers Mod2-Mod5 that
+ * can represent various keyboard keys (numlock, meta, hyper, etc.),
+ * the virtual modifier represents the keyboard key, the concrete
+ * modifier the actual Mod2-Mod5 bits in the key press event.
+ *
+ * Returns: %TRUE on success.
+ */
+gboolean
+egg_accelerator_parse_virtual (const gchar            *accelerator,
+                               guint                  *accelerator_key,
+                               EggVirtualModifierType *accelerator_mods)
+{
+  guint keyval;
+  GdkModifierType mods;
+  gint len;
+  gboolean bad_keyval;
+
+  if (accelerator_key)
+    *accelerator_key = 0;
+  if (accelerator_mods)
+    *accelerator_mods = 0;
+
+  g_return_val_if_fail (accelerator != NULL, FALSE);
+
+  bad_keyval = FALSE;
+
+  keyval = 0;
+  mods = 0;
+  len = strlen (accelerator);
+  while (len)
+    {
+      if (*accelerator == '<')
+	{
+	  if (len >= 9 && is_release (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_RELEASE_MASK;
+	    }
+	  else if (len >= 9 && is_control (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 7 && is_shift (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_shft (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_ctrl (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 6 && is_modx (accelerator))
+	    {
+	      static const guint mod_vals[] = {
+		EGG_VIRTUAL_ALT_MASK, EGG_VIRTUAL_MOD2_MASK, EGG_VIRTUAL_MOD3_MASK,
+		EGG_VIRTUAL_MOD4_MASK, EGG_VIRTUAL_MOD5_MASK
+	      };
+
+	      len -= 6;
+	      accelerator += 4;
+	      mods |= mod_vals[*accelerator - '1'];
+	      accelerator += 2;
+	    }
+	  else if (len >= 5 && is_ctl (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 5 && is_alt (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_ALT_MASK;
+	    }
+          else if (len >= 6 && is_meta (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_META_MASK;
+	    }
+          else if (len >= 7 && is_hyper (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_HYPER_MASK;
+	    }
+          else if (len >= 7 && is_super (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SUPER_MASK;
+	    }
+	  else
+	    {
+	      gchar last_ch;
+
+	      last_ch = *accelerator;
+	      while (last_ch && last_ch != '>')
+		{
+		  last_ch = *accelerator;
+		  accelerator += 1;
+		  len -= 1;
+		}
+	    }
+	}
+      else
+	{
+          keyval = gdk_keyval_from_name (accelerator);
+
+          if (keyval == 0)
+            bad_keyval = TRUE;
+
+          accelerator += len;
+          len -= len;
+	}
+    }
+
+  if (accelerator_key)
+    *accelerator_key = gdk_keyval_to_lower (keyval);
+  if (accelerator_mods)
+    *accelerator_mods = mods;
+
+  return !bad_keyval;
+}
+
+void
+egg_keymap_resolve_virtual_modifiers (GdkKeymap              *keymap,
+                                      EggVirtualModifierType  virtual_mods,
+                                      GdkModifierType        *concrete_mods)
+{
+  GdkModifierType concrete;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (concrete_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  concrete = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if (modmap->mapping[i] & virtual_mods)
+        concrete |= (1 << i);
+
+      ++i;
+    }
+
+  *concrete_mods = concrete;
+}
+
+void
+egg_keymap_virtualize_modifiers (GdkKeymap              *keymap,
+                                 GdkModifierType         concrete_mods,
+                                 EggVirtualModifierType *virtual_mods)
+{
+  GdkModifierType virtual;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (virtual_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  virtual = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if ((1 << i) & concrete_mods)
+        {
+          EggVirtualModifierType cleaned;
+
+          cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK |
+                                           EGG_VIRTUAL_MOD3_MASK |
+                                           EGG_VIRTUAL_MOD4_MASK |
+                                           EGG_VIRTUAL_MOD5_MASK);
+
+          if (cleaned != 0)
+            {
+              virtual |= cleaned;
+            }
+          else
+            {
+              /* Rather than dropping mod2->mod5 if not bound,
+               * go ahead and use the concrete names
+               */
+              virtual |= modmap->mapping[i];
+            }
+        }
+
+      ++i;
+    }
+
+  *virtual_mods = virtual;
+}
+
+static void
+reload_modmap (GdkKeymap *keymap,
+               EggModmap *modmap)
+{
+  XModifierKeymap *xmodmap;
+  int map_size;
+  int i;
+
+  /* FIXME multihead */
+  xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ());
+
+  memset (modmap->mapping, 0, sizeof (modmap->mapping));
+
+  /* there are 8 modifiers, and the first 3 are shift, shift lock,
+   * and control
+   */
+  map_size = 8 * xmodmap->max_keypermod;
+  i = 3 * xmodmap->max_keypermod;
+  while (i < map_size)
+    {
+      /* get the key code at this point in the map,
+       * see if its keysym is one we're interested in
+       */
+      int keycode = xmodmap->modifiermap[i];
+      GdkKeymapKey *keys;
+      guint *keyvals;
+      int n_entries;
+      int j;
+      EggVirtualModifierType mask;
+
+      keys = NULL;
+      keyvals = NULL;
+      n_entries = 0;
+
+      gdk_keymap_get_entries_for_keycode (keymap,
+                                          keycode,
+                                          &keys, &keyvals, &n_entries);
+
+      mask = 0;
+      j = 0;
+      while (j < n_entries)
+        {
+          if (keyvals[j] == GDK_KEY_Num_Lock)
+            mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Scroll_Lock)
+            mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Meta_L ||
+                   keyvals[j] == GDK_KEY_Meta_R)
+            mask |= EGG_VIRTUAL_META_MASK;
+          else if (keyvals[j] == GDK_KEY_Hyper_L ||
+                   keyvals[j] == GDK_KEY_Hyper_R)
+            mask |= EGG_VIRTUAL_HYPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Super_L ||
+                   keyvals[j] == GDK_KEY_Super_R)
+            mask |= EGG_VIRTUAL_SUPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Mode_switch)
+            mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
+
+          ++j;
+        }
+
+      /* Mod1Mask is 1 << 3 for example, i.e. the
+       * fourth modifier, i / keyspermod is the modifier
+       * index
+       */
+      modmap->mapping[i/xmodmap->max_keypermod] |= mask;
+
+      g_free (keyvals);
+      g_free (keys);
+
+      ++i;
+    }
+
+  /* Add in the not-really-virtual fixed entries */
+  modmap->mapping[EGG_MODMAP_ENTRY_SHIFT] |= EGG_VIRTUAL_SHIFT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_CONTROL] |= EGG_VIRTUAL_CONTROL_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_LOCK] |= EGG_VIRTUAL_LOCK_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD1] |= EGG_VIRTUAL_ALT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD2] |= EGG_VIRTUAL_MOD2_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK;
+
+  XFreeModifiermap (xmodmap);
+}
+
+const EggModmap*
+egg_keymap_get_modmap (GdkKeymap *keymap)
+{
+  EggModmap *modmap;
+
+  /* This is all a hack, much simpler when we can just
+   * modify GDK directly.
+   */
+
+  modmap = g_object_get_data (G_OBJECT (keymap),
+                              "egg-modmap");
+
+  if (modmap == NULL)
+    {
+      modmap = g_new0 (EggModmap, 1);
+
+      /* FIXME modify keymap change events with an event filter
+       * and force a reload if we get one
+       */
+
+      reload_modmap (keymap, modmap);
+
+      g_object_set_data_full (G_OBJECT (keymap),
+                              "egg-modmap",
+                              modmap,
+                              g_free);
+    }
+
+  g_assert (modmap != NULL);
+
+  return modmap;
+}
+
+
+
+
+ + + diff --git a/2021-02-22-213320-6330-cppcheck@5105756a01af_master/index.html b/2021-02-22-213320-6330-cppcheck@5105756a01af_master/index.html new file mode 100644 index 0000000..fee3cf9 --- /dev/null +++ b/2021-02-22-213320-6330-cppcheck@5105756a01af_master/index.html @@ -0,0 +1,117 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+ + + + + + + +
LineIdCWESeverityMessage
0missingIncludeSysteminformationCppcheck cannot find all the include files (use --check-config for details)
src/eggaccelerators.c
321duplicateExpression398styleSame expression on both sides of '-='.
+
+
+ + + diff --git a/2021-02-22-213320-6330-cppcheck@5105756a01af_master/stats.html b/2021-02-22-213320-6330-cppcheck@5105756a01af_master/stats.html new file mode 100644 index 0000000..68c7d7b --- /dev/null +++ b/2021-02-22-213320-6330-cppcheck@5105756a01af_master/stats.html @@ -0,0 +1,105 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+

Top 10 files for style severity, total findings: 1
+   1  src/eggaccelerators.c
+

+ +
+
+ + + diff --git a/2021-02-22-213320-6330-cppcheck@5105756a01af_master/style.css b/2021-02-22-213320-6330-cppcheck@5105756a01af_master/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-02-22-213320-6330-cppcheck@5105756a01af_master/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-02-22-214239-8048-cppcheck@5b999d3d40b8_secondary-activate/0.html b/2021-02-22-214239-8048-cppcheck@5b999d3d40b8_secondary-activate/0.html new file mode 100644 index 0000000..0ea3181 --- /dev/null +++ b/2021-02-22-214239-8048-cppcheck@5b999d3d40b8_secondary-activate/0.html @@ -0,0 +1,1224 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
/* eggaccelerators.c
+ * Copyright (C) 2002  Red Hat, Inc.; Copyright 1998, 2001 Tim Janik
+ * Developed by Havoc Pennington, Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+
+#include "eggaccelerators.h"
+
+#include <string.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
+
+enum
+{
+  EGG_MODMAP_ENTRY_SHIFT   = 0,
+  EGG_MODMAP_ENTRY_LOCK    = 1,
+  EGG_MODMAP_ENTRY_CONTROL = 2,
+  EGG_MODMAP_ENTRY_MOD1    = 3,
+  EGG_MODMAP_ENTRY_MOD2    = 4,
+  EGG_MODMAP_ENTRY_MOD3    = 5,
+  EGG_MODMAP_ENTRY_MOD4    = 6,
+  EGG_MODMAP_ENTRY_MOD5    = 7,
+  EGG_MODMAP_ENTRY_LAST    = 8
+};
+
+#define MODMAP_ENTRY_TO_MODIFIER(x) (1 << (x))
+
+typedef struct
+{
+  EggVirtualModifierType mapping[EGG_MODMAP_ENTRY_LAST];
+
+} EggModmap;
+
+const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap);
+
+static inline gboolean
+is_alt (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'a' || string[1] == 'A') &&
+	  (string[2] == 'l' || string[2] == 'L') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_ctl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_modx (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'd' || string[3] == 'D') &&
+	  (string[4] >= '1' && string[4] <= '5') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_ctrl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'r' || string[3] == 'R') &&
+	  (string[4] == 'l' || string[4] == 'L') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shft (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'f' || string[3] == 'F') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shift (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'i' || string[3] == 'I') &&
+	  (string[4] == 'f' || string[4] == 'F') &&
+	  (string[5] == 't' || string[5] == 'T') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_control (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'n' || string[3] == 'N') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == 'o' || string[6] == 'O') &&
+	  (string[7] == 'l' || string[7] == 'L') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_release (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'r' || string[1] == 'R') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'a' || string[5] == 'A') &&
+	  (string[6] == 's' || string[6] == 'S') &&
+	  (string[7] == 'e' || string[7] == 'E') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_meta (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == 'a' || string[4] == 'A') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_super (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'u' || string[2] == 'U') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_hyper (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'h' || string[1] == 'H') &&
+	  (string[2] == 'y' || string[2] == 'Y') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+/**
+ * egg_accelerator_parse_virtual:
+ * @accelerator:      string representing an accelerator
+ * @accelerator_key:  return location for accelerator keyval
+ * @accelerator_mods: return location for accelerator modifier mask
+ *
+ * Parses a string representing a virtual accelerator. The format
+ * looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1" or
+ * "&lt;Release&gt;z" (the last one is for key release).  The parser
+ * is fairly liberal and allows lower or upper case, and also
+ * abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;".
+ *
+ * If the parse fails, @accelerator_key and @accelerator_mods will
+ * be set to 0 (zero) and %FALSE will be returned. If the string contains
+ * only modifiers, @accelerator_key will be set to 0 but %TRUE will be
+ * returned.
+ *
+ * The virtual vs. concrete accelerator distinction is a relic of
+ * how the X Window System works; there are modifiers Mod2-Mod5 that
+ * can represent various keyboard keys (numlock, meta, hyper, etc.),
+ * the virtual modifier represents the keyboard key, the concrete
+ * modifier the actual Mod2-Mod5 bits in the key press event.
+ *
+ * Returns: %TRUE on success.
+ */
+gboolean
+egg_accelerator_parse_virtual (const gchar            *accelerator,
+                               guint                  *accelerator_key,
+                               EggVirtualModifierType *accelerator_mods)
+{
+  guint keyval;
+  GdkModifierType mods;
+  gint len;
+  gboolean bad_keyval;
+
+  if (accelerator_key)
+    *accelerator_key = 0;
+  if (accelerator_mods)
+    *accelerator_mods = 0;
+
+  g_return_val_if_fail (accelerator != NULL, FALSE);
+
+  bad_keyval = FALSE;
+
+  keyval = 0;
+  mods = 0;
+  len = strlen (accelerator);
+  while (len)
+    {
+      if (*accelerator == '<')
+	{
+	  if (len >= 9 && is_release (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_RELEASE_MASK;
+	    }
+	  else if (len >= 9 && is_control (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 7 && is_shift (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_shft (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_ctrl (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 6 && is_modx (accelerator))
+	    {
+	      static const guint mod_vals[] = {
+		EGG_VIRTUAL_ALT_MASK, EGG_VIRTUAL_MOD2_MASK, EGG_VIRTUAL_MOD3_MASK,
+		EGG_VIRTUAL_MOD4_MASK, EGG_VIRTUAL_MOD5_MASK
+	      };
+
+	      len -= 6;
+	      accelerator += 4;
+	      mods |= mod_vals[*accelerator - '1'];
+	      accelerator += 2;
+	    }
+	  else if (len >= 5 && is_ctl (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 5 && is_alt (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_ALT_MASK;
+	    }
+          else if (len >= 6 && is_meta (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_META_MASK;
+	    }
+          else if (len >= 7 && is_hyper (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_HYPER_MASK;
+	    }
+          else if (len >= 7 && is_super (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SUPER_MASK;
+	    }
+	  else
+	    {
+	      gchar last_ch;
+
+	      last_ch = *accelerator;
+	      while (last_ch && last_ch != '>')
+		{
+		  last_ch = *accelerator;
+		  accelerator += 1;
+		  len -= 1;
+		}
+	    }
+	}
+      else
+	{
+          keyval = gdk_keyval_from_name (accelerator);
+
+          if (keyval == 0)
+            bad_keyval = TRUE;
+
+          accelerator += len;
+          len -= len;
+	}
+    }
+
+  if (accelerator_key)
+    *accelerator_key = gdk_keyval_to_lower (keyval);
+  if (accelerator_mods)
+    *accelerator_mods = mods;
+
+  return !bad_keyval;
+}
+
+void
+egg_keymap_resolve_virtual_modifiers (GdkKeymap              *keymap,
+                                      EggVirtualModifierType  virtual_mods,
+                                      GdkModifierType        *concrete_mods)
+{
+  GdkModifierType concrete;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (concrete_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  concrete = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if (modmap->mapping[i] & virtual_mods)
+        concrete |= (1 << i);
+
+      ++i;
+    }
+
+  *concrete_mods = concrete;
+}
+
+void
+egg_keymap_virtualize_modifiers (GdkKeymap              *keymap,
+                                 GdkModifierType         concrete_mods,
+                                 EggVirtualModifierType *virtual_mods)
+{
+  GdkModifierType virtual;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (virtual_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  virtual = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if ((1 << i) & concrete_mods)
+        {
+          EggVirtualModifierType cleaned;
+
+          cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK |
+                                           EGG_VIRTUAL_MOD3_MASK |
+                                           EGG_VIRTUAL_MOD4_MASK |
+                                           EGG_VIRTUAL_MOD5_MASK);
+
+          if (cleaned != 0)
+            {
+              virtual |= cleaned;
+            }
+          else
+            {
+              /* Rather than dropping mod2->mod5 if not bound,
+               * go ahead and use the concrete names
+               */
+              virtual |= modmap->mapping[i];
+            }
+        }
+
+      ++i;
+    }
+
+  *virtual_mods = virtual;
+}
+
+static void
+reload_modmap (GdkKeymap *keymap,
+               EggModmap *modmap)
+{
+  XModifierKeymap *xmodmap;
+  int map_size;
+  int i;
+
+  /* FIXME multihead */
+  xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ());
+
+  memset (modmap->mapping, 0, sizeof (modmap->mapping));
+
+  /* there are 8 modifiers, and the first 3 are shift, shift lock,
+   * and control
+   */
+  map_size = 8 * xmodmap->max_keypermod;
+  i = 3 * xmodmap->max_keypermod;
+  while (i < map_size)
+    {
+      /* get the key code at this point in the map,
+       * see if its keysym is one we're interested in
+       */
+      int keycode = xmodmap->modifiermap[i];
+      GdkKeymapKey *keys;
+      guint *keyvals;
+      int n_entries;
+      int j;
+      EggVirtualModifierType mask;
+
+      keys = NULL;
+      keyvals = NULL;
+      n_entries = 0;
+
+      gdk_keymap_get_entries_for_keycode (keymap,
+                                          keycode,
+                                          &keys, &keyvals, &n_entries);
+
+      mask = 0;
+      j = 0;
+      while (j < n_entries)
+        {
+          if (keyvals[j] == GDK_KEY_Num_Lock)
+            mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Scroll_Lock)
+            mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Meta_L ||
+                   keyvals[j] == GDK_KEY_Meta_R)
+            mask |= EGG_VIRTUAL_META_MASK;
+          else if (keyvals[j] == GDK_KEY_Hyper_L ||
+                   keyvals[j] == GDK_KEY_Hyper_R)
+            mask |= EGG_VIRTUAL_HYPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Super_L ||
+                   keyvals[j] == GDK_KEY_Super_R)
+            mask |= EGG_VIRTUAL_SUPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Mode_switch)
+            mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
+
+          ++j;
+        }
+
+      /* Mod1Mask is 1 << 3 for example, i.e. the
+       * fourth modifier, i / keyspermod is the modifier
+       * index
+       */
+      modmap->mapping[i/xmodmap->max_keypermod] |= mask;
+
+      g_free (keyvals);
+      g_free (keys);
+
+      ++i;
+    }
+
+  /* Add in the not-really-virtual fixed entries */
+  modmap->mapping[EGG_MODMAP_ENTRY_SHIFT] |= EGG_VIRTUAL_SHIFT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_CONTROL] |= EGG_VIRTUAL_CONTROL_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_LOCK] |= EGG_VIRTUAL_LOCK_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD1] |= EGG_VIRTUAL_ALT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD2] |= EGG_VIRTUAL_MOD2_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK;
+
+  XFreeModifiermap (xmodmap);
+}
+
+const EggModmap*
+egg_keymap_get_modmap (GdkKeymap *keymap)
+{
+  EggModmap *modmap;
+
+  /* This is all a hack, much simpler when we can just
+   * modify GDK directly.
+   */
+
+  modmap = g_object_get_data (G_OBJECT (keymap),
+                              "egg-modmap");
+
+  if (modmap == NULL)
+    {
+      modmap = g_new0 (EggModmap, 1);
+
+      /* FIXME modify keymap change events with an event filter
+       * and force a reload if we get one
+       */
+
+      reload_modmap (keymap, modmap);
+
+      g_object_set_data_full (G_OBJECT (keymap),
+                              "egg-modmap",
+                              modmap,
+                              g_free);
+    }
+
+  g_assert (modmap != NULL);
+
+  return modmap;
+}
+
+
+
+
+ + + diff --git a/2021-02-22-214239-8048-cppcheck@5b999d3d40b8_secondary-activate/index.html b/2021-02-22-214239-8048-cppcheck@5b999d3d40b8_secondary-activate/index.html new file mode 100644 index 0000000..fee3cf9 --- /dev/null +++ b/2021-02-22-214239-8048-cppcheck@5b999d3d40b8_secondary-activate/index.html @@ -0,0 +1,117 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+ + + + + + + +
LineIdCWESeverityMessage
0missingIncludeSysteminformationCppcheck cannot find all the include files (use --check-config for details)
src/eggaccelerators.c
321duplicateExpression398styleSame expression on both sides of '-='.
+
+
+ + + diff --git a/2021-02-22-214239-8048-cppcheck@5b999d3d40b8_secondary-activate/stats.html b/2021-02-22-214239-8048-cppcheck@5b999d3d40b8_secondary-activate/stats.html new file mode 100644 index 0000000..68c7d7b --- /dev/null +++ b/2021-02-22-214239-8048-cppcheck@5b999d3d40b8_secondary-activate/stats.html @@ -0,0 +1,105 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+

Top 10 files for style severity, total findings: 1
+   1  src/eggaccelerators.c
+

+ +
+
+ + + diff --git a/2021-02-22-214239-8048-cppcheck@5b999d3d40b8_secondary-activate/style.css b/2021-02-22-214239-8048-cppcheck@5b999d3d40b8_secondary-activate/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-02-22-214239-8048-cppcheck@5b999d3d40b8_secondary-activate/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-02-22-225725-0240-cppcheck@24b898a0111f_master/0.html b/2021-02-22-225725-0240-cppcheck@24b898a0111f_master/0.html new file mode 100644 index 0000000..0ea3181 --- /dev/null +++ b/2021-02-22-225725-0240-cppcheck@24b898a0111f_master/0.html @@ -0,0 +1,1224 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
/* eggaccelerators.c
+ * Copyright (C) 2002  Red Hat, Inc.; Copyright 1998, 2001 Tim Janik
+ * Developed by Havoc Pennington, Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+
+#include "eggaccelerators.h"
+
+#include <string.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
+
+enum
+{
+  EGG_MODMAP_ENTRY_SHIFT   = 0,
+  EGG_MODMAP_ENTRY_LOCK    = 1,
+  EGG_MODMAP_ENTRY_CONTROL = 2,
+  EGG_MODMAP_ENTRY_MOD1    = 3,
+  EGG_MODMAP_ENTRY_MOD2    = 4,
+  EGG_MODMAP_ENTRY_MOD3    = 5,
+  EGG_MODMAP_ENTRY_MOD4    = 6,
+  EGG_MODMAP_ENTRY_MOD5    = 7,
+  EGG_MODMAP_ENTRY_LAST    = 8
+};
+
+#define MODMAP_ENTRY_TO_MODIFIER(x) (1 << (x))
+
+typedef struct
+{
+  EggVirtualModifierType mapping[EGG_MODMAP_ENTRY_LAST];
+
+} EggModmap;
+
+const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap);
+
+static inline gboolean
+is_alt (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'a' || string[1] == 'A') &&
+	  (string[2] == 'l' || string[2] == 'L') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_ctl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_modx (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'd' || string[3] == 'D') &&
+	  (string[4] >= '1' && string[4] <= '5') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_ctrl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'r' || string[3] == 'R') &&
+	  (string[4] == 'l' || string[4] == 'L') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shft (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'f' || string[3] == 'F') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shift (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'i' || string[3] == 'I') &&
+	  (string[4] == 'f' || string[4] == 'F') &&
+	  (string[5] == 't' || string[5] == 'T') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_control (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'n' || string[3] == 'N') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == 'o' || string[6] == 'O') &&
+	  (string[7] == 'l' || string[7] == 'L') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_release (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'r' || string[1] == 'R') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'a' || string[5] == 'A') &&
+	  (string[6] == 's' || string[6] == 'S') &&
+	  (string[7] == 'e' || string[7] == 'E') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_meta (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == 'a' || string[4] == 'A') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_super (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'u' || string[2] == 'U') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_hyper (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'h' || string[1] == 'H') &&
+	  (string[2] == 'y' || string[2] == 'Y') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+/**
+ * egg_accelerator_parse_virtual:
+ * @accelerator:      string representing an accelerator
+ * @accelerator_key:  return location for accelerator keyval
+ * @accelerator_mods: return location for accelerator modifier mask
+ *
+ * Parses a string representing a virtual accelerator. The format
+ * looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1" or
+ * "&lt;Release&gt;z" (the last one is for key release).  The parser
+ * is fairly liberal and allows lower or upper case, and also
+ * abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;".
+ *
+ * If the parse fails, @accelerator_key and @accelerator_mods will
+ * be set to 0 (zero) and %FALSE will be returned. If the string contains
+ * only modifiers, @accelerator_key will be set to 0 but %TRUE will be
+ * returned.
+ *
+ * The virtual vs. concrete accelerator distinction is a relic of
+ * how the X Window System works; there are modifiers Mod2-Mod5 that
+ * can represent various keyboard keys (numlock, meta, hyper, etc.),
+ * the virtual modifier represents the keyboard key, the concrete
+ * modifier the actual Mod2-Mod5 bits in the key press event.
+ *
+ * Returns: %TRUE on success.
+ */
+gboolean
+egg_accelerator_parse_virtual (const gchar            *accelerator,
+                               guint                  *accelerator_key,
+                               EggVirtualModifierType *accelerator_mods)
+{
+  guint keyval;
+  GdkModifierType mods;
+  gint len;
+  gboolean bad_keyval;
+
+  if (accelerator_key)
+    *accelerator_key = 0;
+  if (accelerator_mods)
+    *accelerator_mods = 0;
+
+  g_return_val_if_fail (accelerator != NULL, FALSE);
+
+  bad_keyval = FALSE;
+
+  keyval = 0;
+  mods = 0;
+  len = strlen (accelerator);
+  while (len)
+    {
+      if (*accelerator == '<')
+	{
+	  if (len >= 9 && is_release (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_RELEASE_MASK;
+	    }
+	  else if (len >= 9 && is_control (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 7 && is_shift (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_shft (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_ctrl (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 6 && is_modx (accelerator))
+	    {
+	      static const guint mod_vals[] = {
+		EGG_VIRTUAL_ALT_MASK, EGG_VIRTUAL_MOD2_MASK, EGG_VIRTUAL_MOD3_MASK,
+		EGG_VIRTUAL_MOD4_MASK, EGG_VIRTUAL_MOD5_MASK
+	      };
+
+	      len -= 6;
+	      accelerator += 4;
+	      mods |= mod_vals[*accelerator - '1'];
+	      accelerator += 2;
+	    }
+	  else if (len >= 5 && is_ctl (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 5 && is_alt (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_ALT_MASK;
+	    }
+          else if (len >= 6 && is_meta (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_META_MASK;
+	    }
+          else if (len >= 7 && is_hyper (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_HYPER_MASK;
+	    }
+          else if (len >= 7 && is_super (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SUPER_MASK;
+	    }
+	  else
+	    {
+	      gchar last_ch;
+
+	      last_ch = *accelerator;
+	      while (last_ch && last_ch != '>')
+		{
+		  last_ch = *accelerator;
+		  accelerator += 1;
+		  len -= 1;
+		}
+	    }
+	}
+      else
+	{
+          keyval = gdk_keyval_from_name (accelerator);
+
+          if (keyval == 0)
+            bad_keyval = TRUE;
+
+          accelerator += len;
+          len -= len;
+	}
+    }
+
+  if (accelerator_key)
+    *accelerator_key = gdk_keyval_to_lower (keyval);
+  if (accelerator_mods)
+    *accelerator_mods = mods;
+
+  return !bad_keyval;
+}
+
+void
+egg_keymap_resolve_virtual_modifiers (GdkKeymap              *keymap,
+                                      EggVirtualModifierType  virtual_mods,
+                                      GdkModifierType        *concrete_mods)
+{
+  GdkModifierType concrete;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (concrete_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  concrete = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if (modmap->mapping[i] & virtual_mods)
+        concrete |= (1 << i);
+
+      ++i;
+    }
+
+  *concrete_mods = concrete;
+}
+
+void
+egg_keymap_virtualize_modifiers (GdkKeymap              *keymap,
+                                 GdkModifierType         concrete_mods,
+                                 EggVirtualModifierType *virtual_mods)
+{
+  GdkModifierType virtual;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (virtual_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  virtual = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if ((1 << i) & concrete_mods)
+        {
+          EggVirtualModifierType cleaned;
+
+          cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK |
+                                           EGG_VIRTUAL_MOD3_MASK |
+                                           EGG_VIRTUAL_MOD4_MASK |
+                                           EGG_VIRTUAL_MOD5_MASK);
+
+          if (cleaned != 0)
+            {
+              virtual |= cleaned;
+            }
+          else
+            {
+              /* Rather than dropping mod2->mod5 if not bound,
+               * go ahead and use the concrete names
+               */
+              virtual |= modmap->mapping[i];
+            }
+        }
+
+      ++i;
+    }
+
+  *virtual_mods = virtual;
+}
+
+static void
+reload_modmap (GdkKeymap *keymap,
+               EggModmap *modmap)
+{
+  XModifierKeymap *xmodmap;
+  int map_size;
+  int i;
+
+  /* FIXME multihead */
+  xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ());
+
+  memset (modmap->mapping, 0, sizeof (modmap->mapping));
+
+  /* there are 8 modifiers, and the first 3 are shift, shift lock,
+   * and control
+   */
+  map_size = 8 * xmodmap->max_keypermod;
+  i = 3 * xmodmap->max_keypermod;
+  while (i < map_size)
+    {
+      /* get the key code at this point in the map,
+       * see if its keysym is one we're interested in
+       */
+      int keycode = xmodmap->modifiermap[i];
+      GdkKeymapKey *keys;
+      guint *keyvals;
+      int n_entries;
+      int j;
+      EggVirtualModifierType mask;
+
+      keys = NULL;
+      keyvals = NULL;
+      n_entries = 0;
+
+      gdk_keymap_get_entries_for_keycode (keymap,
+                                          keycode,
+                                          &keys, &keyvals, &n_entries);
+
+      mask = 0;
+      j = 0;
+      while (j < n_entries)
+        {
+          if (keyvals[j] == GDK_KEY_Num_Lock)
+            mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Scroll_Lock)
+            mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Meta_L ||
+                   keyvals[j] == GDK_KEY_Meta_R)
+            mask |= EGG_VIRTUAL_META_MASK;
+          else if (keyvals[j] == GDK_KEY_Hyper_L ||
+                   keyvals[j] == GDK_KEY_Hyper_R)
+            mask |= EGG_VIRTUAL_HYPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Super_L ||
+                   keyvals[j] == GDK_KEY_Super_R)
+            mask |= EGG_VIRTUAL_SUPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Mode_switch)
+            mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
+
+          ++j;
+        }
+
+      /* Mod1Mask is 1 << 3 for example, i.e. the
+       * fourth modifier, i / keyspermod is the modifier
+       * index
+       */
+      modmap->mapping[i/xmodmap->max_keypermod] |= mask;
+
+      g_free (keyvals);
+      g_free (keys);
+
+      ++i;
+    }
+
+  /* Add in the not-really-virtual fixed entries */
+  modmap->mapping[EGG_MODMAP_ENTRY_SHIFT] |= EGG_VIRTUAL_SHIFT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_CONTROL] |= EGG_VIRTUAL_CONTROL_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_LOCK] |= EGG_VIRTUAL_LOCK_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD1] |= EGG_VIRTUAL_ALT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD2] |= EGG_VIRTUAL_MOD2_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK;
+
+  XFreeModifiermap (xmodmap);
+}
+
+const EggModmap*
+egg_keymap_get_modmap (GdkKeymap *keymap)
+{
+  EggModmap *modmap;
+
+  /* This is all a hack, much simpler when we can just
+   * modify GDK directly.
+   */
+
+  modmap = g_object_get_data (G_OBJECT (keymap),
+                              "egg-modmap");
+
+  if (modmap == NULL)
+    {
+      modmap = g_new0 (EggModmap, 1);
+
+      /* FIXME modify keymap change events with an event filter
+       * and force a reload if we get one
+       */
+
+      reload_modmap (keymap, modmap);
+
+      g_object_set_data_full (G_OBJECT (keymap),
+                              "egg-modmap",
+                              modmap,
+                              g_free);
+    }
+
+  g_assert (modmap != NULL);
+
+  return modmap;
+}
+
+
+
+
+ + + diff --git a/2021-02-22-225725-0240-cppcheck@24b898a0111f_master/index.html b/2021-02-22-225725-0240-cppcheck@24b898a0111f_master/index.html new file mode 100644 index 0000000..fee3cf9 --- /dev/null +++ b/2021-02-22-225725-0240-cppcheck@24b898a0111f_master/index.html @@ -0,0 +1,117 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+ + + + + + + +
LineIdCWESeverityMessage
0missingIncludeSysteminformationCppcheck cannot find all the include files (use --check-config for details)
src/eggaccelerators.c
321duplicateExpression398styleSame expression on both sides of '-='.
+
+
+ + + diff --git a/2021-02-22-225725-0240-cppcheck@24b898a0111f_master/stats.html b/2021-02-22-225725-0240-cppcheck@24b898a0111f_master/stats.html new file mode 100644 index 0000000..68c7d7b --- /dev/null +++ b/2021-02-22-225725-0240-cppcheck@24b898a0111f_master/stats.html @@ -0,0 +1,105 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+

Top 10 files for style severity, total findings: 1
+   1  src/eggaccelerators.c
+

+ +
+
+ + + diff --git a/2021-02-22-225725-0240-cppcheck@24b898a0111f_master/style.css b/2021-02-22-225725-0240-cppcheck@24b898a0111f_master/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-02-22-225725-0240-cppcheck@24b898a0111f_master/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-03-08-213753-5997-cppcheck@0e63a44d86f9_master/0.html b/2021-03-08-213753-5997-cppcheck@0e63a44d86f9_master/0.html new file mode 100644 index 0000000..0ea3181 --- /dev/null +++ b/2021-03-08-213753-5997-cppcheck@0e63a44d86f9_master/0.html @@ -0,0 +1,1224 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
/* eggaccelerators.c
+ * Copyright (C) 2002  Red Hat, Inc.; Copyright 1998, 2001 Tim Janik
+ * Developed by Havoc Pennington, Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+
+#include "eggaccelerators.h"
+
+#include <string.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
+
+enum
+{
+  EGG_MODMAP_ENTRY_SHIFT   = 0,
+  EGG_MODMAP_ENTRY_LOCK    = 1,
+  EGG_MODMAP_ENTRY_CONTROL = 2,
+  EGG_MODMAP_ENTRY_MOD1    = 3,
+  EGG_MODMAP_ENTRY_MOD2    = 4,
+  EGG_MODMAP_ENTRY_MOD3    = 5,
+  EGG_MODMAP_ENTRY_MOD4    = 6,
+  EGG_MODMAP_ENTRY_MOD5    = 7,
+  EGG_MODMAP_ENTRY_LAST    = 8
+};
+
+#define MODMAP_ENTRY_TO_MODIFIER(x) (1 << (x))
+
+typedef struct
+{
+  EggVirtualModifierType mapping[EGG_MODMAP_ENTRY_LAST];
+
+} EggModmap;
+
+const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap);
+
+static inline gboolean
+is_alt (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'a' || string[1] == 'A') &&
+	  (string[2] == 'l' || string[2] == 'L') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_ctl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_modx (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'd' || string[3] == 'D') &&
+	  (string[4] >= '1' && string[4] <= '5') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_ctrl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'r' || string[3] == 'R') &&
+	  (string[4] == 'l' || string[4] == 'L') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shft (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'f' || string[3] == 'F') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shift (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'i' || string[3] == 'I') &&
+	  (string[4] == 'f' || string[4] == 'F') &&
+	  (string[5] == 't' || string[5] == 'T') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_control (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'n' || string[3] == 'N') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == 'o' || string[6] == 'O') &&
+	  (string[7] == 'l' || string[7] == 'L') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_release (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'r' || string[1] == 'R') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'a' || string[5] == 'A') &&
+	  (string[6] == 's' || string[6] == 'S') &&
+	  (string[7] == 'e' || string[7] == 'E') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_meta (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == 'a' || string[4] == 'A') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_super (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'u' || string[2] == 'U') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_hyper (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'h' || string[1] == 'H') &&
+	  (string[2] == 'y' || string[2] == 'Y') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+/**
+ * egg_accelerator_parse_virtual:
+ * @accelerator:      string representing an accelerator
+ * @accelerator_key:  return location for accelerator keyval
+ * @accelerator_mods: return location for accelerator modifier mask
+ *
+ * Parses a string representing a virtual accelerator. The format
+ * looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1" or
+ * "&lt;Release&gt;z" (the last one is for key release).  The parser
+ * is fairly liberal and allows lower or upper case, and also
+ * abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;".
+ *
+ * If the parse fails, @accelerator_key and @accelerator_mods will
+ * be set to 0 (zero) and %FALSE will be returned. If the string contains
+ * only modifiers, @accelerator_key will be set to 0 but %TRUE will be
+ * returned.
+ *
+ * The virtual vs. concrete accelerator distinction is a relic of
+ * how the X Window System works; there are modifiers Mod2-Mod5 that
+ * can represent various keyboard keys (numlock, meta, hyper, etc.),
+ * the virtual modifier represents the keyboard key, the concrete
+ * modifier the actual Mod2-Mod5 bits in the key press event.
+ *
+ * Returns: %TRUE on success.
+ */
+gboolean
+egg_accelerator_parse_virtual (const gchar            *accelerator,
+                               guint                  *accelerator_key,
+                               EggVirtualModifierType *accelerator_mods)
+{
+  guint keyval;
+  GdkModifierType mods;
+  gint len;
+  gboolean bad_keyval;
+
+  if (accelerator_key)
+    *accelerator_key = 0;
+  if (accelerator_mods)
+    *accelerator_mods = 0;
+
+  g_return_val_if_fail (accelerator != NULL, FALSE);
+
+  bad_keyval = FALSE;
+
+  keyval = 0;
+  mods = 0;
+  len = strlen (accelerator);
+  while (len)
+    {
+      if (*accelerator == '<')
+	{
+	  if (len >= 9 && is_release (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_RELEASE_MASK;
+	    }
+	  else if (len >= 9 && is_control (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 7 && is_shift (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_shft (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_ctrl (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 6 && is_modx (accelerator))
+	    {
+	      static const guint mod_vals[] = {
+		EGG_VIRTUAL_ALT_MASK, EGG_VIRTUAL_MOD2_MASK, EGG_VIRTUAL_MOD3_MASK,
+		EGG_VIRTUAL_MOD4_MASK, EGG_VIRTUAL_MOD5_MASK
+	      };
+
+	      len -= 6;
+	      accelerator += 4;
+	      mods |= mod_vals[*accelerator - '1'];
+	      accelerator += 2;
+	    }
+	  else if (len >= 5 && is_ctl (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 5 && is_alt (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_ALT_MASK;
+	    }
+          else if (len >= 6 && is_meta (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_META_MASK;
+	    }
+          else if (len >= 7 && is_hyper (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_HYPER_MASK;
+	    }
+          else if (len >= 7 && is_super (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SUPER_MASK;
+	    }
+	  else
+	    {
+	      gchar last_ch;
+
+	      last_ch = *accelerator;
+	      while (last_ch && last_ch != '>')
+		{
+		  last_ch = *accelerator;
+		  accelerator += 1;
+		  len -= 1;
+		}
+	    }
+	}
+      else
+	{
+          keyval = gdk_keyval_from_name (accelerator);
+
+          if (keyval == 0)
+            bad_keyval = TRUE;
+
+          accelerator += len;
+          len -= len;
+	}
+    }
+
+  if (accelerator_key)
+    *accelerator_key = gdk_keyval_to_lower (keyval);
+  if (accelerator_mods)
+    *accelerator_mods = mods;
+
+  return !bad_keyval;
+}
+
+void
+egg_keymap_resolve_virtual_modifiers (GdkKeymap              *keymap,
+                                      EggVirtualModifierType  virtual_mods,
+                                      GdkModifierType        *concrete_mods)
+{
+  GdkModifierType concrete;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (concrete_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  concrete = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if (modmap->mapping[i] & virtual_mods)
+        concrete |= (1 << i);
+
+      ++i;
+    }
+
+  *concrete_mods = concrete;
+}
+
+void
+egg_keymap_virtualize_modifiers (GdkKeymap              *keymap,
+                                 GdkModifierType         concrete_mods,
+                                 EggVirtualModifierType *virtual_mods)
+{
+  GdkModifierType virtual;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (virtual_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  virtual = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if ((1 << i) & concrete_mods)
+        {
+          EggVirtualModifierType cleaned;
+
+          cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK |
+                                           EGG_VIRTUAL_MOD3_MASK |
+                                           EGG_VIRTUAL_MOD4_MASK |
+                                           EGG_VIRTUAL_MOD5_MASK);
+
+          if (cleaned != 0)
+            {
+              virtual |= cleaned;
+            }
+          else
+            {
+              /* Rather than dropping mod2->mod5 if not bound,
+               * go ahead and use the concrete names
+               */
+              virtual |= modmap->mapping[i];
+            }
+        }
+
+      ++i;
+    }
+
+  *virtual_mods = virtual;
+}
+
+static void
+reload_modmap (GdkKeymap *keymap,
+               EggModmap *modmap)
+{
+  XModifierKeymap *xmodmap;
+  int map_size;
+  int i;
+
+  /* FIXME multihead */
+  xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ());
+
+  memset (modmap->mapping, 0, sizeof (modmap->mapping));
+
+  /* there are 8 modifiers, and the first 3 are shift, shift lock,
+   * and control
+   */
+  map_size = 8 * xmodmap->max_keypermod;
+  i = 3 * xmodmap->max_keypermod;
+  while (i < map_size)
+    {
+      /* get the key code at this point in the map,
+       * see if its keysym is one we're interested in
+       */
+      int keycode = xmodmap->modifiermap[i];
+      GdkKeymapKey *keys;
+      guint *keyvals;
+      int n_entries;
+      int j;
+      EggVirtualModifierType mask;
+
+      keys = NULL;
+      keyvals = NULL;
+      n_entries = 0;
+
+      gdk_keymap_get_entries_for_keycode (keymap,
+                                          keycode,
+                                          &keys, &keyvals, &n_entries);
+
+      mask = 0;
+      j = 0;
+      while (j < n_entries)
+        {
+          if (keyvals[j] == GDK_KEY_Num_Lock)
+            mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Scroll_Lock)
+            mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Meta_L ||
+                   keyvals[j] == GDK_KEY_Meta_R)
+            mask |= EGG_VIRTUAL_META_MASK;
+          else if (keyvals[j] == GDK_KEY_Hyper_L ||
+                   keyvals[j] == GDK_KEY_Hyper_R)
+            mask |= EGG_VIRTUAL_HYPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Super_L ||
+                   keyvals[j] == GDK_KEY_Super_R)
+            mask |= EGG_VIRTUAL_SUPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Mode_switch)
+            mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
+
+          ++j;
+        }
+
+      /* Mod1Mask is 1 << 3 for example, i.e. the
+       * fourth modifier, i / keyspermod is the modifier
+       * index
+       */
+      modmap->mapping[i/xmodmap->max_keypermod] |= mask;
+
+      g_free (keyvals);
+      g_free (keys);
+
+      ++i;
+    }
+
+  /* Add in the not-really-virtual fixed entries */
+  modmap->mapping[EGG_MODMAP_ENTRY_SHIFT] |= EGG_VIRTUAL_SHIFT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_CONTROL] |= EGG_VIRTUAL_CONTROL_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_LOCK] |= EGG_VIRTUAL_LOCK_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD1] |= EGG_VIRTUAL_ALT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD2] |= EGG_VIRTUAL_MOD2_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK;
+
+  XFreeModifiermap (xmodmap);
+}
+
+const EggModmap*
+egg_keymap_get_modmap (GdkKeymap *keymap)
+{
+  EggModmap *modmap;
+
+  /* This is all a hack, much simpler when we can just
+   * modify GDK directly.
+   */
+
+  modmap = g_object_get_data (G_OBJECT (keymap),
+                              "egg-modmap");
+
+  if (modmap == NULL)
+    {
+      modmap = g_new0 (EggModmap, 1);
+
+      /* FIXME modify keymap change events with an event filter
+       * and force a reload if we get one
+       */
+
+      reload_modmap (keymap, modmap);
+
+      g_object_set_data_full (G_OBJECT (keymap),
+                              "egg-modmap",
+                              modmap,
+                              g_free);
+    }
+
+  g_assert (modmap != NULL);
+
+  return modmap;
+}
+
+
+
+
+ + + diff --git a/2021-03-08-213753-5997-cppcheck@0e63a44d86f9_master/index.html b/2021-03-08-213753-5997-cppcheck@0e63a44d86f9_master/index.html new file mode 100644 index 0000000..fee3cf9 --- /dev/null +++ b/2021-03-08-213753-5997-cppcheck@0e63a44d86f9_master/index.html @@ -0,0 +1,117 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+ + + + + + + +
LineIdCWESeverityMessage
0missingIncludeSysteminformationCppcheck cannot find all the include files (use --check-config for details)
src/eggaccelerators.c
321duplicateExpression398styleSame expression on both sides of '-='.
+
+
+ + + diff --git a/2021-03-08-213753-5997-cppcheck@0e63a44d86f9_master/stats.html b/2021-03-08-213753-5997-cppcheck@0e63a44d86f9_master/stats.html new file mode 100644 index 0000000..68c7d7b --- /dev/null +++ b/2021-03-08-213753-5997-cppcheck@0e63a44d86f9_master/stats.html @@ -0,0 +1,105 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+

Top 10 files for style severity, total findings: 1
+   1  src/eggaccelerators.c
+

+ +
+
+ + + diff --git a/2021-03-08-213753-5997-cppcheck@0e63a44d86f9_master/style.css b/2021-03-08-213753-5997-cppcheck@0e63a44d86f9_master/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-03-08-213753-5997-cppcheck@0e63a44d86f9_master/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-04-24-225231-0061-cppcheck@9971c97b5889_master/0.html b/2021-04-24-225231-0061-cppcheck@9971c97b5889_master/0.html new file mode 100644 index 0000000..0ea3181 --- /dev/null +++ b/2021-04-24-225231-0061-cppcheck@9971c97b5889_master/0.html @@ -0,0 +1,1224 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
/* eggaccelerators.c
+ * Copyright (C) 2002  Red Hat, Inc.; Copyright 1998, 2001 Tim Janik
+ * Developed by Havoc Pennington, Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+
+#include "eggaccelerators.h"
+
+#include <string.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
+
+enum
+{
+  EGG_MODMAP_ENTRY_SHIFT   = 0,
+  EGG_MODMAP_ENTRY_LOCK    = 1,
+  EGG_MODMAP_ENTRY_CONTROL = 2,
+  EGG_MODMAP_ENTRY_MOD1    = 3,
+  EGG_MODMAP_ENTRY_MOD2    = 4,
+  EGG_MODMAP_ENTRY_MOD3    = 5,
+  EGG_MODMAP_ENTRY_MOD4    = 6,
+  EGG_MODMAP_ENTRY_MOD5    = 7,
+  EGG_MODMAP_ENTRY_LAST    = 8
+};
+
+#define MODMAP_ENTRY_TO_MODIFIER(x) (1 << (x))
+
+typedef struct
+{
+  EggVirtualModifierType mapping[EGG_MODMAP_ENTRY_LAST];
+
+} EggModmap;
+
+const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap);
+
+static inline gboolean
+is_alt (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'a' || string[1] == 'A') &&
+	  (string[2] == 'l' || string[2] == 'L') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_ctl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_modx (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'd' || string[3] == 'D') &&
+	  (string[4] >= '1' && string[4] <= '5') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_ctrl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'r' || string[3] == 'R') &&
+	  (string[4] == 'l' || string[4] == 'L') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shft (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'f' || string[3] == 'F') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shift (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'i' || string[3] == 'I') &&
+	  (string[4] == 'f' || string[4] == 'F') &&
+	  (string[5] == 't' || string[5] == 'T') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_control (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'n' || string[3] == 'N') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == 'o' || string[6] == 'O') &&
+	  (string[7] == 'l' || string[7] == 'L') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_release (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'r' || string[1] == 'R') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'a' || string[5] == 'A') &&
+	  (string[6] == 's' || string[6] == 'S') &&
+	  (string[7] == 'e' || string[7] == 'E') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_meta (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == 'a' || string[4] == 'A') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_super (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'u' || string[2] == 'U') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_hyper (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'h' || string[1] == 'H') &&
+	  (string[2] == 'y' || string[2] == 'Y') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+/**
+ * egg_accelerator_parse_virtual:
+ * @accelerator:      string representing an accelerator
+ * @accelerator_key:  return location for accelerator keyval
+ * @accelerator_mods: return location for accelerator modifier mask
+ *
+ * Parses a string representing a virtual accelerator. The format
+ * looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1" or
+ * "&lt;Release&gt;z" (the last one is for key release).  The parser
+ * is fairly liberal and allows lower or upper case, and also
+ * abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;".
+ *
+ * If the parse fails, @accelerator_key and @accelerator_mods will
+ * be set to 0 (zero) and %FALSE will be returned. If the string contains
+ * only modifiers, @accelerator_key will be set to 0 but %TRUE will be
+ * returned.
+ *
+ * The virtual vs. concrete accelerator distinction is a relic of
+ * how the X Window System works; there are modifiers Mod2-Mod5 that
+ * can represent various keyboard keys (numlock, meta, hyper, etc.),
+ * the virtual modifier represents the keyboard key, the concrete
+ * modifier the actual Mod2-Mod5 bits in the key press event.
+ *
+ * Returns: %TRUE on success.
+ */
+gboolean
+egg_accelerator_parse_virtual (const gchar            *accelerator,
+                               guint                  *accelerator_key,
+                               EggVirtualModifierType *accelerator_mods)
+{
+  guint keyval;
+  GdkModifierType mods;
+  gint len;
+  gboolean bad_keyval;
+
+  if (accelerator_key)
+    *accelerator_key = 0;
+  if (accelerator_mods)
+    *accelerator_mods = 0;
+
+  g_return_val_if_fail (accelerator != NULL, FALSE);
+
+  bad_keyval = FALSE;
+
+  keyval = 0;
+  mods = 0;
+  len = strlen (accelerator);
+  while (len)
+    {
+      if (*accelerator == '<')
+	{
+	  if (len >= 9 && is_release (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_RELEASE_MASK;
+	    }
+	  else if (len >= 9 && is_control (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 7 && is_shift (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_shft (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_ctrl (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 6 && is_modx (accelerator))
+	    {
+	      static const guint mod_vals[] = {
+		EGG_VIRTUAL_ALT_MASK, EGG_VIRTUAL_MOD2_MASK, EGG_VIRTUAL_MOD3_MASK,
+		EGG_VIRTUAL_MOD4_MASK, EGG_VIRTUAL_MOD5_MASK
+	      };
+
+	      len -= 6;
+	      accelerator += 4;
+	      mods |= mod_vals[*accelerator - '1'];
+	      accelerator += 2;
+	    }
+	  else if (len >= 5 && is_ctl (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 5 && is_alt (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_ALT_MASK;
+	    }
+          else if (len >= 6 && is_meta (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_META_MASK;
+	    }
+          else if (len >= 7 && is_hyper (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_HYPER_MASK;
+	    }
+          else if (len >= 7 && is_super (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SUPER_MASK;
+	    }
+	  else
+	    {
+	      gchar last_ch;
+
+	      last_ch = *accelerator;
+	      while (last_ch && last_ch != '>')
+		{
+		  last_ch = *accelerator;
+		  accelerator += 1;
+		  len -= 1;
+		}
+	    }
+	}
+      else
+	{
+          keyval = gdk_keyval_from_name (accelerator);
+
+          if (keyval == 0)
+            bad_keyval = TRUE;
+
+          accelerator += len;
+          len -= len;
+	}
+    }
+
+  if (accelerator_key)
+    *accelerator_key = gdk_keyval_to_lower (keyval);
+  if (accelerator_mods)
+    *accelerator_mods = mods;
+
+  return !bad_keyval;
+}
+
+void
+egg_keymap_resolve_virtual_modifiers (GdkKeymap              *keymap,
+                                      EggVirtualModifierType  virtual_mods,
+                                      GdkModifierType        *concrete_mods)
+{
+  GdkModifierType concrete;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (concrete_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  concrete = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if (modmap->mapping[i] & virtual_mods)
+        concrete |= (1 << i);
+
+      ++i;
+    }
+
+  *concrete_mods = concrete;
+}
+
+void
+egg_keymap_virtualize_modifiers (GdkKeymap              *keymap,
+                                 GdkModifierType         concrete_mods,
+                                 EggVirtualModifierType *virtual_mods)
+{
+  GdkModifierType virtual;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (virtual_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  virtual = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if ((1 << i) & concrete_mods)
+        {
+          EggVirtualModifierType cleaned;
+
+          cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK |
+                                           EGG_VIRTUAL_MOD3_MASK |
+                                           EGG_VIRTUAL_MOD4_MASK |
+                                           EGG_VIRTUAL_MOD5_MASK);
+
+          if (cleaned != 0)
+            {
+              virtual |= cleaned;
+            }
+          else
+            {
+              /* Rather than dropping mod2->mod5 if not bound,
+               * go ahead and use the concrete names
+               */
+              virtual |= modmap->mapping[i];
+            }
+        }
+
+      ++i;
+    }
+
+  *virtual_mods = virtual;
+}
+
+static void
+reload_modmap (GdkKeymap *keymap,
+               EggModmap *modmap)
+{
+  XModifierKeymap *xmodmap;
+  int map_size;
+  int i;
+
+  /* FIXME multihead */
+  xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ());
+
+  memset (modmap->mapping, 0, sizeof (modmap->mapping));
+
+  /* there are 8 modifiers, and the first 3 are shift, shift lock,
+   * and control
+   */
+  map_size = 8 * xmodmap->max_keypermod;
+  i = 3 * xmodmap->max_keypermod;
+  while (i < map_size)
+    {
+      /* get the key code at this point in the map,
+       * see if its keysym is one we're interested in
+       */
+      int keycode = xmodmap->modifiermap[i];
+      GdkKeymapKey *keys;
+      guint *keyvals;
+      int n_entries;
+      int j;
+      EggVirtualModifierType mask;
+
+      keys = NULL;
+      keyvals = NULL;
+      n_entries = 0;
+
+      gdk_keymap_get_entries_for_keycode (keymap,
+                                          keycode,
+                                          &keys, &keyvals, &n_entries);
+
+      mask = 0;
+      j = 0;
+      while (j < n_entries)
+        {
+          if (keyvals[j] == GDK_KEY_Num_Lock)
+            mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Scroll_Lock)
+            mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Meta_L ||
+                   keyvals[j] == GDK_KEY_Meta_R)
+            mask |= EGG_VIRTUAL_META_MASK;
+          else if (keyvals[j] == GDK_KEY_Hyper_L ||
+                   keyvals[j] == GDK_KEY_Hyper_R)
+            mask |= EGG_VIRTUAL_HYPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Super_L ||
+                   keyvals[j] == GDK_KEY_Super_R)
+            mask |= EGG_VIRTUAL_SUPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Mode_switch)
+            mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
+
+          ++j;
+        }
+
+      /* Mod1Mask is 1 << 3 for example, i.e. the
+       * fourth modifier, i / keyspermod is the modifier
+       * index
+       */
+      modmap->mapping[i/xmodmap->max_keypermod] |= mask;
+
+      g_free (keyvals);
+      g_free (keys);
+
+      ++i;
+    }
+
+  /* Add in the not-really-virtual fixed entries */
+  modmap->mapping[EGG_MODMAP_ENTRY_SHIFT] |= EGG_VIRTUAL_SHIFT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_CONTROL] |= EGG_VIRTUAL_CONTROL_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_LOCK] |= EGG_VIRTUAL_LOCK_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD1] |= EGG_VIRTUAL_ALT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD2] |= EGG_VIRTUAL_MOD2_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK;
+
+  XFreeModifiermap (xmodmap);
+}
+
+const EggModmap*
+egg_keymap_get_modmap (GdkKeymap *keymap)
+{
+  EggModmap *modmap;
+
+  /* This is all a hack, much simpler when we can just
+   * modify GDK directly.
+   */
+
+  modmap = g_object_get_data (G_OBJECT (keymap),
+                              "egg-modmap");
+
+  if (modmap == NULL)
+    {
+      modmap = g_new0 (EggModmap, 1);
+
+      /* FIXME modify keymap change events with an event filter
+       * and force a reload if we get one
+       */
+
+      reload_modmap (keymap, modmap);
+
+      g_object_set_data_full (G_OBJECT (keymap),
+                              "egg-modmap",
+                              modmap,
+                              g_free);
+    }
+
+  g_assert (modmap != NULL);
+
+  return modmap;
+}
+
+
+
+
+ + + diff --git a/2021-04-24-225231-0061-cppcheck@9971c97b5889_master/index.html b/2021-04-24-225231-0061-cppcheck@9971c97b5889_master/index.html new file mode 100644 index 0000000..fee3cf9 --- /dev/null +++ b/2021-04-24-225231-0061-cppcheck@9971c97b5889_master/index.html @@ -0,0 +1,117 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+ + + + + + + +
LineIdCWESeverityMessage
0missingIncludeSysteminformationCppcheck cannot find all the include files (use --check-config for details)
src/eggaccelerators.c
321duplicateExpression398styleSame expression on both sides of '-='.
+
+
+ + + diff --git a/2021-04-24-225231-0061-cppcheck@9971c97b5889_master/stats.html b/2021-04-24-225231-0061-cppcheck@9971c97b5889_master/stats.html new file mode 100644 index 0000000..68c7d7b --- /dev/null +++ b/2021-04-24-225231-0061-cppcheck@9971c97b5889_master/stats.html @@ -0,0 +1,105 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+

Top 10 files for style severity, total findings: 1
+   1  src/eggaccelerators.c
+

+ +
+
+ + + diff --git a/2021-04-24-225231-0061-cppcheck@9971c97b5889_master/style.css b/2021-04-24-225231-0061-cppcheck@9971c97b5889_master/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-04-24-225231-0061-cppcheck@9971c97b5889_master/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-05-30-124245-2675-cppcheck@59a81f1e8886_master/0.html b/2021-05-30-124245-2675-cppcheck@59a81f1e8886_master/0.html new file mode 100644 index 0000000..8b23069 --- /dev/null +++ b/2021-05-30-124245-2675-cppcheck@59a81f1e8886_master/0.html @@ -0,0 +1,1229 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
/* eggaccelerators.c
+ * Copyright (C) 2002  Red Hat, Inc.; Copyright 1998, 2001 Tim Janik
+ * Developed by Havoc Pennington, Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+
+#include "eggaccelerators.h"
+
+#include <string.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
+
+enum
+{
+  EGG_MODMAP_ENTRY_SHIFT   = 0,
+  EGG_MODMAP_ENTRY_LOCK    = 1,
+  EGG_MODMAP_ENTRY_CONTROL = 2,
+  EGG_MODMAP_ENTRY_MOD1    = 3,
+  EGG_MODMAP_ENTRY_MOD2    = 4,
+  EGG_MODMAP_ENTRY_MOD3    = 5,
+  EGG_MODMAP_ENTRY_MOD4    = 6,
+  EGG_MODMAP_ENTRY_MOD5    = 7,
+  EGG_MODMAP_ENTRY_LAST    = 8
+};
+
+#define MODMAP_ENTRY_TO_MODIFIER(x) (1 << (x))
+
+typedef struct
+{
+  EggVirtualModifierType mapping[EGG_MODMAP_ENTRY_LAST];
+
+} EggModmap;
+
+const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap);
+
+static inline gboolean
+is_alt (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'a' || string[1] == 'A') &&
+	  (string[2] == 'l' || string[2] == 'L') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_ctl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_modx (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'd' || string[3] == 'D') &&
+	  (string[4] >= '1' && string[4] <= '5') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_ctrl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'r' || string[3] == 'R') &&
+	  (string[4] == 'l' || string[4] == 'L') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shft (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'f' || string[3] == 'F') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shift (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'i' || string[3] == 'I') &&
+	  (string[4] == 'f' || string[4] == 'F') &&
+	  (string[5] == 't' || string[5] == 'T') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_control (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'n' || string[3] == 'N') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == 'o' || string[6] == 'O') &&
+	  (string[7] == 'l' || string[7] == 'L') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_release (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'r' || string[1] == 'R') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'a' || string[5] == 'A') &&
+	  (string[6] == 's' || string[6] == 'S') &&
+	  (string[7] == 'e' || string[7] == 'E') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_meta (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == 'a' || string[4] == 'A') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_super (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'u' || string[2] == 'U') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_hyper (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'h' || string[1] == 'H') &&
+	  (string[2] == 'y' || string[2] == 'Y') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+/**
+ * egg_accelerator_parse_virtual:
+ * @accelerator:      string representing an accelerator
+ * @accelerator_key:  return location for accelerator keyval
+ * @accelerator_mods: return location for accelerator modifier mask
+ *
+ * Parses a string representing a virtual accelerator. The format
+ * looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1" or
+ * "&lt;Release&gt;z" (the last one is for key release).  The parser
+ * is fairly liberal and allows lower or upper case, and also
+ * abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;".
+ *
+ * If the parse fails, @accelerator_key and @accelerator_mods will
+ * be set to 0 (zero) and %FALSE will be returned. If the string contains
+ * only modifiers, @accelerator_key will be set to 0 but %TRUE will be
+ * returned.
+ *
+ * The virtual vs. concrete accelerator distinction is a relic of
+ * how the X Window System works; there are modifiers Mod2-Mod5 that
+ * can represent various keyboard keys (numlock, meta, hyper, etc.),
+ * the virtual modifier represents the keyboard key, the concrete
+ * modifier the actual Mod2-Mod5 bits in the key press event.
+ *
+ * Returns: %TRUE on success.
+ */
+gboolean
+egg_accelerator_parse_virtual (const gchar            *accelerator,
+                               guint                  *accelerator_key,
+                               EggVirtualModifierType *accelerator_mods)
+{
+  guint keyval;
+  GdkModifierType mods;
+  gint len;
+  gboolean bad_keyval;
+
+  if (accelerator_key)
+    *accelerator_key = 0;
+  if (accelerator_mods)
+    *accelerator_mods = 0;
+
+  g_return_val_if_fail (accelerator != NULL, FALSE);
+
+  bad_keyval = FALSE;
+
+  keyval = 0;
+  mods = 0;
+  len = strlen (accelerator);
+  while (len)
+    {
+      if (*accelerator == '<')
+	{
+	  if (len >= 9 && is_release (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_RELEASE_MASK;
+	    }
+	  else if (len >= 9 && is_control (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 7 && is_shift (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_shft (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_ctrl (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 6 && is_modx (accelerator))
+	    {
+	      static const guint mod_vals[] = {
+		EGG_VIRTUAL_ALT_MASK, EGG_VIRTUAL_MOD2_MASK, EGG_VIRTUAL_MOD3_MASK,
+		EGG_VIRTUAL_MOD4_MASK, EGG_VIRTUAL_MOD5_MASK
+	      };
+
+	      len -= 6;
+	      accelerator += 4;
+	      mods |= mod_vals[*accelerator - '1'];
+	      accelerator += 2;
+	    }
+	  else if (len >= 5 && is_ctl (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 5 && is_alt (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_ALT_MASK;
+	    }
+          else if (len >= 6 && is_meta (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_META_MASK;
+	    }
+          else if (len >= 7 && is_hyper (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_HYPER_MASK;
+	    }
+          else if (len >= 7 && is_super (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SUPER_MASK;
+	    }
+	  else
+	    {
+	      gchar last_ch;
+
+	      last_ch = *accelerator;
+	      while (last_ch && last_ch != '>')
+		{
+		  last_ch = *accelerator;
+		  accelerator += 1;
+		  len -= 1;
+		}
+	    }
+	}
+      else
+	{
+          keyval = gdk_keyval_from_name (accelerator);
+
+          if (keyval == 0)
+            bad_keyval = TRUE;
+
+          accelerator += len;
+          len -= len;
+	}
+    }
+
+  if (accelerator_key)
+    *accelerator_key = gdk_keyval_to_lower (keyval);
+  if (accelerator_mods)
+    *accelerator_mods = mods;
+
+  return !bad_keyval;
+}
+
+void
+egg_keymap_resolve_virtual_modifiers (GdkKeymap              *keymap,
+                                      EggVirtualModifierType  virtual_mods,
+                                      GdkModifierType        *concrete_mods)
+{
+  GdkModifierType concrete;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (concrete_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  concrete = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if (modmap->mapping[i] & virtual_mods)
+        concrete |= (1 << i);
+
+      ++i;
+    }
+
+  *concrete_mods = concrete;
+}
+
+void
+egg_keymap_virtualize_modifiers (GdkKeymap              *keymap,
+                                 GdkModifierType         concrete_mods,
+                                 EggVirtualModifierType *virtual_mods)
+{
+  GdkModifierType virtual;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (virtual_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  virtual = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if ((1 << i) & concrete_mods)
+        {
+          EggVirtualModifierType cleaned;
+
+          cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK |
+                                           EGG_VIRTUAL_MOD3_MASK |
+                                           EGG_VIRTUAL_MOD4_MASK |
+                                           EGG_VIRTUAL_MOD5_MASK);
+
+          if (cleaned != 0)
+            {
+              virtual |= cleaned;
+            }
+          else
+            {
+              /* Rather than dropping mod2->mod5 if not bound,
+               * go ahead and use the concrete names
+               */
+              virtual |= modmap->mapping[i];
+            }
+        }
+
+      ++i;
+    }
+
+  *virtual_mods = virtual;
+}
+
+static void
+reload_modmap (GdkKeymap *keymap,
+               EggModmap *modmap)
+{
+  XModifierKeymap *xmodmap;
+  int map_size;
+  int i;
+
+  /* FIXME multihead */
+  xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ());
+
+  memset (modmap->mapping, 0, sizeof (modmap->mapping));
+
+  /* there are 8 modifiers, and the first 3 are shift, shift lock,
+   * and control
+   */
+  map_size = 8 * xmodmap->max_keypermod;
+  i = 3 * xmodmap->max_keypermod;
+  while (i < map_size)
+    {
+      /* get the key code at this point in the map,
+       * see if its keysym is one we're interested in
+       */
+      int keycode = xmodmap->modifiermap[i];
+      GdkKeymapKey *keys;
+      guint *keyvals;
+      int n_entries;
+      int j;
+      EggVirtualModifierType mask;
+
+      keys = NULL;
+      keyvals = NULL;
+      n_entries = 0;
+
+      gdk_keymap_get_entries_for_keycode (keymap,
+                                          keycode,
+                                          &keys, &keyvals, &n_entries);
+
+      mask = 0;
+      j = 0;
+      while (j < n_entries)
+        {
+          if (keyvals[j] == GDK_KEY_Num_Lock)
+            mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Scroll_Lock)
+            mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Meta_L ||
+                   keyvals[j] == GDK_KEY_Meta_R)
+            mask |= EGG_VIRTUAL_META_MASK;
+          else if (keyvals[j] == GDK_KEY_Hyper_L ||
+                   keyvals[j] == GDK_KEY_Hyper_R)
+            mask |= EGG_VIRTUAL_HYPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Super_L ||
+                   keyvals[j] == GDK_KEY_Super_R)
+            mask |= EGG_VIRTUAL_SUPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Mode_switch)
+            mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
+
+          ++j;
+        }
+
+      /* Mod1Mask is 1 << 3 for example, i.e. the
+       * fourth modifier, i / keyspermod is the modifier
+       * index
+       */
+      modmap->mapping[i/xmodmap->max_keypermod] |= mask;
+
+      g_free (keyvals);
+      g_free (keys);
+
+      ++i;
+    }
+
+  /* Add in the not-really-virtual fixed entries */
+  modmap->mapping[EGG_MODMAP_ENTRY_SHIFT] |= EGG_VIRTUAL_SHIFT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_CONTROL] |= EGG_VIRTUAL_CONTROL_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_LOCK] |= EGG_VIRTUAL_LOCK_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD1] |= EGG_VIRTUAL_ALT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD2] |= EGG_VIRTUAL_MOD2_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK;
+
+  XFreeModifiermap (xmodmap);
+}
+
+const EggModmap*
+egg_keymap_get_modmap (GdkKeymap *keymap)
+{
+  EggModmap *modmap;
+
+  /* This is all a hack, much simpler when we can just
+   * modify GDK directly.
+   */
+
+  modmap = g_object_get_data (G_OBJECT (keymap),
+                              "egg-modmap");
+
+  if (modmap == NULL)
+    {
+      modmap = g_new0 (EggModmap, 1);
+
+      /* FIXME modify keymap change events with an event filter
+       * and force a reload if we get one
+       */
+
+      reload_modmap (keymap, modmap);
+
+      g_object_set_data_full (G_OBJECT (keymap),
+                              "egg-modmap",
+                              modmap,
+                              g_free);
+    }
+
+  g_assert (modmap != NULL);
+
+  return modmap;
+}
+
+
+
+
+ + + diff --git a/2021-05-30-124245-2675-cppcheck@59a81f1e8886_master/index.html b/2021-05-30-124245-2675-cppcheck@59a81f1e8886_master/index.html new file mode 100644 index 0000000..fee3cf9 --- /dev/null +++ b/2021-05-30-124245-2675-cppcheck@59a81f1e8886_master/index.html @@ -0,0 +1,117 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+ + + + + + + +
LineIdCWESeverityMessage
0missingIncludeSysteminformationCppcheck cannot find all the include files (use --check-config for details)
src/eggaccelerators.c
321duplicateExpression398styleSame expression on both sides of '-='.
+
+
+ + + diff --git a/2021-05-30-124245-2675-cppcheck@59a81f1e8886_master/stats.html b/2021-05-30-124245-2675-cppcheck@59a81f1e8886_master/stats.html new file mode 100644 index 0000000..68c7d7b --- /dev/null +++ b/2021-05-30-124245-2675-cppcheck@59a81f1e8886_master/stats.html @@ -0,0 +1,105 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+

Top 10 files for style severity, total findings: 1
+   1  src/eggaccelerators.c
+

+ +
+
+ + + diff --git a/2021-05-30-124245-2675-cppcheck@59a81f1e8886_master/style.css b/2021-05-30-124245-2675-cppcheck@59a81f1e8886_master/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-05-30-124245-2675-cppcheck@59a81f1e8886_master/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-05-30-124445-8034-cppcheck@dfc13f9fbb3a_secondary-activate/0.html b/2021-05-30-124445-8034-cppcheck@dfc13f9fbb3a_secondary-activate/0.html new file mode 100644 index 0000000..8b23069 --- /dev/null +++ b/2021-05-30-124445-8034-cppcheck@dfc13f9fbb3a_secondary-activate/0.html @@ -0,0 +1,1229 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
/* eggaccelerators.c
+ * Copyright (C) 2002  Red Hat, Inc.; Copyright 1998, 2001 Tim Janik
+ * Developed by Havoc Pennington, Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+
+#include "eggaccelerators.h"
+
+#include <string.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
+
+enum
+{
+  EGG_MODMAP_ENTRY_SHIFT   = 0,
+  EGG_MODMAP_ENTRY_LOCK    = 1,
+  EGG_MODMAP_ENTRY_CONTROL = 2,
+  EGG_MODMAP_ENTRY_MOD1    = 3,
+  EGG_MODMAP_ENTRY_MOD2    = 4,
+  EGG_MODMAP_ENTRY_MOD3    = 5,
+  EGG_MODMAP_ENTRY_MOD4    = 6,
+  EGG_MODMAP_ENTRY_MOD5    = 7,
+  EGG_MODMAP_ENTRY_LAST    = 8
+};
+
+#define MODMAP_ENTRY_TO_MODIFIER(x) (1 << (x))
+
+typedef struct
+{
+  EggVirtualModifierType mapping[EGG_MODMAP_ENTRY_LAST];
+
+} EggModmap;
+
+const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap);
+
+static inline gboolean
+is_alt (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'a' || string[1] == 'A') &&
+	  (string[2] == 'l' || string[2] == 'L') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_ctl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_modx (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'd' || string[3] == 'D') &&
+	  (string[4] >= '1' && string[4] <= '5') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_ctrl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'r' || string[3] == 'R') &&
+	  (string[4] == 'l' || string[4] == 'L') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shft (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'f' || string[3] == 'F') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shift (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'i' || string[3] == 'I') &&
+	  (string[4] == 'f' || string[4] == 'F') &&
+	  (string[5] == 't' || string[5] == 'T') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_control (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'n' || string[3] == 'N') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == 'o' || string[6] == 'O') &&
+	  (string[7] == 'l' || string[7] == 'L') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_release (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'r' || string[1] == 'R') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'a' || string[5] == 'A') &&
+	  (string[6] == 's' || string[6] == 'S') &&
+	  (string[7] == 'e' || string[7] == 'E') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_meta (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == 'a' || string[4] == 'A') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_super (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'u' || string[2] == 'U') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_hyper (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'h' || string[1] == 'H') &&
+	  (string[2] == 'y' || string[2] == 'Y') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+/**
+ * egg_accelerator_parse_virtual:
+ * @accelerator:      string representing an accelerator
+ * @accelerator_key:  return location for accelerator keyval
+ * @accelerator_mods: return location for accelerator modifier mask
+ *
+ * Parses a string representing a virtual accelerator. The format
+ * looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1" or
+ * "&lt;Release&gt;z" (the last one is for key release).  The parser
+ * is fairly liberal and allows lower or upper case, and also
+ * abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;".
+ *
+ * If the parse fails, @accelerator_key and @accelerator_mods will
+ * be set to 0 (zero) and %FALSE will be returned. If the string contains
+ * only modifiers, @accelerator_key will be set to 0 but %TRUE will be
+ * returned.
+ *
+ * The virtual vs. concrete accelerator distinction is a relic of
+ * how the X Window System works; there are modifiers Mod2-Mod5 that
+ * can represent various keyboard keys (numlock, meta, hyper, etc.),
+ * the virtual modifier represents the keyboard key, the concrete
+ * modifier the actual Mod2-Mod5 bits in the key press event.
+ *
+ * Returns: %TRUE on success.
+ */
+gboolean
+egg_accelerator_parse_virtual (const gchar            *accelerator,
+                               guint                  *accelerator_key,
+                               EggVirtualModifierType *accelerator_mods)
+{
+  guint keyval;
+  GdkModifierType mods;
+  gint len;
+  gboolean bad_keyval;
+
+  if (accelerator_key)
+    *accelerator_key = 0;
+  if (accelerator_mods)
+    *accelerator_mods = 0;
+
+  g_return_val_if_fail (accelerator != NULL, FALSE);
+
+  bad_keyval = FALSE;
+
+  keyval = 0;
+  mods = 0;
+  len = strlen (accelerator);
+  while (len)
+    {
+      if (*accelerator == '<')
+	{
+	  if (len >= 9 && is_release (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_RELEASE_MASK;
+	    }
+	  else if (len >= 9 && is_control (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 7 && is_shift (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_shft (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_ctrl (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 6 && is_modx (accelerator))
+	    {
+	      static const guint mod_vals[] = {
+		EGG_VIRTUAL_ALT_MASK, EGG_VIRTUAL_MOD2_MASK, EGG_VIRTUAL_MOD3_MASK,
+		EGG_VIRTUAL_MOD4_MASK, EGG_VIRTUAL_MOD5_MASK
+	      };
+
+	      len -= 6;
+	      accelerator += 4;
+	      mods |= mod_vals[*accelerator - '1'];
+	      accelerator += 2;
+	    }
+	  else if (len >= 5 && is_ctl (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 5 && is_alt (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_ALT_MASK;
+	    }
+          else if (len >= 6 && is_meta (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_META_MASK;
+	    }
+          else if (len >= 7 && is_hyper (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_HYPER_MASK;
+	    }
+          else if (len >= 7 && is_super (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SUPER_MASK;
+	    }
+	  else
+	    {
+	      gchar last_ch;
+
+	      last_ch = *accelerator;
+	      while (last_ch && last_ch != '>')
+		{
+		  last_ch = *accelerator;
+		  accelerator += 1;
+		  len -= 1;
+		}
+	    }
+	}
+      else
+	{
+          keyval = gdk_keyval_from_name (accelerator);
+
+          if (keyval == 0)
+            bad_keyval = TRUE;
+
+          accelerator += len;
+          len -= len;
+	}
+    }
+
+  if (accelerator_key)
+    *accelerator_key = gdk_keyval_to_lower (keyval);
+  if (accelerator_mods)
+    *accelerator_mods = mods;
+
+  return !bad_keyval;
+}
+
+void
+egg_keymap_resolve_virtual_modifiers (GdkKeymap              *keymap,
+                                      EggVirtualModifierType  virtual_mods,
+                                      GdkModifierType        *concrete_mods)
+{
+  GdkModifierType concrete;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (concrete_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  concrete = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if (modmap->mapping[i] & virtual_mods)
+        concrete |= (1 << i);
+
+      ++i;
+    }
+
+  *concrete_mods = concrete;
+}
+
+void
+egg_keymap_virtualize_modifiers (GdkKeymap              *keymap,
+                                 GdkModifierType         concrete_mods,
+                                 EggVirtualModifierType *virtual_mods)
+{
+  GdkModifierType virtual;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (virtual_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  virtual = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if ((1 << i) & concrete_mods)
+        {
+          EggVirtualModifierType cleaned;
+
+          cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK |
+                                           EGG_VIRTUAL_MOD3_MASK |
+                                           EGG_VIRTUAL_MOD4_MASK |
+                                           EGG_VIRTUAL_MOD5_MASK);
+
+          if (cleaned != 0)
+            {
+              virtual |= cleaned;
+            }
+          else
+            {
+              /* Rather than dropping mod2->mod5 if not bound,
+               * go ahead and use the concrete names
+               */
+              virtual |= modmap->mapping[i];
+            }
+        }
+
+      ++i;
+    }
+
+  *virtual_mods = virtual;
+}
+
+static void
+reload_modmap (GdkKeymap *keymap,
+               EggModmap *modmap)
+{
+  XModifierKeymap *xmodmap;
+  int map_size;
+  int i;
+
+  /* FIXME multihead */
+  xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ());
+
+  memset (modmap->mapping, 0, sizeof (modmap->mapping));
+
+  /* there are 8 modifiers, and the first 3 are shift, shift lock,
+   * and control
+   */
+  map_size = 8 * xmodmap->max_keypermod;
+  i = 3 * xmodmap->max_keypermod;
+  while (i < map_size)
+    {
+      /* get the key code at this point in the map,
+       * see if its keysym is one we're interested in
+       */
+      int keycode = xmodmap->modifiermap[i];
+      GdkKeymapKey *keys;
+      guint *keyvals;
+      int n_entries;
+      int j;
+      EggVirtualModifierType mask;
+
+      keys = NULL;
+      keyvals = NULL;
+      n_entries = 0;
+
+      gdk_keymap_get_entries_for_keycode (keymap,
+                                          keycode,
+                                          &keys, &keyvals, &n_entries);
+
+      mask = 0;
+      j = 0;
+      while (j < n_entries)
+        {
+          if (keyvals[j] == GDK_KEY_Num_Lock)
+            mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Scroll_Lock)
+            mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Meta_L ||
+                   keyvals[j] == GDK_KEY_Meta_R)
+            mask |= EGG_VIRTUAL_META_MASK;
+          else if (keyvals[j] == GDK_KEY_Hyper_L ||
+                   keyvals[j] == GDK_KEY_Hyper_R)
+            mask |= EGG_VIRTUAL_HYPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Super_L ||
+                   keyvals[j] == GDK_KEY_Super_R)
+            mask |= EGG_VIRTUAL_SUPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Mode_switch)
+            mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
+
+          ++j;
+        }
+
+      /* Mod1Mask is 1 << 3 for example, i.e. the
+       * fourth modifier, i / keyspermod is the modifier
+       * index
+       */
+      modmap->mapping[i/xmodmap->max_keypermod] |= mask;
+
+      g_free (keyvals);
+      g_free (keys);
+
+      ++i;
+    }
+
+  /* Add in the not-really-virtual fixed entries */
+  modmap->mapping[EGG_MODMAP_ENTRY_SHIFT] |= EGG_VIRTUAL_SHIFT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_CONTROL] |= EGG_VIRTUAL_CONTROL_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_LOCK] |= EGG_VIRTUAL_LOCK_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD1] |= EGG_VIRTUAL_ALT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD2] |= EGG_VIRTUAL_MOD2_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK;
+
+  XFreeModifiermap (xmodmap);
+}
+
+const EggModmap*
+egg_keymap_get_modmap (GdkKeymap *keymap)
+{
+  EggModmap *modmap;
+
+  /* This is all a hack, much simpler when we can just
+   * modify GDK directly.
+   */
+
+  modmap = g_object_get_data (G_OBJECT (keymap),
+                              "egg-modmap");
+
+  if (modmap == NULL)
+    {
+      modmap = g_new0 (EggModmap, 1);
+
+      /* FIXME modify keymap change events with an event filter
+       * and force a reload if we get one
+       */
+
+      reload_modmap (keymap, modmap);
+
+      g_object_set_data_full (G_OBJECT (keymap),
+                              "egg-modmap",
+                              modmap,
+                              g_free);
+    }
+
+  g_assert (modmap != NULL);
+
+  return modmap;
+}
+
+
+
+
+ + + diff --git a/2021-05-30-124445-8034-cppcheck@dfc13f9fbb3a_secondary-activate/index.html b/2021-05-30-124445-8034-cppcheck@dfc13f9fbb3a_secondary-activate/index.html new file mode 100644 index 0000000..fee3cf9 --- /dev/null +++ b/2021-05-30-124445-8034-cppcheck@dfc13f9fbb3a_secondary-activate/index.html @@ -0,0 +1,117 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+ + + + + + + +
LineIdCWESeverityMessage
0missingIncludeSysteminformationCppcheck cannot find all the include files (use --check-config for details)
src/eggaccelerators.c
321duplicateExpression398styleSame expression on both sides of '-='.
+
+
+ + + diff --git a/2021-05-30-124445-8034-cppcheck@dfc13f9fbb3a_secondary-activate/stats.html b/2021-05-30-124445-8034-cppcheck@dfc13f9fbb3a_secondary-activate/stats.html new file mode 100644 index 0000000..68c7d7b --- /dev/null +++ b/2021-05-30-124445-8034-cppcheck@dfc13f9fbb3a_secondary-activate/stats.html @@ -0,0 +1,105 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+

Top 10 files for style severity, total findings: 1
+   1  src/eggaccelerators.c
+

+ +
+
+ + + diff --git a/2021-05-30-124445-8034-cppcheck@dfc13f9fbb3a_secondary-activate/style.css b/2021-05-30-124445-8034-cppcheck@dfc13f9fbb3a_secondary-activate/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-05-30-124445-8034-cppcheck@dfc13f9fbb3a_secondary-activate/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-08-08-214944-2244-cppcheck@7abc48e094fa_master/0.html b/2021-08-08-214944-2244-cppcheck@7abc48e094fa_master/0.html new file mode 100644 index 0000000..4ae0bb0 --- /dev/null +++ b/2021-08-08-214944-2244-cppcheck@7abc48e094fa_master/0.html @@ -0,0 +1,1229 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
/* eggaccelerators.c
+ * Copyright (C) 2002  Red Hat, Inc.; Copyright 1998, 2001 Tim Janik
+ * Developed by Havoc Pennington, Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+
+#include "eggaccelerators.h"
+
+#include <string.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
+
+enum
+{
+  EGG_MODMAP_ENTRY_SHIFT   = 0,
+  EGG_MODMAP_ENTRY_LOCK    = 1,
+  EGG_MODMAP_ENTRY_CONTROL = 2,
+  EGG_MODMAP_ENTRY_MOD1    = 3,
+  EGG_MODMAP_ENTRY_MOD2    = 4,
+  EGG_MODMAP_ENTRY_MOD3    = 5,
+  EGG_MODMAP_ENTRY_MOD4    = 6,
+  EGG_MODMAP_ENTRY_MOD5    = 7,
+  EGG_MODMAP_ENTRY_LAST    = 8
+};
+
+#define MODMAP_ENTRY_TO_MODIFIER(x) (1 << (x))
+
+typedef struct
+{
+  EggVirtualModifierType mapping[EGG_MODMAP_ENTRY_LAST];
+
+} EggModmap;
+
+const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap);
+
+static inline gboolean
+is_alt (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'a' || string[1] == 'A') &&
+	  (string[2] == 'l' || string[2] == 'L') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_ctl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_modx (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'd' || string[3] == 'D') &&
+	  (string[4] >= '1' && string[4] <= '5') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_ctrl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'r' || string[3] == 'R') &&
+	  (string[4] == 'l' || string[4] == 'L') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shft (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'f' || string[3] == 'F') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shift (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'i' || string[3] == 'I') &&
+	  (string[4] == 'f' || string[4] == 'F') &&
+	  (string[5] == 't' || string[5] == 'T') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_control (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'n' || string[3] == 'N') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == 'o' || string[6] == 'O') &&
+	  (string[7] == 'l' || string[7] == 'L') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_release (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'r' || string[1] == 'R') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'a' || string[5] == 'A') &&
+	  (string[6] == 's' || string[6] == 'S') &&
+	  (string[7] == 'e' || string[7] == 'E') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_meta (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == 'a' || string[4] == 'A') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_super (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'u' || string[2] == 'U') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_hyper (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'h' || string[1] == 'H') &&
+	  (string[2] == 'y' || string[2] == 'Y') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+/**
+ * egg_accelerator_parse_virtual:
+ * @accelerator:      string representing an accelerator
+ * @accelerator_key:  return location for accelerator keyval
+ * @accelerator_mods: return location for accelerator modifier mask
+ *
+ * Parses a string representing a virtual accelerator. The format
+ * looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1" or
+ * "&lt;Release&gt;z" (the last one is for key release).  The parser
+ * is fairly liberal and allows lower or upper case, and also
+ * abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;".
+ *
+ * If the parse fails, @accelerator_key and @accelerator_mods will
+ * be set to 0 (zero) and %FALSE will be returned. If the string contains
+ * only modifiers, @accelerator_key will be set to 0 but %TRUE will be
+ * returned.
+ *
+ * The virtual vs. concrete accelerator distinction is a relic of
+ * how the X Window System works; there are modifiers Mod2-Mod5 that
+ * can represent various keyboard keys (numlock, meta, hyper, etc.),
+ * the virtual modifier represents the keyboard key, the concrete
+ * modifier the actual Mod2-Mod5 bits in the key press event.
+ *
+ * Returns: %TRUE on success.
+ */
+gboolean
+egg_accelerator_parse_virtual (const gchar            *accelerator,
+                               guint                  *accelerator_key,
+                               EggVirtualModifierType *accelerator_mods)
+{
+  guint keyval;
+  GdkModifierType mods;
+  gint len;
+  gboolean bad_keyval;
+
+  if (accelerator_key)
+    *accelerator_key = 0;
+  if (accelerator_mods)
+    *accelerator_mods = 0;
+
+  g_return_val_if_fail (accelerator != NULL, FALSE);
+
+  bad_keyval = FALSE;
+
+  keyval = 0;
+  mods = 0;
+  len = strlen (accelerator);
+  while (len)
+    {
+      if (*accelerator == '<')
+	{
+	  if (len >= 9 && is_release (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_RELEASE_MASK;
+	    }
+	  else if (len >= 9 && is_control (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 7 && is_shift (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_shft (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_ctrl (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 6 && is_modx (accelerator))
+	    {
+	      static const guint mod_vals[] = {
+		EGG_VIRTUAL_ALT_MASK, EGG_VIRTUAL_MOD2_MASK, EGG_VIRTUAL_MOD3_MASK,
+		EGG_VIRTUAL_MOD4_MASK, EGG_VIRTUAL_MOD5_MASK
+	      };
+
+	      len -= 6;
+	      accelerator += 4;
+	      mods |= mod_vals[*accelerator - '1'];
+	      accelerator += 2;
+	    }
+	  else if (len >= 5 && is_ctl (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 5 && is_alt (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_ALT_MASK;
+	    }
+          else if (len >= 6 && is_meta (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_META_MASK;
+	    }
+          else if (len >= 7 && is_hyper (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_HYPER_MASK;
+	    }
+          else if (len >= 7 && is_super (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SUPER_MASK;
+	    }
+	  else
+	    {
+	      gchar last_ch;
+
+	      last_ch = *accelerator;
+	      while (last_ch && last_ch != '>')
+		{
+		  last_ch = *accelerator;
+		  accelerator += 1;
+		  len -= 1;
+		}
+	    }
+	}
+      else
+	{
+          keyval = gdk_keyval_from_name (accelerator);
+
+          if (keyval == 0)
+            bad_keyval = TRUE;
+
+          accelerator += len;
+          len -= len;
+	}
+    }
+
+  if (accelerator_key)
+    *accelerator_key = gdk_keyval_to_lower (keyval);
+  if (accelerator_mods)
+    *accelerator_mods = mods;
+
+  return !bad_keyval;
+}
+
+void
+egg_keymap_resolve_virtual_modifiers (GdkKeymap              *keymap,
+                                      EggVirtualModifierType  virtual_mods,
+                                      GdkModifierType        *concrete_mods)
+{
+  GdkModifierType concrete;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (concrete_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  concrete = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if (modmap->mapping[i] & virtual_mods)
+        concrete |= (1 << i);
+
+      ++i;
+    }
+
+  *concrete_mods = concrete;
+}
+
+void
+egg_keymap_virtualize_modifiers (GdkKeymap              *keymap,
+                                 GdkModifierType         concrete_mods,
+                                 EggVirtualModifierType *virtual_mods)
+{
+  GdkModifierType virtual;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (virtual_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  virtual = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if ((1 << i) & concrete_mods)
+        {
+          EggVirtualModifierType cleaned;
+
+          cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK |
+                                           EGG_VIRTUAL_MOD3_MASK |
+                                           EGG_VIRTUAL_MOD4_MASK |
+                                           EGG_VIRTUAL_MOD5_MASK);
+
+          if (cleaned != 0)
+            {
+              virtual |= cleaned;
+            }
+          else
+            {
+              /* Rather than dropping mod2->mod5 if not bound,
+               * go ahead and use the concrete names
+               */
+              virtual |= modmap->mapping[i];
+            }
+        }
+
+      ++i;
+    }
+
+  *virtual_mods = virtual;
+}
+
+static void
+reload_modmap (GdkKeymap *keymap,
+               EggModmap *modmap)
+{
+  XModifierKeymap *xmodmap;
+  int map_size;
+  int i;
+
+  /* FIXME multihead */
+  xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ());
+
+  memset (modmap->mapping, 0, sizeof (modmap->mapping));
+
+  /* there are 8 modifiers, and the first 3 are shift, shift lock,
+   * and control
+   */
+  map_size = 8 * xmodmap->max_keypermod;
+  i = 3 * xmodmap->max_keypermod;
+  while (i < map_size)
+    {
+      /* get the key code at this point in the map,
+       * see if its keysym is one we're interested in
+       */
+      int keycode = xmodmap->modifiermap[i];
+      GdkKeymapKey *keys;
+      guint *keyvals;
+      int n_entries;
+      int j;
+      EggVirtualModifierType mask;
+
+      keys = NULL;
+      keyvals = NULL;
+      n_entries = 0;
+
+      gdk_keymap_get_entries_for_keycode (keymap,
+                                          keycode,
+                                          &keys, &keyvals, &n_entries);
+
+      mask = 0;
+      j = 0;
+      while (j < n_entries)
+        {
+          if (keyvals[j] == GDK_KEY_Num_Lock)
+            mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Scroll_Lock)
+            mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Meta_L ||
+                   keyvals[j] == GDK_KEY_Meta_R)
+            mask |= EGG_VIRTUAL_META_MASK;
+          else if (keyvals[j] == GDK_KEY_Hyper_L ||
+                   keyvals[j] == GDK_KEY_Hyper_R)
+            mask |= EGG_VIRTUAL_HYPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Super_L ||
+                   keyvals[j] == GDK_KEY_Super_R)
+            mask |= EGG_VIRTUAL_SUPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Mode_switch)
+            mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
+
+          ++j;
+        }
+
+      /* Mod1Mask is 1 << 3 for example, i.e. the
+       * fourth modifier, i / keyspermod is the modifier
+       * index
+       */
+      modmap->mapping[i/xmodmap->max_keypermod] |= mask;
+
+      g_free (keyvals);
+      g_free (keys);
+
+      ++i;
+    }
+
+  /* Add in the not-really-virtual fixed entries */
+  modmap->mapping[EGG_MODMAP_ENTRY_SHIFT] |= EGG_VIRTUAL_SHIFT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_CONTROL] |= EGG_VIRTUAL_CONTROL_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_LOCK] |= EGG_VIRTUAL_LOCK_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD1] |= EGG_VIRTUAL_ALT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD2] |= EGG_VIRTUAL_MOD2_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK;
+
+  XFreeModifiermap (xmodmap);
+}
+
+const EggModmap*
+egg_keymap_get_modmap (GdkKeymap *keymap)
+{
+  EggModmap *modmap;
+
+  /* This is all a hack, much simpler when we can just
+   * modify GDK directly.
+   */
+
+  modmap = g_object_get_data (G_OBJECT (keymap),
+                              "egg-modmap");
+
+  if (modmap == NULL)
+    {
+      modmap = g_new0 (EggModmap, 1);
+
+      /* FIXME modify keymap change events with an event filter
+       * and force a reload if we get one
+       */
+
+      reload_modmap (keymap, modmap);
+
+      g_object_set_data_full (G_OBJECT (keymap),
+                              "egg-modmap",
+                              modmap,
+                              g_free);
+    }
+
+  g_assert (modmap != NULL);
+
+  return modmap;
+}
+
+
+
+
+ + + diff --git a/2021-08-08-214944-2244-cppcheck@7abc48e094fa_master/index.html b/2021-08-08-214944-2244-cppcheck@7abc48e094fa_master/index.html new file mode 100644 index 0000000..0b0e148 --- /dev/null +++ b/2021-08-08-214944-2244-cppcheck@7abc48e094fa_master/index.html @@ -0,0 +1,117 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+ + + + + + + +
LineIdCWESeverityMessage
0missingIncludeSysteminformationCppcheck cannot find all the include files (use --check-config for details)
src/eggaccelerators.c
321duplicateExpression398styleSame expression on both sides of '-='.
+
+
+ + + diff --git a/2021-08-08-214944-2244-cppcheck@7abc48e094fa_master/stats.html b/2021-08-08-214944-2244-cppcheck@7abc48e094fa_master/stats.html new file mode 100644 index 0000000..1db1b8e --- /dev/null +++ b/2021-08-08-214944-2244-cppcheck@7abc48e094fa_master/stats.html @@ -0,0 +1,105 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+

Top 10 files for style severity, total findings: 1
+   1  src/eggaccelerators.c
+

+ +
+
+ + + diff --git a/2021-08-08-214944-2244-cppcheck@7abc48e094fa_master/style.css b/2021-08-08-214944-2244-cppcheck@7abc48e094fa_master/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-08-08-214944-2244-cppcheck@7abc48e094fa_master/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/0.html b/2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/0.html new file mode 100644 index 0000000..ff8f9d1 --- /dev/null +++ b/2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/0.html @@ -0,0 +1,2301 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
/*
+A small wrapper utility to load indicators and put them as menu items
+into the mate-panel using it's applet interface.
+
+Copyright 2009-2010 Canonical Ltd.
+
+Authors:
+    Ted Gould <ted@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+#include <string.h>
+#include <config.h>
+#include <glib/gi18n.h>
+#include <mate-panel-applet.h>
+#include <gdk/gdkkeysyms.h>
+#include <gtk/gtk.h>
+
+#if HAVE_UBUNTU_INDICATOR
+
+#define INDICATOR_SERVICE_APPMENU	"libappmenu.so"
+#define INDICATOR_SERVICE_ME		"libme.so"
+#define INDICATOR_SERVICE_DATETIME	"libdatetime.so"
+
+#define INDICATOR_SERVICE_APPMENU_NG	"com.canonical.indicator.appmenu"
+#define INDICATOR_SERVICE_ME_NG		"com.canonical.indicator.me"
+#define INDICATOR_SERVICE_DATETIME_NG	"com.canonical.indicator.datetime"
+
+#include <libindicator/indicator-object.h>
+#endif
+
+#if HAVE_AYATANA_INDICATOR
+
+#define INDICATOR_SERVICE_APPMENU	"libayatana-appmenu.so"
+#define INDICATOR_SERVICE_ME		"libayatana-me.so"
+#define INDICATOR_SERVICE_DATETIME	"libayatana-datetime.so"
+
+#define INDICATOR_SERVICE_APPMENU_NG	"org.ayatana.indicator.appmenu"
+#define INDICATOR_SERVICE_ME_NG		"org.ayatana.indicator.me"
+#define INDICATOR_SERVICE_DATETIME_NG	"org.ayatana.indicator.datetime"
+
+#include <libayatana-indicator/indicator-object.h>
+#endif
+
+/* For new style indicators */
+
+#if HAVE_UBUNTU_INDICATOR && HAVE_UBUNTU_INDICATOR_NG
+
+#include <libido/libido.h>
+#include <libindicator/indicator-ng.h>
+
+#define INDICATOR_SERVICE_DIR "/usr/share/unity/indicators"
+
+#endif
+
+#if HAVE_AYATANA_INDICATOR && HAVE_AYATANA_INDICATOR_NG
+
+#include <libayatana-ido/libayatana-ido.h>
+#include <libayatana-indicator/indicator-ng.h>
+
+#define INDICATOR_SERVICE_DIR "/usr/share/ayatana/indicators"
+
+#endif
+
+#include "tomboykeybinder.h"
+
+static gchar * indicator_order[] = {
+#if HAVE_UBUNTU_INDICATOR
+	"libapplication.so",
+	"libmessaging.so",
+	"libsoundmenu.so",
+	"libdatetime.so",
+	"libsession.so",
+#endif
+#if HAVE_AYATANA_INDICATOR
+	"libayatana-application.so",
+	"libayatana-messaging.so",
+	"libayatana-soundmenu.so",
+	"libayatana-datetime.so",
+	"libayatana-session.so",
+#endif
+	NULL
+};
+
+static GtkPackDirection packdirection;
+static MatePanelAppletOrient orient;
+static guint size;
+
+#define  MENU_DATA_INDICATOR_OBJECT  "indicator-object"
+#define  MENU_DATA_INDICATOR_ENTRY   "indicator-entry"
+
+#define  IO_DATA_ORDER_NUMBER        "indicator-order-number"
+
+static gboolean     applet_fill_cb (MatePanelApplet * applet, const gchar * iid, gpointer data);
+
+static void update_accessible_desc (IndicatorObjectEntry * entry, GtkWidget * menuitem);
+
+/*************
+ * main
+ * ***********/
+
+#ifdef INDICATOR_APPLET
+MATE_PANEL_APPLET_OUT_PROCESS_FACTORY ("IndicatorAppletFactory",
+               PANEL_TYPE_APPLET,
+               "indicator-applet",
+               applet_fill_cb, NULL);
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+MATE_PANEL_APPLET_OUT_PROCESS_FACTORY ("IndicatorAppletCompleteFactory",
+               PANEL_TYPE_APPLET,
+               "indicator-applet-complete",
+               applet_fill_cb, NULL);
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+MATE_PANEL_APPLET_OUT_PROCESS_FACTORY ("IndicatorAppletAppmenuFactory",
+               PANEL_TYPE_APPLET,
+               "indicator-applet-appmenu",
+               applet_fill_cb, NULL);
+#endif
+
+/*************
+ * log files
+ * ***********/
+#ifdef INDICATOR_APPLET
+#define LOG_FILE_NAME  "indicator-applet.log"
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+#define LOG_FILE_NAME  "indicator-applet-complete.log"
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+#define LOG_FILE_NAME  "indicator-applet-appmenu.log"
+#endif
+GOutputStream * log_file = NULL;
+
+/*****************
+ * Hotkey support
+ * **************/
+#ifdef INDICATOR_APPLET
+gchar * hotkey_keycode = "<Super>M";
+#endif
+#ifdef INDICATOR_APPLET_SESSION
+gchar * hotkey_keycode = "<Super>S";
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+gchar * hotkey_keycode = "<Super>S";
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+gchar * hotkey_keycode = "<Super>F1";
+#endif
+
+/********************
+ * Environment Names
+ * *******************/
+#ifdef INDICATOR_APPLET
+#define INDICATOR_SPECIFIC_ENV  "indicator-applet-original"
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+#define INDICATOR_SPECIFIC_ENV  "indicator-applet-complete"
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+#define INDICATOR_SPECIFIC_ENV  "indicator-applet-appmenu"
+#endif
+
+static const gchar * indicator_env[] = {
+	"indicator-applet",
+	INDICATOR_SPECIFIC_ENV,
+	NULL
+};
+
+/*************
+ * init function
+ * ***********/
+
+static gint
+name2order (const gchar * name) {
+	int i;
+
+	for (i = 0; indicator_order[i] != NULL; i++) {
+		if (g_strcmp0(name, indicator_order[i]) == 0) {
+			return i;
+		}
+	}
+
+	return -1;
+}
+
+typedef struct _incoming_position_t incoming_position_t;
+struct _incoming_position_t {
+	gint objposition;
+	gint entryposition;
+	gint menupos;
+	gboolean found;
+};
+
+/* This function helps by determining where in the menu list
+   this new entry should be placed.  It compares the objects
+   that they're on, and then the individual entries.  Each
+   is progressively more expensive. */
+static void
+place_in_menu (GtkWidget * widget, gpointer user_data)
+{
+	incoming_position_t * position = (incoming_position_t *)user_data;
+	if (position->found) {
+		/* We've already been placed, just finish the foreach */
+		return;
+	}
+
+	IndicatorObject * io = INDICATOR_OBJECT(g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_OBJECT));
+	g_assert(io != NULL);
+
+	gint objposition = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER));
+	/* We've already passed it, well, then this is where
+	   we should be be.  Stop! */
+	if (objposition > position->objposition) {
+		position->found = TRUE;
+		return;
+	}
+
+	/* The objects don't match yet, keep looking */
+	if (objposition < position->objposition) {
+		position->menupos++;
+		return;
+	}
+
+	/* The objects are the same, let's start looking at entries. */
+	IndicatorObjectEntry * entry = (IndicatorObjectEntry *)g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY);
+	gint entryposition = indicator_object_get_location(io, entry);
+
+	if (entryposition > position->entryposition) {
+		position->found = TRUE;
+		return;
+	}
+
+	if (entryposition < position->entryposition) {
+		position->menupos++;
+		return;
+	}
+
+	/* We've got the same object and the same entry.  Well,
+	   let's just put it right here then. */
+	position->found = TRUE;
+	return;
+}
+
+static void
+something_shown (GtkWidget * widget, gpointer user_data)
+{
+	GtkWidget * menuitem = GTK_WIDGET(user_data);
+	gtk_widget_show(menuitem);
+}
+
+static void
+something_hidden (GtkWidget * widget, gpointer user_data)
+{
+	GtkWidget * menuitem = GTK_WIDGET(user_data);
+	gtk_widget_hide(menuitem);
+}
+
+static void
+sensitive_cb (GObject * obj, GParamSpec * pspec, gpointer user_data)
+{
+	g_return_if_fail(GTK_IS_WIDGET(obj));
+	g_return_if_fail(GTK_IS_WIDGET(user_data));
+
+	gtk_widget_set_sensitive(GTK_WIDGET(user_data), gtk_widget_get_sensitive(GTK_WIDGET(obj)));
+	return;
+}
+
+static void
+entry_activated (GtkWidget * widget, gpointer user_data)
+{
+	g_return_if_fail(GTK_IS_WIDGET(widget));
+	gpointer pio = g_object_get_data(G_OBJECT(widget), "indicator");
+	g_return_if_fail(INDICATOR_IS_OBJECT(pio));
+	IndicatorObject * io = INDICATOR_OBJECT(pio);
+
+	return indicator_object_entry_activate(io, (IndicatorObjectEntry *)user_data, gtk_get_current_event_time());
+}
+
+static gboolean
+entry_scrolled (GtkWidget *menuitem, GdkEventScroll *event, gpointer data)
+{
+	IndicatorObject *io = g_object_get_data (G_OBJECT (menuitem), MENU_DATA_INDICATOR_OBJECT);
+	IndicatorObjectEntry *entry = g_object_get_data (G_OBJECT (menuitem), MENU_DATA_INDICATOR_ENTRY);
+
+	g_return_val_if_fail(INDICATOR_IS_OBJECT(io), FALSE);
+
+	g_signal_emit_by_name (io, "scroll", 1, event->direction);
+	g_signal_emit_by_name (io, "scroll-entry", entry, 1, event->direction);
+	g_signal_emit_by_name (io, INDICATOR_OBJECT_SIGNAL_ENTRY_SCROLLED, entry, 1, event->direction);
+
+	return FALSE;
+}
+
+static void
+accessible_desc_update_cb (GtkWidget * widget, gpointer userdata)
+{
+	gpointer data = g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY);
+
+	if (data != userdata) {
+		return;
+	}
+
+	IndicatorObjectEntry * entry = (IndicatorObjectEntry *)data;
+	update_accessible_desc(entry, widget);
+}
+
+static void
+accessible_desc_update (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menubar)
+{
+	gtk_container_foreach(GTK_CONTAINER(menubar), accessible_desc_update_cb, entry);
+	return;
+}
+
+#define PANEL_PADDING 8
+static gboolean
+entry_resized (GtkWidget *applet, guint newsize, gpointer data)
+{
+	IndicatorObject *io = (IndicatorObject *)data;
+
+	size = newsize;
+
+	/* Work on the entries */
+	GList * entries = indicator_object_get_entries(io);
+	GList * entry = NULL;
+
+	for (entry = entries; entry != NULL; entry = g_list_next(entry)) {
+		IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)entry->data;
+		if (entrydata->image != NULL) {
+			/* Resize to fit panel */
+			gtk_image_set_pixel_size (entrydata->image, size - PANEL_PADDING);
+		}
+	}
+
+	return FALSE;
+}
+
+static void
+entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menubar)
+{
+	g_debug("Signal: Entry Added");
+	gboolean something_visible = FALSE;
+	gboolean something_sensitive = FALSE;
+
+	GtkWidget * menuitem = gtk_menu_item_new();
+	GtkWidget * box = (packdirection == GTK_PACK_DIRECTION_LTR) ?
+		gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3) : gtk_box_new(GTK_ORIENTATION_VERTICAL, 3);
+
+	/* Allows indicators to receive mouse scroll event */
+	gtk_widget_add_events(GTK_WIDGET(menuitem), GDK_SCROLL_MASK);
+
+	g_object_set_data (G_OBJECT (menuitem), "indicator", io);
+	g_object_set_data (G_OBJECT (menuitem), "box", box);
+
+	g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(entry_activated), entry);
+	g_signal_connect(G_OBJECT(menuitem), "scroll-event", G_CALLBACK(entry_scrolled), entry);
+
+	if (entry->image != NULL) {
+		/* Resize to fit panel */
+		gtk_image_set_pixel_size (entry->image, size - PANEL_PADDING);
+		gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(entry->image), FALSE, FALSE, 1);
+		if (gtk_widget_get_visible(GTK_WIDGET(entry->image))) {
+			something_visible = TRUE;
+		}
+
+		if (gtk_widget_get_sensitive(GTK_WIDGET(entry->image))) {
+			something_sensitive = TRUE;
+		}
+
+		g_signal_connect(G_OBJECT(entry->image), "show", G_CALLBACK(something_shown), menuitem);
+		g_signal_connect(G_OBJECT(entry->image), "hide", G_CALLBACK(something_hidden), menuitem);
+
+		g_signal_connect(G_OBJECT(entry->image), "notify::sensitive", G_CALLBACK(sensitive_cb), menuitem);
+	}
+	if (entry->label != NULL) {
+		switch(packdirection) {
+			case GTK_PACK_DIRECTION_LTR:
+				gtk_label_set_angle(GTK_LABEL(entry->label), 0.0);
+				break;
+			case GTK_PACK_DIRECTION_TTB:
+				gtk_label_set_angle(GTK_LABEL(entry->label),
+						(orient == MATE_PANEL_APPLET_ORIENT_LEFT) ?
+						270.0 : 90.0);
+				break;
+			default:
+				break;
+		}
+		gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(entry->label), FALSE, FALSE, 1);
+
+		if (gtk_widget_get_visible(GTK_WIDGET(entry->label))) {
+			something_visible = TRUE;
+		}
+
+		if (gtk_widget_get_sensitive(GTK_WIDGET(entry->label))) {
+			something_sensitive = TRUE;
+		}
+
+		g_signal_connect(G_OBJECT(entry->label), "show", G_CALLBACK(something_shown), menuitem);
+		g_signal_connect(G_OBJECT(entry->label), "hide", G_CALLBACK(something_hidden), menuitem);
+
+		g_signal_connect(G_OBJECT(entry->label), "notify::sensitive", G_CALLBACK(sensitive_cb), menuitem);
+	}
+	gtk_container_add(GTK_CONTAINER(menuitem), box);
+	gtk_widget_show(box);
+
+	if (entry->menu != NULL) {
+		gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(entry->menu));
+	}
+
+	incoming_position_t position;
+	position.objposition = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER));
+	position.entryposition = indicator_object_get_location(io, entry);
+	position.menupos = 0;
+	position.found = FALSE;
+
+	gtk_container_foreach(GTK_CONTAINER(menubar), place_in_menu, &position);
+
+	gtk_menu_shell_insert(GTK_MENU_SHELL(menubar), menuitem, position.menupos);
+
+	if (something_visible) {
+		if (entry->accessible_desc != NULL) {
+			update_accessible_desc(entry, menuitem);
+		}
+		gtk_widget_show(menuitem);
+	}
+	gtk_widget_set_sensitive(menuitem, something_sensitive);
+
+	g_object_set_data(G_OBJECT(menuitem), MENU_DATA_INDICATOR_ENTRY,  entry);
+	g_object_set_data(G_OBJECT(menuitem), MENU_DATA_INDICATOR_OBJECT, io);
+
+	return;
+}
+
+static void
+entry_removed_cb (GtkWidget * widget, gpointer userdata)
+{
+	gpointer data = g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY);
+
+	if (data != userdata) {
+		return;
+	}
+
+	IndicatorObjectEntry * entry = (IndicatorObjectEntry *)data;
+	if (entry->label != NULL) {
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->label), G_CALLBACK(something_shown), widget);
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->label), G_CALLBACK(something_hidden), widget);
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->label), G_CALLBACK(sensitive_cb), widget);
+	}
+	if (entry->image != NULL) {
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->image), G_CALLBACK(something_shown), widget);
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->image), G_CALLBACK(something_hidden), widget);
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->image), G_CALLBACK(sensitive_cb), widget);
+	}
+
+	gtk_widget_destroy(widget);
+	return;
+}
+
+static void
+entry_removed (IndicatorObject * io G_GNUC_UNUSED, IndicatorObjectEntry * entry,
+               gpointer user_data)
+{
+	g_debug("Signal: Entry Removed");
+
+	gtk_container_foreach(GTK_CONTAINER(user_data), entry_removed_cb, entry);
+
+	return;
+}
+
+static void
+entry_moved_find_cb (GtkWidget * widget, gpointer userdata)
+{
+	gpointer * array = (gpointer *)userdata;
+	if (array[1] != NULL) {
+		return;
+	}
+
+	gpointer data = g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY);
+
+	if (data != array[0]) {
+		return;
+	}
+
+	array[1] = widget;
+	return;
+}
+
+/* Gets called when an entry for an object was moved. */
+static void
+entry_moved (IndicatorObject * io, IndicatorObjectEntry * entry,
+             gint old G_GNUC_UNUSED, gint new G_GNUC_UNUSED, gpointer user_data)
+{
+	GtkWidget * menubar = GTK_WIDGET(user_data);
+
+	gpointer array[2];
+	array[0] = entry;
+	array[1] = NULL;
+
+	gtk_container_foreach(GTK_CONTAINER(menubar), entry_moved_find_cb, array);
+	if (array[1] == NULL) {
+		g_warning("Moving an entry that isn't in our menus.");
+		return;
+	}
+
+	GtkWidget * mi = GTK_WIDGET(array[1]);
+	g_object_ref(G_OBJECT(mi));
+	gtk_container_remove(GTK_CONTAINER(menubar), mi);
+
+	incoming_position_t position;
+	position.objposition = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER));
+	position.entryposition = indicator_object_get_location(io, entry);
+	position.menupos = 0;
+	position.found = FALSE;
+
+	gtk_container_foreach(GTK_CONTAINER(menubar), place_in_menu, &position);
+
+	gtk_menu_shell_insert(GTK_MENU_SHELL(menubar), mi, position.menupos);
+	g_object_unref(G_OBJECT(mi));
+
+	return;
+}
+
+static void
+menu_show (IndicatorObject * io, IndicatorObjectEntry * entry,<--- Parameter 'entry' can be declared with const
+           guint32 timestamp, gpointer user_data)
+{
+	GtkWidget * menubar = GTK_WIDGET(user_data);
+
+	if (entry == NULL) {
+		/* Close any open menus instead of opening one */
+		GList * entries = indicator_object_get_entries(io);
+		GList * iterator = NULL;
+		for (iterator = entries; iterator != NULL; iterator = g_list_next(iterator)) {
+			IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)iterator->data;
+			gtk_menu_popdown(entrydata->menu);
+		}
+		g_list_free(entries);
+
+		/* And tell the menubar to exit activation mode too */
+		gtk_menu_shell_cancel(GTK_MENU_SHELL(menubar));
+		return;
+	}
+
+	// TODO: do something sensible here
+}
+
+static void
+update_accessible_desc(IndicatorObjectEntry * entry, GtkWidget * menuitem)
+{
+	/* FIXME: We need to deal with the use case where the contents of the
+	   label overrides what is found in the atk object's name, or at least
+	   orca speaks the label instead of the atk object name.
+	 */
+	AtkObject * menuitem_obj = gtk_widget_get_accessible(menuitem);
+	if (menuitem_obj == NULL) {
+		/* Should there be an error printed here? */
+		return;
+	}
+
+	if (entry->accessible_desc != NULL) {
+		atk_object_set_name(menuitem_obj, entry->accessible_desc);
+	} else {
+		atk_object_set_name(menuitem_obj, "");
+	}
+	return;
+}
+
+static void
+load_indicator (MatePanelApplet *applet, GtkWidget * menubar, IndicatorObject *io, const gchar *name)
+{
+	/* Set the environment it's in */
+	indicator_object_set_environment(io, (const GStrv)indicator_env);
+
+	/* Attach the 'name' to the object */
+#if HAVE_AYATANA_INDICATOR_NG || HAVE_UBUNTU_INDICATOR_NG
+	int pos = 5000 - indicator_object_get_position(io);
+	if (pos > 5000) {
+		pos = name2order(name);
+	}
+#else
+	int pos = name2order(name);
+#endif
+
+	g_object_set_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER, GINT_TO_POINTER(pos));
+
+	/* Connect to its signals */
+	g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED,   G_CALLBACK(entry_added),    menubar);
+	g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED, G_CALLBACK(entry_removed),  menubar);
+	g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED,   G_CALLBACK(entry_moved),    menubar);
+	g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_MENU_SHOW,     G_CALLBACK(menu_show),      menubar);
+	g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE, G_CALLBACK(accessible_desc_update), menubar);
+
+	/* Track panel resize */
+	g_signal_connect_object(G_OBJECT(applet), "change-size", G_CALLBACK(entry_resized), G_OBJECT(io), 0);
+
+	/* Work on the entries */
+	GList * entries = indicator_object_get_entries(io);
+	GList * entry = NULL;
+
+	for (entry = entries; entry != NULL; entry = g_list_next(entry)) {
+		IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)entry->data;
+		entry_added(io, entrydata, menubar);
+	}
+
+	g_list_free(entries);
+}
+
+static gboolean
+load_module (const gchar * name, MatePanelApplet *applet, GtkWidget * menubar)
+{
+	g_debug("Looking at Module: %s", name);
+	g_return_val_if_fail(name != NULL, FALSE);
+
+	if (!g_str_has_suffix(name, G_MODULE_SUFFIX)) {
+		return FALSE;
+	}
+
+	g_debug("Loading Module: %s", name);
+
+	/* Build the object for the module */
+	gchar * fullpath = g_build_filename(INDICATOR_DIR, name, NULL);
+	IndicatorObject * io = indicator_object_new_from_file(fullpath);
+	g_free(fullpath);
+
+	load_indicator(applet, menubar, io, name);
+
+	return TRUE;
+}
+
+static void
+load_modules (MatePanelApplet *applet, GtkWidget *menubar, gint *indicators_loaded)
+{
+	if (g_file_test(INDICATOR_DIR, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) {
+		GDir * dir = g_dir_open(INDICATOR_DIR, 0, NULL);
+
+		const gchar * name;
+		gint count = 0;
+		while ((name = g_dir_read_name(dir)) != NULL) {
+#ifdef INDICATOR_APPLET_APPMENU
+			if (g_strcmp0(name, INDICATOR_SERVICE_APPMENU)) {
+				continue;
+			}
+#else
+			if (!g_strcmp0(name, INDICATOR_SERVICE_APPMENU)) {
+				continue;
+			}
+#endif
+#ifdef INDICATOR_APPLET
+			if (!g_strcmp0(name, INDICATOR_SERVICE_ME)) {
+				continue;
+			}
+			if (!g_strcmp0(name, INDICATOR_SERVICE_DATETIME)) {
+				continue;
+			}
+#endif
+			if (load_module(name, applet, menubar)) {
+				count++;
+			}
+		}
+
+		*indicators_loaded += count;
+
+		g_dir_close (dir);
+	}
+}
+
+#if HAVE_AYATANA_INDICATOR_NG || HAVE_UBUNTU_INDICATOR_NG
+
+static void
+load_indicators_from_indicator_files (MatePanelApplet *applet, GtkWidget *menubar, gint *indicators_loaded)
+{
+	GDir *dir;
+	const gchar *name;
+	GError *error = NULL;
+
+	dir = g_dir_open (INDICATOR_SERVICE_DIR, 0, &error);
+
+	if (!dir) {
+		g_warning ("unable to open indicator service file directory: %s", error->message);
+		g_error_free (error);
+
+		return;
+	}
+
+	gint count = 0;
+	while ((name = g_dir_read_name (dir))) {
+		gchar *filename;
+		IndicatorNg *indicator;
+
+		filename = g_build_filename (INDICATOR_SERVICE_DIR, name, NULL);
+		indicator = indicator_ng_new_for_profile (filename, "desktop", &error);
+		g_free (filename);
+
+#ifdef INDICATOR_APPLET_APPMENU
+		if (g_strcmp0(name, INDICATOR_SERVICE_APPMENU_NG)) {
+			continue;
+		}
+#else
+		if (!g_strcmp0(name, INDICATOR_SERVICE_APPMENU_NG)) {
+			continue;
+		}
+#endif
+#ifdef INDICATOR_APPLET
+		if (!g_strcmp0(name, INDICATOR_SERVICE_ME_NG)) {
+			continue;
+		}
+		if (!g_strcmp0(name, INDICATOR_SERVICE_DATETIME_NG)) {
+			continue;
+		}
+#endif
+
+		if (indicator) {
+			load_indicator(applet, menubar, INDICATOR_OBJECT (indicator), name);
+			count++;
+		}else{
+			g_warning ("unable to load '%s': %s", name, error->message);
+			g_clear_error (&error);
+		}
+	}
+
+	*indicators_loaded += count;
+
+	g_dir_close (dir);
+}
+#endif  /* HAVE_AYATANA_INDICATOR_NG || HAVE_UBUNTU_INDICATOR_NG */
+
+static void
+hotkey_filter (char * keystring G_GNUC_UNUSED, gpointer data)
+{
+	g_return_if_fail(GTK_IS_MENU_SHELL(data));
+
+	/* Oh, wow, it's us! */
+	GList * children = gtk_container_get_children(GTK_CONTAINER(data));
+	if (children == NULL) {
+		g_debug("Menubar has no children");
+		return;
+	}
+
+	gtk_menu_shell_select_item(GTK_MENU_SHELL(data), GTK_WIDGET(g_list_last(children)->data));
+	g_list_free(children);
+	return;
+}
+
+static gboolean
+menubar_press (GtkWidget * widget,
+                    GdkEventButton *event,
+                    gpointer data G_GNUC_UNUSED)
+{
+	if (event->button != 1) {
+		g_signal_stop_emission_by_name(widget, "button-press-event");
+	}
+
+	return FALSE;
+}
+
+static gboolean
+menubar_on_draw (GtkWidget * widget,
+                 cairo_t * cr,
+                 GtkWidget * menubar)
+{
+	/* FIXME: either port to gtk_render_focus or remove this function */
+	if (gtk_widget_has_focus(menubar))
+		gtk_paint_focus(gtk_widget_get_style(widget),
+		                cr,
+		                gtk_widget_get_state(menubar),
+		                widget, "menubar-applet", 0, 0, -1, -1);
+
+	return FALSE;
+}
+
+static void
+about_cb (GtkAction *action G_GNUC_UNUSED,
+          gpointer   data G_GNUC_UNUSED)
+{
+	static const gchar *authors[] = {
+		"Ted Gould <ted@canonical.com>",
+		NULL
+	};
+
+	static gchar *license[] = {
+        N_("This program is free software: you can redistribute it and/or modify it "
+           "under the terms of the GNU General Public License version 3, as published "
+           "by the Free Software Foundation."),
+        N_("This program is distributed in the hope that it will be useful, but "
+           "WITHOUT ANY WARRANTY; without even the implied warranties of "
+           "MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR "
+           "PURPOSE.  See the GNU General Public License for more details."),
+        N_("You should have received a copy of the GNU General Public License along "
+           "with this program.  If not, see <http://www.gnu.org/licenses/>."),
+		NULL
+	};
+	gchar *license_i18n;
+
+	license_i18n = g_strconcat (_(license[0]), "\n\n", _(license[1]), "\n\n", _(license[2]), NULL);
+
+	gtk_show_about_dialog(NULL,
+		"version", VERSION,
+		"copyright", _("Copyright \xc2\xa9 2009-2010 Canonical, Ltd.\n"
+		               "Copyright \xc2\xa9 2011-2021 MATE developers"),
+#ifdef INDICATOR_APPLET_APPMENU
+		"comments", _("An applet to hold your application menus."),
+#endif
+		"comments", _("An applet to hold all of the system indicators."),
+		"authors", authors,
+		"license", license_i18n,
+		"wrap-license", TRUE,
+		"translator-credits", _("translator-credits"),
+		"logo-icon-name", "mate-indicator-applet",
+		"icon-name", "mate-indicator-applet",
+		"website", "https://mate-desktop.org",
+		"website-label", _("MATE Website"),
+		NULL
+	);
+
+	g_free (license_i18n);
+
+	return;
+}
+
+static gboolean
+swap_orient_cb (GtkWidget *item, gpointer data)
+{
+	GtkWidget *from = (GtkWidget *) data;
+	GtkWidget *to = (GtkWidget *) g_object_get_data(G_OBJECT(from), "to");
+	g_object_ref(G_OBJECT(item));
+	gtk_container_remove(GTK_CONTAINER(from), item);
+	if (GTK_IS_LABEL(item)) {
+			switch(packdirection) {
+			case GTK_PACK_DIRECTION_LTR:
+				gtk_label_set_angle(GTK_LABEL(item), 0.0);
+				break;
+			case GTK_PACK_DIRECTION_TTB:
+				gtk_label_set_angle(GTK_LABEL(item),
+						(orient == MATE_PANEL_APPLET_ORIENT_LEFT) ?
+						270.0 : 90.0);
+				break;
+			default:
+				break;
+		}
+	}
+	gtk_box_pack_start(GTK_BOX(to), item, FALSE, FALSE, 0);
+	return TRUE;
+}
+
+static gboolean
+reorient_box_cb (GtkWidget *menuitem, gpointer data)
+{
+	GtkWidget *from = g_object_get_data(G_OBJECT(menuitem), "box");
+	GtkWidget *to = (packdirection == GTK_PACK_DIRECTION_LTR) ?
+		gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0) : gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+	g_object_set_data(G_OBJECT(from), "to", to);
+	gtk_container_foreach(GTK_CONTAINER(from), (GtkCallback)swap_orient_cb,
+			from);
+	gtk_container_remove(GTK_CONTAINER(menuitem), from);
+	gtk_container_add(GTK_CONTAINER(menuitem), to);
+	g_object_set_data(G_OBJECT(menuitem), "box", to);
+	gtk_widget_show_all(menuitem);
+	return TRUE;
+}
+
+static gboolean
+matepanelapplet_reorient_cb (GtkWidget *applet, MatePanelAppletOrient neworient,
+		gpointer data)
+{
+	GtkWidget *menubar = (GtkWidget *)data;
+	if ((((neworient == MATE_PANEL_APPLET_ORIENT_UP) ||
+			(neworient == MATE_PANEL_APPLET_ORIENT_DOWN)) &&
+			((orient == MATE_PANEL_APPLET_ORIENT_LEFT) ||
+			(orient == MATE_PANEL_APPLET_ORIENT_RIGHT))) ||
+			(((neworient == MATE_PANEL_APPLET_ORIENT_LEFT) ||
+			(neworient == MATE_PANEL_APPLET_ORIENT_RIGHT)) &&
+			((orient == MATE_PANEL_APPLET_ORIENT_UP) ||
+			(orient == MATE_PANEL_APPLET_ORIENT_DOWN)))) {
+		packdirection = (packdirection == GTK_PACK_DIRECTION_LTR) ?
+				GTK_PACK_DIRECTION_TTB : GTK_PACK_DIRECTION_LTR;
+		gtk_menu_bar_set_pack_direction(GTK_MENU_BAR(menubar),
+				packdirection);
+		orient = neworient;
+		gtk_container_foreach(GTK_CONTAINER(menubar),
+				(GtkCallback)reorient_box_cb, NULL);
+	}
+	orient = neworient;
+	return FALSE;
+}
+
+#ifdef N_
+#undef N_
+#endif
+#define N_(x) x
+
+static void
+log_to_file_cb (GObject * source_obj G_GNUC_UNUSED,
+                GAsyncResult * result G_GNUC_UNUSED, gpointer user_data)
+{
+	g_free(user_data);
+	return;
+}
+
+static void
+log_to_file (const gchar * domain G_GNUC_UNUSED,
+             GLogLevelFlags level G_GNUC_UNUSED,
+             const gchar * message,
+             gpointer data G_GNUC_UNUSED)
+{
+	if (log_file == NULL) {
+		GError * error = NULL;
+		gchar * filename = g_build_filename(g_get_user_cache_dir(), LOG_FILE_NAME, NULL);
+		GFile * file = g_file_new_for_path(filename);
+		g_free(filename);
+
+		if (!g_file_test(g_get_user_cache_dir(), G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
+			GFile * cachedir = g_file_new_for_path(g_get_user_cache_dir());
+			g_file_make_directory_with_parents(cachedir, NULL, &error);
+
+			if (error != NULL) {
+				g_error("Unable to make directory '%s' for log file: %s", g_get_user_cache_dir(), error->message);
+			}
+		}
+
+		g_file_delete(file, NULL, NULL);
+
+		GFileIOStream * io = g_file_create_readwrite(file,
+		                          G_FILE_CREATE_REPLACE_DESTINATION, /* flags */
+		                          NULL, /* cancelable */
+		                          &error); /* error */
+		if (error != NULL) {
+			g_error("Unable to replace file: %s", error->message);
+		}
+
+		log_file = g_io_stream_get_output_stream(G_IO_STREAM(io));
+	}
+
+	gchar * outputstring = g_strdup_printf("%s\n", message);
+	g_output_stream_write_async(log_file,
+	                            outputstring, /* data */
+	                            strlen(outputstring), /* length */
+	                            G_PRIORITY_LOW, /* priority */
+	                            NULL, /* cancelable */
+	                            log_to_file_cb, /* callback */
+	                            outputstring); /* data */
+
+	return;
+}
+
+static gboolean
+applet_fill_cb (MatePanelApplet * applet, const gchar * iid G_GNUC_UNUSED,
+                gpointer data G_GNUC_UNUSED)
+{
+#if HAVE_AYATANA_INDICATOR_NG || HAVE_UBUNTU_INDICATOR_NG
+	ido_init();
+#endif
+
+	static const GtkActionEntry menu_actions[] = {
+		{"About", "help-about", N_("_About"), NULL, NULL, G_CALLBACK(about_cb)}
+	};
+	static const gchar *menu_xml = "<menuitem name=\"About\" action=\"About\"/>";
+
+	static gboolean first_time = FALSE;
+	GtkWidget *menubar;
+	gint indicators_loaded = 0;
+	GtkActionGroup *action_group;
+
+	if (!first_time)
+	{
+		first_time = TRUE;
+#ifdef INDICATOR_APPLET
+		g_set_application_name(_("Indicator Applet"));
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+		g_set_application_name(_("Indicator Applet Complete"));
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+		g_set_application_name(_("Indicator Applet Application Menu"));
+#endif
+
+		g_log_set_default_handler(log_to_file, NULL);
+
+		tomboy_keybinder_init();
+	}
+
+	/* Set panel options */
+	gtk_container_set_border_width(GTK_CONTAINER (applet), 0);
+	mate_panel_applet_set_flags(applet, MATE_PANEL_APPLET_EXPAND_MINOR);
+	menubar = gtk_menu_bar_new();
+	action_group = gtk_action_group_new ("Indicator Applet Actions");
+	gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+	gtk_action_group_add_actions (action_group, menu_actions,
+	                              G_N_ELEMENTS (menu_actions),
+	                              menubar);
+	mate_panel_applet_setup_menu(applet, menu_xml, action_group);
+	g_object_unref(action_group);
+#ifdef INDICATOR_APPLET
+	atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)),
+	                     "indicator-applet");
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+	atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)),
+	                     "indicator-applet-complete");
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+	atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)),
+	                     "indicator-applet-appmenu");
+#endif
+
+	/* Init some theme/icon stuff */
+	gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(),
+	                                  INDICATOR_ICONS_DIR);
+	/* g_debug("Icons directory: %s", INDICATOR_ICONS_DIR); */
+	gtk_widget_set_name(GTK_WIDGET (applet), "fast-user-switch-applet");
+
+	/* Build menubar */
+	size = (mate_panel_applet_get_size (applet));
+	orient = (mate_panel_applet_get_orient(applet));
+	packdirection = ((orient == MATE_PANEL_APPLET_ORIENT_UP) ||
+			(orient == MATE_PANEL_APPLET_ORIENT_DOWN)) ?
+			GTK_PACK_DIRECTION_LTR : GTK_PACK_DIRECTION_TTB;
+	gtk_menu_bar_set_pack_direction(GTK_MENU_BAR(menubar),
+			packdirection);
+	gtk_widget_set_can_focus (menubar, TRUE);
+	gtk_widget_set_name(GTK_WIDGET (menubar), "fast-user-switch-menubar");
+	g_signal_connect(menubar, "button-press-event", G_CALLBACK(menubar_press), NULL);
+	g_signal_connect_after(menubar, "draw", G_CALLBACK(menubar_on_draw), menubar);
+	g_signal_connect(applet, "change-orient",
+			G_CALLBACK(matepanelapplet_reorient_cb), menubar);
+	gtk_container_set_border_width(GTK_CONTAINER(menubar), 0);
+
+	/* Add in filter func */
+	tomboy_keybinder_bind(hotkey_keycode, hotkey_filter, menubar);
+
+	load_modules(applet, menubar, &indicators_loaded);
+#if HAVE_AYATANA_INDICATOR_NG || HAVE_UBUNTU_INDICATOR_NG
+	load_indicators_from_indicator_files(applet, menubar, &indicators_loaded);
+#endif
+
+	if (indicators_loaded == 0) {
+		/* A label to allow for click through */
+		GtkWidget * item = gtk_label_new(_("No Indicators"));
+		mate_panel_applet_set_background_widget(applet, item);
+		gtk_container_add(GTK_CONTAINER(applet), item);
+		gtk_widget_show(item);
+	} else {
+		gtk_container_add(GTK_CONTAINER(applet), menubar);
+		mate_panel_applet_set_background_widget(applet, menubar);
+		gtk_widget_show(menubar);
+	}
+
+	gtk_widget_show(GTK_WIDGET(applet));
+
+	return TRUE;
+
+}
+
+
+
+
+ + + diff --git a/2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/1.html b/2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/1.html new file mode 100644 index 0000000..6e484d7 --- /dev/null +++ b/2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/1.html @@ -0,0 +1,1229 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
/* eggaccelerators.c
+ * Copyright (C) 2002  Red Hat, Inc.; Copyright 1998, 2001 Tim Janik
+ * Developed by Havoc Pennington, Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+
+#include "eggaccelerators.h"
+
+#include <string.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
+
+enum
+{
+  EGG_MODMAP_ENTRY_SHIFT   = 0,
+  EGG_MODMAP_ENTRY_LOCK    = 1,
+  EGG_MODMAP_ENTRY_CONTROL = 2,
+  EGG_MODMAP_ENTRY_MOD1    = 3,
+  EGG_MODMAP_ENTRY_MOD2    = 4,
+  EGG_MODMAP_ENTRY_MOD3    = 5,
+  EGG_MODMAP_ENTRY_MOD4    = 6,
+  EGG_MODMAP_ENTRY_MOD5    = 7,
+  EGG_MODMAP_ENTRY_LAST    = 8
+};
+
+#define MODMAP_ENTRY_TO_MODIFIER(x) (1 << (x))
+
+typedef struct
+{
+  EggVirtualModifierType mapping[EGG_MODMAP_ENTRY_LAST];
+
+} EggModmap;
+
+const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap);
+
+static inline gboolean
+is_alt (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'a' || string[1] == 'A') &&
+	  (string[2] == 'l' || string[2] == 'L') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_ctl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_modx (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'd' || string[3] == 'D') &&
+	  (string[4] >= '1' && string[4] <= '5') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_ctrl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'r' || string[3] == 'R') &&
+	  (string[4] == 'l' || string[4] == 'L') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shft (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'f' || string[3] == 'F') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shift (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'i' || string[3] == 'I') &&
+	  (string[4] == 'f' || string[4] == 'F') &&
+	  (string[5] == 't' || string[5] == 'T') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_control (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'n' || string[3] == 'N') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == 'o' || string[6] == 'O') &&
+	  (string[7] == 'l' || string[7] == 'L') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_release (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'r' || string[1] == 'R') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'a' || string[5] == 'A') &&
+	  (string[6] == 's' || string[6] == 'S') &&
+	  (string[7] == 'e' || string[7] == 'E') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_meta (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == 'a' || string[4] == 'A') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_super (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'u' || string[2] == 'U') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_hyper (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'h' || string[1] == 'H') &&
+	  (string[2] == 'y' || string[2] == 'Y') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+/**
+ * egg_accelerator_parse_virtual:
+ * @accelerator:      string representing an accelerator
+ * @accelerator_key:  return location for accelerator keyval
+ * @accelerator_mods: return location for accelerator modifier mask
+ *
+ * Parses a string representing a virtual accelerator. The format
+ * looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1" or
+ * "&lt;Release&gt;z" (the last one is for key release).  The parser
+ * is fairly liberal and allows lower or upper case, and also
+ * abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;".
+ *
+ * If the parse fails, @accelerator_key and @accelerator_mods will
+ * be set to 0 (zero) and %FALSE will be returned. If the string contains
+ * only modifiers, @accelerator_key will be set to 0 but %TRUE will be
+ * returned.
+ *
+ * The virtual vs. concrete accelerator distinction is a relic of
+ * how the X Window System works; there are modifiers Mod2-Mod5 that
+ * can represent various keyboard keys (numlock, meta, hyper, etc.),
+ * the virtual modifier represents the keyboard key, the concrete
+ * modifier the actual Mod2-Mod5 bits in the key press event.
+ *
+ * Returns: %TRUE on success.
+ */
+gboolean
+egg_accelerator_parse_virtual (const gchar            *accelerator,
+                               guint                  *accelerator_key,
+                               EggVirtualModifierType *accelerator_mods)
+{
+  guint keyval;
+  GdkModifierType mods;
+  gint len;
+  gboolean bad_keyval;
+
+  if (accelerator_key)
+    *accelerator_key = 0;
+  if (accelerator_mods)
+    *accelerator_mods = 0;
+
+  g_return_val_if_fail (accelerator != NULL, FALSE);
+
+  bad_keyval = FALSE;
+
+  keyval = 0;
+  mods = 0;
+  len = strlen (accelerator);
+  while (len)
+    {
+      if (*accelerator == '<')
+	{
+	  if (len >= 9 && is_release (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_RELEASE_MASK;
+	    }
+	  else if (len >= 9 && is_control (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 7 && is_shift (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_shft (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_ctrl (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 6 && is_modx (accelerator))
+	    {
+	      static const guint mod_vals[] = {
+		EGG_VIRTUAL_ALT_MASK, EGG_VIRTUAL_MOD2_MASK, EGG_VIRTUAL_MOD3_MASK,
+		EGG_VIRTUAL_MOD4_MASK, EGG_VIRTUAL_MOD5_MASK
+	      };
+
+	      len -= 6;
+	      accelerator += 4;
+	      mods |= mod_vals[*accelerator - '1'];
+	      accelerator += 2;
+	    }
+	  else if (len >= 5 && is_ctl (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 5 && is_alt (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_ALT_MASK;
+	    }
+          else if (len >= 6 && is_meta (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_META_MASK;
+	    }
+          else if (len >= 7 && is_hyper (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_HYPER_MASK;
+	    }
+          else if (len >= 7 && is_super (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SUPER_MASK;
+	    }
+	  else
+	    {
+	      gchar last_ch;
+
+	      last_ch = *accelerator;
+	      while (last_ch && last_ch != '>')
+		{
+		  last_ch = *accelerator;
+		  accelerator += 1;
+		  len -= 1;
+		}
+	    }
+	}
+      else
+	{
+          keyval = gdk_keyval_from_name (accelerator);
+
+          if (keyval == 0)
+            bad_keyval = TRUE;
+
+          accelerator += len;
+          len -= len;
+	}
+    }
+
+  if (accelerator_key)
+    *accelerator_key = gdk_keyval_to_lower (keyval);
+  if (accelerator_mods)
+    *accelerator_mods = mods;
+
+  return !bad_keyval;
+}
+
+void
+egg_keymap_resolve_virtual_modifiers (GdkKeymap              *keymap,
+                                      EggVirtualModifierType  virtual_mods,
+                                      GdkModifierType        *concrete_mods)
+{
+  GdkModifierType concrete;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (concrete_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  concrete = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if (modmap->mapping[i] & virtual_mods)
+        concrete |= (1 << i);
+
+      ++i;
+    }
+
+  *concrete_mods = concrete;
+}
+
+void
+egg_keymap_virtualize_modifiers (GdkKeymap              *keymap,
+                                 GdkModifierType         concrete_mods,
+                                 EggVirtualModifierType *virtual_mods)
+{
+  GdkModifierType virtual;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (virtual_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  virtual = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if ((1 << i) & concrete_mods)
+        {
+          EggVirtualModifierType cleaned;
+
+          cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK |
+                                           EGG_VIRTUAL_MOD3_MASK |
+                                           EGG_VIRTUAL_MOD4_MASK |
+                                           EGG_VIRTUAL_MOD5_MASK);
+
+          if (cleaned != 0)
+            {
+              virtual |= cleaned;
+            }
+          else
+            {
+              /* Rather than dropping mod2->mod5 if not bound,
+               * go ahead and use the concrete names
+               */
+              virtual |= modmap->mapping[i];
+            }
+        }
+
+      ++i;
+    }
+
+  *virtual_mods = virtual;
+}
+
+static void
+reload_modmap (GdkKeymap *keymap,
+               EggModmap *modmap)
+{
+  XModifierKeymap *xmodmap;
+  int map_size;
+  int i;
+
+  /* FIXME multihead */
+  xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ());
+
+  memset (modmap->mapping, 0, sizeof (modmap->mapping));
+
+  /* there are 8 modifiers, and the first 3 are shift, shift lock,
+   * and control
+   */
+  map_size = 8 * xmodmap->max_keypermod;
+  i = 3 * xmodmap->max_keypermod;
+  while (i < map_size)
+    {
+      /* get the key code at this point in the map,
+       * see if its keysym is one we're interested in
+       */
+      int keycode = xmodmap->modifiermap[i];
+      GdkKeymapKey *keys;
+      guint *keyvals;
+      int n_entries;
+      int j;
+      EggVirtualModifierType mask;
+
+      keys = NULL;
+      keyvals = NULL;
+      n_entries = 0;
+
+      gdk_keymap_get_entries_for_keycode (keymap,
+                                          keycode,
+                                          &keys, &keyvals, &n_entries);
+
+      mask = 0;
+      j = 0;
+      while (j < n_entries)
+        {
+          if (keyvals[j] == GDK_KEY_Num_Lock)
+            mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Scroll_Lock)
+            mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Meta_L ||
+                   keyvals[j] == GDK_KEY_Meta_R)
+            mask |= EGG_VIRTUAL_META_MASK;
+          else if (keyvals[j] == GDK_KEY_Hyper_L ||
+                   keyvals[j] == GDK_KEY_Hyper_R)
+            mask |= EGG_VIRTUAL_HYPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Super_L ||
+                   keyvals[j] == GDK_KEY_Super_R)
+            mask |= EGG_VIRTUAL_SUPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Mode_switch)
+            mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
+
+          ++j;
+        }
+
+      /* Mod1Mask is 1 << 3 for example, i.e. the
+       * fourth modifier, i / keyspermod is the modifier
+       * index
+       */
+      modmap->mapping[i/xmodmap->max_keypermod] |= mask;
+
+      g_free (keyvals);
+      g_free (keys);
+
+      ++i;
+    }
+
+  /* Add in the not-really-virtual fixed entries */
+  modmap->mapping[EGG_MODMAP_ENTRY_SHIFT] |= EGG_VIRTUAL_SHIFT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_CONTROL] |= EGG_VIRTUAL_CONTROL_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_LOCK] |= EGG_VIRTUAL_LOCK_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD1] |= EGG_VIRTUAL_ALT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD2] |= EGG_VIRTUAL_MOD2_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK;
+
+  XFreeModifiermap (xmodmap);
+}
+
+const EggModmap*
+egg_keymap_get_modmap (GdkKeymap *keymap)
+{
+  EggModmap *modmap;
+
+  /* This is all a hack, much simpler when we can just
+   * modify GDK directly.
+   */
+
+  modmap = g_object_get_data (G_OBJECT (keymap),
+                              "egg-modmap");
+
+  if (modmap == NULL)
+    {
+      modmap = g_new0 (EggModmap, 1);
+
+      /* FIXME modify keymap change events with an event filter
+       * and force a reload if we get one
+       */
+
+      reload_modmap (keymap, modmap);
+
+      g_object_set_data_full (G_OBJECT (keymap),
+                              "egg-modmap",
+                              modmap,
+                              g_free);
+    }
+
+  g_assert (modmap != NULL);
+
+  return modmap;
+}
+
+
+
+
+ + + diff --git a/2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/2.html b/2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/2.html new file mode 100644 index 0000000..808ce42 --- /dev/null +++ b/2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/2.html @@ -0,0 +1,857 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
/* tomboykeybinder.c
+ * Copyright (C) 2008 Novell
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+#include <string.h>
+
+#include <gdk/gdk.h>
+#include <gdk/gdkwindow.h>
+#include <gdk/gdkx.h>
+#include <X11/Xlib.h>
+
+#include "eggaccelerators.h"
+#include "tomboykeybinder.h"
+
+/* Uncomment the next line to print a debug trace. */
+/* #define DEBUG */
+
+#ifdef DEBUG
+#  define TRACE(x) x
+#else
+#  define TRACE(x) do {} while (FALSE);
+#endif
+
+typedef struct _Binding {
+	TomboyBindkeyHandler  handler;
+	gpointer              user_data;
+	char                 *keystring;
+	uint                  keycode;
+	uint                  modifiers;
+} Binding;
+
+static GSList *bindings = NULL;
+static guint32 last_event_time = 0;
+static gboolean processing_event = FALSE;
+
+static guint num_lock_mask, caps_lock_mask, scroll_lock_mask;
+
+static void
+lookup_ignorable_modifiers (GdkKeymap *keymap)
+{
+	egg_keymap_resolve_virtual_modifiers (keymap,
+					      EGG_VIRTUAL_LOCK_MASK,
+					      &caps_lock_mask);
+
+	egg_keymap_resolve_virtual_modifiers (keymap,
+					      EGG_VIRTUAL_NUM_LOCK_MASK,
+					      &num_lock_mask);
+
+	egg_keymap_resolve_virtual_modifiers (keymap,
+					      EGG_VIRTUAL_SCROLL_LOCK_MASK,
+					      &scroll_lock_mask);
+}
+
+static void
+grab_ungrab_with_ignorable_modifiers (GdkWindow *rootwin,
+				      Binding   *binding,
+				      gboolean   grab)
+{
+	guint mod_masks [] = {
+		0, /* modifier only */
+		num_lock_mask,
+		caps_lock_mask,
+		scroll_lock_mask,
+		num_lock_mask  | caps_lock_mask,
+		num_lock_mask  | scroll_lock_mask,
+		caps_lock_mask | scroll_lock_mask,
+		num_lock_mask  | caps_lock_mask | scroll_lock_mask,
+	};
+	guint i;
+
+	for (i = 0; i < G_N_ELEMENTS (mod_masks); i++) {
+		if (grab) {
+			XGrabKey (GDK_WINDOW_XDISPLAY (rootwin),
+				  binding->keycode,
+				  binding->modifiers | mod_masks [i],
+				  GDK_WINDOW_XID (rootwin),
+				  False,
+				  GrabModeAsync,
+				  GrabModeAsync);
+		} else {
+			XUngrabKey (GDK_WINDOW_XDISPLAY (rootwin),
+				    binding->keycode,
+				    binding->modifiers | mod_masks [i],
+				    GDK_WINDOW_XID (rootwin));
+		}
+	}
+}
+
+static gboolean
+do_grab_key (Binding *binding)
+{
+	GdkDisplay *gdk_display = gdk_display_get_default ();
+	GdkKeymap *keymap = gdk_keymap_get_for_display (gdk_display);
+	GdkWindow *rootwin = gdk_get_default_root_window ();
+
+	EggVirtualModifierType virtual_mods = 0;
+	guint keysym = 0;
+
+	if (keymap == NULL || rootwin == NULL)
+		return FALSE;
+
+	if (!egg_accelerator_parse_virtual (binding->keystring,
+					    &keysym,
+					    &virtual_mods))
+		return FALSE;
+
+	TRACE (g_print ("Got accel %d, %d\n", keysym, virtual_mods));
+
+	binding->keycode = XKeysymToKeycode (GDK_WINDOW_XDISPLAY (rootwin),
+					     keysym);
+	if (binding->keycode == 0)
+		return FALSE;
+
+	TRACE (g_print ("Got keycode %d\n", binding->keycode));
+
+	egg_keymap_resolve_virtual_modifiers (keymap,
+					      virtual_mods,
+					      &binding->modifiers);
+	if (binding->modifiers == 0)
+		return FALSE;
+
+	TRACE (g_print ("Got modmask %d\n", binding->modifiers));
+
+	gdk_x11_display_error_trap_push (gdk_display);
+
+	grab_ungrab_with_ignorable_modifiers (rootwin,
+					      binding,
+					      TRUE /* grab */);
+
+	gdk_display_flush (gdk_display);
+
+	if (gdk_x11_display_error_trap_pop (gdk_display)) {
+	   g_warning ("Binding '%s' failed!\n", binding->keystring);
+	   return FALSE;
+	}
+
+	return TRUE;
+}
+
+static gboolean
+do_ungrab_key (Binding *binding)
+{
+	GdkWindow *rootwin = gdk_get_default_root_window ();
+
+	TRACE (g_print ("Removing grab for '%s'\n", binding->keystring));
+
+	grab_ungrab_with_ignorable_modifiers (rootwin,
+					      binding,
+					      FALSE /* ungrab */);
+
+	return TRUE;
+}
+
+static GdkFilterReturn
+filter_func (GdkXEvent *gdk_xevent, GdkEvent *event G_GNUC_UNUSED,
+             gpointer data G_GNUC_UNUSED)
+{
+	GdkFilterReturn return_val = GDK_FILTER_CONTINUE;
+	XEvent *xevent = (XEvent *) gdk_xevent;
+	guint event_mods;
+	GSList *iter;
+
+	TRACE (g_print ("Got Event! %d, %d\n", xevent->type, event->type));
+
+	switch (xevent->type) {
+	case KeyPress:
+		TRACE (g_print ("Got KeyPress! keycode: %d, modifiers: %d\n",
+				xevent->xkey.keycode,
+				xevent->xkey.state));
+
+		/*
+		 * Set the last event time for use when showing
+		 * windows to avoid anti-focus-stealing code.
+		 */
+		processing_event = TRUE;
+		last_event_time = xevent->xkey.time;
+
+		event_mods = xevent->xkey.state & ~(num_lock_mask  |
+						    caps_lock_mask |
+						    scroll_lock_mask);
+
+		for (iter = bindings; iter != NULL; iter = iter->next) {
+			Binding *binding = (Binding *) iter->data;
+
+			if (binding->keycode == xevent->xkey.keycode &&
+			    binding->modifiers == event_mods) {
+
+				TRACE (g_print ("Calling handler for '%s'...\n",
+						binding->keystring));
+
+				(binding->handler) (binding->keystring,
+						    binding->user_data);
+			}
+		}
+
+		processing_event = FALSE;
+		break;
+	case KeyRelease:
+		TRACE (g_print ("Got KeyRelease! \n"));
+		break;
+	}
+
+	return return_val;
+}
+
+static void
+keymap_changed (GdkKeymap *map G_GNUC_UNUSED)
+{
+	GdkKeymap *keymap = gdk_keymap_get_for_display (gdk_display_get_default ());
+	GSList *iter;
+
+	TRACE (g_print ("Keymap changed! Regrabbing keys..."));
+
+	for (iter = bindings; iter != NULL; iter = iter->next) {
+		Binding *binding = (Binding *) iter->data;
+		do_ungrab_key (binding);
+	}
+
+	lookup_ignorable_modifiers (keymap);
+
+	for (iter = bindings; iter != NULL; iter = iter->next) {
+		Binding *binding = (Binding *) iter->data;
+		do_grab_key (binding);
+	}
+}
+
+void
+tomboy_keybinder_init (void)
+{
+	GdkKeymap *keymap = gdk_keymap_get_for_display (gdk_display_get_default ());
+	GdkWindow *rootwin = gdk_get_default_root_window ();
+
+	lookup_ignorable_modifiers (keymap);
+
+	gdk_window_add_filter (rootwin,
+			       filter_func,
+			       NULL);
+
+	g_signal_connect (keymap,
+			  "keys_changed",
+			  G_CALLBACK (keymap_changed),
+			  NULL);
+}
+
+void
+tomboy_keybinder_bind (const char           *keystring,
+		       TomboyBindkeyHandler  handler,
+		       gpointer              user_data)
+{
+	Binding *binding;
+	gboolean success;
+
+	binding = g_new0 (Binding, 1);
+	binding->keystring = g_strdup (keystring);
+	binding->handler = handler;
+	binding->user_data = user_data;
+
+	/* Sets the binding's keycode and modifiers */
+	success = do_grab_key (binding);
+
+	if (success) {
+		bindings = g_slist_prepend (bindings, binding);
+	} else {
+		g_free (binding->keystring);
+		g_free (binding);
+	}
+}
+
+void
+tomboy_keybinder_unbind (const char           *keystring,
+			 TomboyBindkeyHandler  handler)<--- Parameter 'handler' can be declared with const
+{
+	GSList *iter;
+
+	for (iter = bindings; iter != NULL; iter = iter->next) {
+		Binding *binding = (Binding *) iter->data;
+
+		if (strcmp (keystring, binding->keystring) != 0 ||
+		    handler != binding->handler)
+			continue;
+
+		do_ungrab_key (binding);
+
+		bindings = g_slist_remove (bindings, binding);
+
+		g_free (binding->keystring);
+		g_free (binding);
+		break;
+	}
+}
+
+/*
+ * From eggcellrenderkeys.c.
+ */
+gboolean
+tomboy_keybinder_is_modifier (guint keycode)
+{
+	gint i;
+	gint map_size;
+	XModifierKeymap *mod_keymap;
+	gboolean retval = FALSE;
+
+	mod_keymap = XGetModifierMapping (gdk_x11_get_default_xdisplay());
+
+	map_size = 8 * mod_keymap->max_keypermod;
+
+	i = 0;
+	while (i < map_size) {
+		if (keycode == mod_keymap->modifiermap[i]) {
+			retval = TRUE;
+			break;
+		}
+		++i;
+	}
+
+	XFreeModifiermap (mod_keymap);
+
+	return retval;
+}
+
+guint32
+tomboy_keybinder_get_current_event_time (void)
+{
+	if (processing_event)
+		return last_event_time;
+	else
+		return GDK_CURRENT_TIME;
+}
+
+
+
+
+ + + diff --git a/2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/index.html b/2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/index.html new file mode 100644 index 0000000..bda6fb2 --- /dev/null +++ b/2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/index.html @@ -0,0 +1,122 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+ + + + + + + + + + + +
LineIdCWESeverityMessage
missingIncludeSysteminformationCppcheck cannot find all the include files (use --check-config for details)
src/applet-main.c
536constParameter398styleParameter 'entry' can be declared with const
src/eggaccelerators.c
321duplicateExpression398styleSame expression on both sides of '-='.
src/tomboykeybinder.c
284constParameter398styleParameter 'handler' can be declared with const
+
+
+ + + diff --git a/2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/stats.html b/2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/stats.html new file mode 100644 index 0000000..3074784 --- /dev/null +++ b/2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/stats.html @@ -0,0 +1,107 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+

Top 10 files for style severity, total findings: 3
+   1  src/tomboykeybinder.c
+   1  src/eggaccelerators.c
+   1  src/applet-main.c
+

+ +
+
+ + + diff --git a/2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/style.css b/2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-11-10-055516-4410-cppcheck@4a2c0e82a075_master/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/0.html b/2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/0.html new file mode 100644 index 0000000..ff8f9d1 --- /dev/null +++ b/2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/0.html @@ -0,0 +1,2301 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
/*
+A small wrapper utility to load indicators and put them as menu items
+into the mate-panel using it's applet interface.
+
+Copyright 2009-2010 Canonical Ltd.
+
+Authors:
+    Ted Gould <ted@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+#include <string.h>
+#include <config.h>
+#include <glib/gi18n.h>
+#include <mate-panel-applet.h>
+#include <gdk/gdkkeysyms.h>
+#include <gtk/gtk.h>
+
+#if HAVE_UBUNTU_INDICATOR
+
+#define INDICATOR_SERVICE_APPMENU	"libappmenu.so"
+#define INDICATOR_SERVICE_ME		"libme.so"
+#define INDICATOR_SERVICE_DATETIME	"libdatetime.so"
+
+#define INDICATOR_SERVICE_APPMENU_NG	"com.canonical.indicator.appmenu"
+#define INDICATOR_SERVICE_ME_NG		"com.canonical.indicator.me"
+#define INDICATOR_SERVICE_DATETIME_NG	"com.canonical.indicator.datetime"
+
+#include <libindicator/indicator-object.h>
+#endif
+
+#if HAVE_AYATANA_INDICATOR
+
+#define INDICATOR_SERVICE_APPMENU	"libayatana-appmenu.so"
+#define INDICATOR_SERVICE_ME		"libayatana-me.so"
+#define INDICATOR_SERVICE_DATETIME	"libayatana-datetime.so"
+
+#define INDICATOR_SERVICE_APPMENU_NG	"org.ayatana.indicator.appmenu"
+#define INDICATOR_SERVICE_ME_NG		"org.ayatana.indicator.me"
+#define INDICATOR_SERVICE_DATETIME_NG	"org.ayatana.indicator.datetime"
+
+#include <libayatana-indicator/indicator-object.h>
+#endif
+
+/* For new style indicators */
+
+#if HAVE_UBUNTU_INDICATOR && HAVE_UBUNTU_INDICATOR_NG
+
+#include <libido/libido.h>
+#include <libindicator/indicator-ng.h>
+
+#define INDICATOR_SERVICE_DIR "/usr/share/unity/indicators"
+
+#endif
+
+#if HAVE_AYATANA_INDICATOR && HAVE_AYATANA_INDICATOR_NG
+
+#include <libayatana-ido/libayatana-ido.h>
+#include <libayatana-indicator/indicator-ng.h>
+
+#define INDICATOR_SERVICE_DIR "/usr/share/ayatana/indicators"
+
+#endif
+
+#include "tomboykeybinder.h"
+
+static gchar * indicator_order[] = {
+#if HAVE_UBUNTU_INDICATOR
+	"libapplication.so",
+	"libmessaging.so",
+	"libsoundmenu.so",
+	"libdatetime.so",
+	"libsession.so",
+#endif
+#if HAVE_AYATANA_INDICATOR
+	"libayatana-application.so",
+	"libayatana-messaging.so",
+	"libayatana-soundmenu.so",
+	"libayatana-datetime.so",
+	"libayatana-session.so",
+#endif
+	NULL
+};
+
+static GtkPackDirection packdirection;
+static MatePanelAppletOrient orient;
+static guint size;
+
+#define  MENU_DATA_INDICATOR_OBJECT  "indicator-object"
+#define  MENU_DATA_INDICATOR_ENTRY   "indicator-entry"
+
+#define  IO_DATA_ORDER_NUMBER        "indicator-order-number"
+
+static gboolean     applet_fill_cb (MatePanelApplet * applet, const gchar * iid, gpointer data);
+
+static void update_accessible_desc (IndicatorObjectEntry * entry, GtkWidget * menuitem);
+
+/*************
+ * main
+ * ***********/
+
+#ifdef INDICATOR_APPLET
+MATE_PANEL_APPLET_OUT_PROCESS_FACTORY ("IndicatorAppletFactory",
+               PANEL_TYPE_APPLET,
+               "indicator-applet",
+               applet_fill_cb, NULL);
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+MATE_PANEL_APPLET_OUT_PROCESS_FACTORY ("IndicatorAppletCompleteFactory",
+               PANEL_TYPE_APPLET,
+               "indicator-applet-complete",
+               applet_fill_cb, NULL);
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+MATE_PANEL_APPLET_OUT_PROCESS_FACTORY ("IndicatorAppletAppmenuFactory",
+               PANEL_TYPE_APPLET,
+               "indicator-applet-appmenu",
+               applet_fill_cb, NULL);
+#endif
+
+/*************
+ * log files
+ * ***********/
+#ifdef INDICATOR_APPLET
+#define LOG_FILE_NAME  "indicator-applet.log"
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+#define LOG_FILE_NAME  "indicator-applet-complete.log"
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+#define LOG_FILE_NAME  "indicator-applet-appmenu.log"
+#endif
+GOutputStream * log_file = NULL;
+
+/*****************
+ * Hotkey support
+ * **************/
+#ifdef INDICATOR_APPLET
+gchar * hotkey_keycode = "<Super>M";
+#endif
+#ifdef INDICATOR_APPLET_SESSION
+gchar * hotkey_keycode = "<Super>S";
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+gchar * hotkey_keycode = "<Super>S";
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+gchar * hotkey_keycode = "<Super>F1";
+#endif
+
+/********************
+ * Environment Names
+ * *******************/
+#ifdef INDICATOR_APPLET
+#define INDICATOR_SPECIFIC_ENV  "indicator-applet-original"
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+#define INDICATOR_SPECIFIC_ENV  "indicator-applet-complete"
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+#define INDICATOR_SPECIFIC_ENV  "indicator-applet-appmenu"
+#endif
+
+static const gchar * indicator_env[] = {
+	"indicator-applet",
+	INDICATOR_SPECIFIC_ENV,
+	NULL
+};
+
+/*************
+ * init function
+ * ***********/
+
+static gint
+name2order (const gchar * name) {
+	int i;
+
+	for (i = 0; indicator_order[i] != NULL; i++) {
+		if (g_strcmp0(name, indicator_order[i]) == 0) {
+			return i;
+		}
+	}
+
+	return -1;
+}
+
+typedef struct _incoming_position_t incoming_position_t;
+struct _incoming_position_t {
+	gint objposition;
+	gint entryposition;
+	gint menupos;
+	gboolean found;
+};
+
+/* This function helps by determining where in the menu list
+   this new entry should be placed.  It compares the objects
+   that they're on, and then the individual entries.  Each
+   is progressively more expensive. */
+static void
+place_in_menu (GtkWidget * widget, gpointer user_data)
+{
+	incoming_position_t * position = (incoming_position_t *)user_data;
+	if (position->found) {
+		/* We've already been placed, just finish the foreach */
+		return;
+	}
+
+	IndicatorObject * io = INDICATOR_OBJECT(g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_OBJECT));
+	g_assert(io != NULL);
+
+	gint objposition = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER));
+	/* We've already passed it, well, then this is where
+	   we should be be.  Stop! */
+	if (objposition > position->objposition) {
+		position->found = TRUE;
+		return;
+	}
+
+	/* The objects don't match yet, keep looking */
+	if (objposition < position->objposition) {
+		position->menupos++;
+		return;
+	}
+
+	/* The objects are the same, let's start looking at entries. */
+	IndicatorObjectEntry * entry = (IndicatorObjectEntry *)g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY);
+	gint entryposition = indicator_object_get_location(io, entry);
+
+	if (entryposition > position->entryposition) {
+		position->found = TRUE;
+		return;
+	}
+
+	if (entryposition < position->entryposition) {
+		position->menupos++;
+		return;
+	}
+
+	/* We've got the same object and the same entry.  Well,
+	   let's just put it right here then. */
+	position->found = TRUE;
+	return;
+}
+
+static void
+something_shown (GtkWidget * widget, gpointer user_data)
+{
+	GtkWidget * menuitem = GTK_WIDGET(user_data);
+	gtk_widget_show(menuitem);
+}
+
+static void
+something_hidden (GtkWidget * widget, gpointer user_data)
+{
+	GtkWidget * menuitem = GTK_WIDGET(user_data);
+	gtk_widget_hide(menuitem);
+}
+
+static void
+sensitive_cb (GObject * obj, GParamSpec * pspec, gpointer user_data)
+{
+	g_return_if_fail(GTK_IS_WIDGET(obj));
+	g_return_if_fail(GTK_IS_WIDGET(user_data));
+
+	gtk_widget_set_sensitive(GTK_WIDGET(user_data), gtk_widget_get_sensitive(GTK_WIDGET(obj)));
+	return;
+}
+
+static void
+entry_activated (GtkWidget * widget, gpointer user_data)
+{
+	g_return_if_fail(GTK_IS_WIDGET(widget));
+	gpointer pio = g_object_get_data(G_OBJECT(widget), "indicator");
+	g_return_if_fail(INDICATOR_IS_OBJECT(pio));
+	IndicatorObject * io = INDICATOR_OBJECT(pio);
+
+	return indicator_object_entry_activate(io, (IndicatorObjectEntry *)user_data, gtk_get_current_event_time());
+}
+
+static gboolean
+entry_scrolled (GtkWidget *menuitem, GdkEventScroll *event, gpointer data)
+{
+	IndicatorObject *io = g_object_get_data (G_OBJECT (menuitem), MENU_DATA_INDICATOR_OBJECT);
+	IndicatorObjectEntry *entry = g_object_get_data (G_OBJECT (menuitem), MENU_DATA_INDICATOR_ENTRY);
+
+	g_return_val_if_fail(INDICATOR_IS_OBJECT(io), FALSE);
+
+	g_signal_emit_by_name (io, "scroll", 1, event->direction);
+	g_signal_emit_by_name (io, "scroll-entry", entry, 1, event->direction);
+	g_signal_emit_by_name (io, INDICATOR_OBJECT_SIGNAL_ENTRY_SCROLLED, entry, 1, event->direction);
+
+	return FALSE;
+}
+
+static void
+accessible_desc_update_cb (GtkWidget * widget, gpointer userdata)
+{
+	gpointer data = g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY);
+
+	if (data != userdata) {
+		return;
+	}
+
+	IndicatorObjectEntry * entry = (IndicatorObjectEntry *)data;
+	update_accessible_desc(entry, widget);
+}
+
+static void
+accessible_desc_update (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menubar)
+{
+	gtk_container_foreach(GTK_CONTAINER(menubar), accessible_desc_update_cb, entry);
+	return;
+}
+
+#define PANEL_PADDING 8
+static gboolean
+entry_resized (GtkWidget *applet, guint newsize, gpointer data)
+{
+	IndicatorObject *io = (IndicatorObject *)data;
+
+	size = newsize;
+
+	/* Work on the entries */
+	GList * entries = indicator_object_get_entries(io);
+	GList * entry = NULL;
+
+	for (entry = entries; entry != NULL; entry = g_list_next(entry)) {
+		IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)entry->data;
+		if (entrydata->image != NULL) {
+			/* Resize to fit panel */
+			gtk_image_set_pixel_size (entrydata->image, size - PANEL_PADDING);
+		}
+	}
+
+	return FALSE;
+}
+
+static void
+entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menubar)
+{
+	g_debug("Signal: Entry Added");
+	gboolean something_visible = FALSE;
+	gboolean something_sensitive = FALSE;
+
+	GtkWidget * menuitem = gtk_menu_item_new();
+	GtkWidget * box = (packdirection == GTK_PACK_DIRECTION_LTR) ?
+		gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3) : gtk_box_new(GTK_ORIENTATION_VERTICAL, 3);
+
+	/* Allows indicators to receive mouse scroll event */
+	gtk_widget_add_events(GTK_WIDGET(menuitem), GDK_SCROLL_MASK);
+
+	g_object_set_data (G_OBJECT (menuitem), "indicator", io);
+	g_object_set_data (G_OBJECT (menuitem), "box", box);
+
+	g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(entry_activated), entry);
+	g_signal_connect(G_OBJECT(menuitem), "scroll-event", G_CALLBACK(entry_scrolled), entry);
+
+	if (entry->image != NULL) {
+		/* Resize to fit panel */
+		gtk_image_set_pixel_size (entry->image, size - PANEL_PADDING);
+		gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(entry->image), FALSE, FALSE, 1);
+		if (gtk_widget_get_visible(GTK_WIDGET(entry->image))) {
+			something_visible = TRUE;
+		}
+
+		if (gtk_widget_get_sensitive(GTK_WIDGET(entry->image))) {
+			something_sensitive = TRUE;
+		}
+
+		g_signal_connect(G_OBJECT(entry->image), "show", G_CALLBACK(something_shown), menuitem);
+		g_signal_connect(G_OBJECT(entry->image), "hide", G_CALLBACK(something_hidden), menuitem);
+
+		g_signal_connect(G_OBJECT(entry->image), "notify::sensitive", G_CALLBACK(sensitive_cb), menuitem);
+	}
+	if (entry->label != NULL) {
+		switch(packdirection) {
+			case GTK_PACK_DIRECTION_LTR:
+				gtk_label_set_angle(GTK_LABEL(entry->label), 0.0);
+				break;
+			case GTK_PACK_DIRECTION_TTB:
+				gtk_label_set_angle(GTK_LABEL(entry->label),
+						(orient == MATE_PANEL_APPLET_ORIENT_LEFT) ?
+						270.0 : 90.0);
+				break;
+			default:
+				break;
+		}
+		gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(entry->label), FALSE, FALSE, 1);
+
+		if (gtk_widget_get_visible(GTK_WIDGET(entry->label))) {
+			something_visible = TRUE;
+		}
+
+		if (gtk_widget_get_sensitive(GTK_WIDGET(entry->label))) {
+			something_sensitive = TRUE;
+		}
+
+		g_signal_connect(G_OBJECT(entry->label), "show", G_CALLBACK(something_shown), menuitem);
+		g_signal_connect(G_OBJECT(entry->label), "hide", G_CALLBACK(something_hidden), menuitem);
+
+		g_signal_connect(G_OBJECT(entry->label), "notify::sensitive", G_CALLBACK(sensitive_cb), menuitem);
+	}
+	gtk_container_add(GTK_CONTAINER(menuitem), box);
+	gtk_widget_show(box);
+
+	if (entry->menu != NULL) {
+		gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(entry->menu));
+	}
+
+	incoming_position_t position;
+	position.objposition = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER));
+	position.entryposition = indicator_object_get_location(io, entry);
+	position.menupos = 0;
+	position.found = FALSE;
+
+	gtk_container_foreach(GTK_CONTAINER(menubar), place_in_menu, &position);
+
+	gtk_menu_shell_insert(GTK_MENU_SHELL(menubar), menuitem, position.menupos);
+
+	if (something_visible) {
+		if (entry->accessible_desc != NULL) {
+			update_accessible_desc(entry, menuitem);
+		}
+		gtk_widget_show(menuitem);
+	}
+	gtk_widget_set_sensitive(menuitem, something_sensitive);
+
+	g_object_set_data(G_OBJECT(menuitem), MENU_DATA_INDICATOR_ENTRY,  entry);
+	g_object_set_data(G_OBJECT(menuitem), MENU_DATA_INDICATOR_OBJECT, io);
+
+	return;
+}
+
+static void
+entry_removed_cb (GtkWidget * widget, gpointer userdata)
+{
+	gpointer data = g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY);
+
+	if (data != userdata) {
+		return;
+	}
+
+	IndicatorObjectEntry * entry = (IndicatorObjectEntry *)data;
+	if (entry->label != NULL) {
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->label), G_CALLBACK(something_shown), widget);
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->label), G_CALLBACK(something_hidden), widget);
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->label), G_CALLBACK(sensitive_cb), widget);
+	}
+	if (entry->image != NULL) {
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->image), G_CALLBACK(something_shown), widget);
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->image), G_CALLBACK(something_hidden), widget);
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->image), G_CALLBACK(sensitive_cb), widget);
+	}
+
+	gtk_widget_destroy(widget);
+	return;
+}
+
+static void
+entry_removed (IndicatorObject * io G_GNUC_UNUSED, IndicatorObjectEntry * entry,
+               gpointer user_data)
+{
+	g_debug("Signal: Entry Removed");
+
+	gtk_container_foreach(GTK_CONTAINER(user_data), entry_removed_cb, entry);
+
+	return;
+}
+
+static void
+entry_moved_find_cb (GtkWidget * widget, gpointer userdata)
+{
+	gpointer * array = (gpointer *)userdata;
+	if (array[1] != NULL) {
+		return;
+	}
+
+	gpointer data = g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY);
+
+	if (data != array[0]) {
+		return;
+	}
+
+	array[1] = widget;
+	return;
+}
+
+/* Gets called when an entry for an object was moved. */
+static void
+entry_moved (IndicatorObject * io, IndicatorObjectEntry * entry,
+             gint old G_GNUC_UNUSED, gint new G_GNUC_UNUSED, gpointer user_data)
+{
+	GtkWidget * menubar = GTK_WIDGET(user_data);
+
+	gpointer array[2];
+	array[0] = entry;
+	array[1] = NULL;
+
+	gtk_container_foreach(GTK_CONTAINER(menubar), entry_moved_find_cb, array);
+	if (array[1] == NULL) {
+		g_warning("Moving an entry that isn't in our menus.");
+		return;
+	}
+
+	GtkWidget * mi = GTK_WIDGET(array[1]);
+	g_object_ref(G_OBJECT(mi));
+	gtk_container_remove(GTK_CONTAINER(menubar), mi);
+
+	incoming_position_t position;
+	position.objposition = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER));
+	position.entryposition = indicator_object_get_location(io, entry);
+	position.menupos = 0;
+	position.found = FALSE;
+
+	gtk_container_foreach(GTK_CONTAINER(menubar), place_in_menu, &position);
+
+	gtk_menu_shell_insert(GTK_MENU_SHELL(menubar), mi, position.menupos);
+	g_object_unref(G_OBJECT(mi));
+
+	return;
+}
+
+static void
+menu_show (IndicatorObject * io, IndicatorObjectEntry * entry,<--- Parameter 'entry' can be declared with const
+           guint32 timestamp, gpointer user_data)
+{
+	GtkWidget * menubar = GTK_WIDGET(user_data);
+
+	if (entry == NULL) {
+		/* Close any open menus instead of opening one */
+		GList * entries = indicator_object_get_entries(io);
+		GList * iterator = NULL;
+		for (iterator = entries; iterator != NULL; iterator = g_list_next(iterator)) {
+			IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)iterator->data;
+			gtk_menu_popdown(entrydata->menu);
+		}
+		g_list_free(entries);
+
+		/* And tell the menubar to exit activation mode too */
+		gtk_menu_shell_cancel(GTK_MENU_SHELL(menubar));
+		return;
+	}
+
+	// TODO: do something sensible here
+}
+
+static void
+update_accessible_desc(IndicatorObjectEntry * entry, GtkWidget * menuitem)
+{
+	/* FIXME: We need to deal with the use case where the contents of the
+	   label overrides what is found in the atk object's name, or at least
+	   orca speaks the label instead of the atk object name.
+	 */
+	AtkObject * menuitem_obj = gtk_widget_get_accessible(menuitem);
+	if (menuitem_obj == NULL) {
+		/* Should there be an error printed here? */
+		return;
+	}
+
+	if (entry->accessible_desc != NULL) {
+		atk_object_set_name(menuitem_obj, entry->accessible_desc);
+	} else {
+		atk_object_set_name(menuitem_obj, "");
+	}
+	return;
+}
+
+static void
+load_indicator (MatePanelApplet *applet, GtkWidget * menubar, IndicatorObject *io, const gchar *name)
+{
+	/* Set the environment it's in */
+	indicator_object_set_environment(io, (const GStrv)indicator_env);
+
+	/* Attach the 'name' to the object */
+#if HAVE_AYATANA_INDICATOR_NG || HAVE_UBUNTU_INDICATOR_NG
+	int pos = 5000 - indicator_object_get_position(io);
+	if (pos > 5000) {
+		pos = name2order(name);
+	}
+#else
+	int pos = name2order(name);
+#endif
+
+	g_object_set_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER, GINT_TO_POINTER(pos));
+
+	/* Connect to its signals */
+	g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED,   G_CALLBACK(entry_added),    menubar);
+	g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED, G_CALLBACK(entry_removed),  menubar);
+	g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED,   G_CALLBACK(entry_moved),    menubar);
+	g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_MENU_SHOW,     G_CALLBACK(menu_show),      menubar);
+	g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE, G_CALLBACK(accessible_desc_update), menubar);
+
+	/* Track panel resize */
+	g_signal_connect_object(G_OBJECT(applet), "change-size", G_CALLBACK(entry_resized), G_OBJECT(io), 0);
+
+	/* Work on the entries */
+	GList * entries = indicator_object_get_entries(io);
+	GList * entry = NULL;
+
+	for (entry = entries; entry != NULL; entry = g_list_next(entry)) {
+		IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)entry->data;
+		entry_added(io, entrydata, menubar);
+	}
+
+	g_list_free(entries);
+}
+
+static gboolean
+load_module (const gchar * name, MatePanelApplet *applet, GtkWidget * menubar)
+{
+	g_debug("Looking at Module: %s", name);
+	g_return_val_if_fail(name != NULL, FALSE);
+
+	if (!g_str_has_suffix(name, G_MODULE_SUFFIX)) {
+		return FALSE;
+	}
+
+	g_debug("Loading Module: %s", name);
+
+	/* Build the object for the module */
+	gchar * fullpath = g_build_filename(INDICATOR_DIR, name, NULL);
+	IndicatorObject * io = indicator_object_new_from_file(fullpath);
+	g_free(fullpath);
+
+	load_indicator(applet, menubar, io, name);
+
+	return TRUE;
+}
+
+static void
+load_modules (MatePanelApplet *applet, GtkWidget *menubar, gint *indicators_loaded)
+{
+	if (g_file_test(INDICATOR_DIR, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) {
+		GDir * dir = g_dir_open(INDICATOR_DIR, 0, NULL);
+
+		const gchar * name;
+		gint count = 0;
+		while ((name = g_dir_read_name(dir)) != NULL) {
+#ifdef INDICATOR_APPLET_APPMENU
+			if (g_strcmp0(name, INDICATOR_SERVICE_APPMENU)) {
+				continue;
+			}
+#else
+			if (!g_strcmp0(name, INDICATOR_SERVICE_APPMENU)) {
+				continue;
+			}
+#endif
+#ifdef INDICATOR_APPLET
+			if (!g_strcmp0(name, INDICATOR_SERVICE_ME)) {
+				continue;
+			}
+			if (!g_strcmp0(name, INDICATOR_SERVICE_DATETIME)) {
+				continue;
+			}
+#endif
+			if (load_module(name, applet, menubar)) {
+				count++;
+			}
+		}
+
+		*indicators_loaded += count;
+
+		g_dir_close (dir);
+	}
+}
+
+#if HAVE_AYATANA_INDICATOR_NG || HAVE_UBUNTU_INDICATOR_NG
+
+static void
+load_indicators_from_indicator_files (MatePanelApplet *applet, GtkWidget *menubar, gint *indicators_loaded)
+{
+	GDir *dir;
+	const gchar *name;
+	GError *error = NULL;
+
+	dir = g_dir_open (INDICATOR_SERVICE_DIR, 0, &error);
+
+	if (!dir) {
+		g_warning ("unable to open indicator service file directory: %s", error->message);
+		g_error_free (error);
+
+		return;
+	}
+
+	gint count = 0;
+	while ((name = g_dir_read_name (dir))) {
+		gchar *filename;
+		IndicatorNg *indicator;
+
+		filename = g_build_filename (INDICATOR_SERVICE_DIR, name, NULL);
+		indicator = indicator_ng_new_for_profile (filename, "desktop", &error);
+		g_free (filename);
+
+#ifdef INDICATOR_APPLET_APPMENU
+		if (g_strcmp0(name, INDICATOR_SERVICE_APPMENU_NG)) {
+			continue;
+		}
+#else
+		if (!g_strcmp0(name, INDICATOR_SERVICE_APPMENU_NG)) {
+			continue;
+		}
+#endif
+#ifdef INDICATOR_APPLET
+		if (!g_strcmp0(name, INDICATOR_SERVICE_ME_NG)) {
+			continue;
+		}
+		if (!g_strcmp0(name, INDICATOR_SERVICE_DATETIME_NG)) {
+			continue;
+		}
+#endif
+
+		if (indicator) {
+			load_indicator(applet, menubar, INDICATOR_OBJECT (indicator), name);
+			count++;
+		}else{
+			g_warning ("unable to load '%s': %s", name, error->message);
+			g_clear_error (&error);
+		}
+	}
+
+	*indicators_loaded += count;
+
+	g_dir_close (dir);
+}
+#endif  /* HAVE_AYATANA_INDICATOR_NG || HAVE_UBUNTU_INDICATOR_NG */
+
+static void
+hotkey_filter (char * keystring G_GNUC_UNUSED, gpointer data)
+{
+	g_return_if_fail(GTK_IS_MENU_SHELL(data));
+
+	/* Oh, wow, it's us! */
+	GList * children = gtk_container_get_children(GTK_CONTAINER(data));
+	if (children == NULL) {
+		g_debug("Menubar has no children");
+		return;
+	}
+
+	gtk_menu_shell_select_item(GTK_MENU_SHELL(data), GTK_WIDGET(g_list_last(children)->data));
+	g_list_free(children);
+	return;
+}
+
+static gboolean
+menubar_press (GtkWidget * widget,
+                    GdkEventButton *event,
+                    gpointer data G_GNUC_UNUSED)
+{
+	if (event->button != 1) {
+		g_signal_stop_emission_by_name(widget, "button-press-event");
+	}
+
+	return FALSE;
+}
+
+static gboolean
+menubar_on_draw (GtkWidget * widget,
+                 cairo_t * cr,
+                 GtkWidget * menubar)
+{
+	/* FIXME: either port to gtk_render_focus or remove this function */
+	if (gtk_widget_has_focus(menubar))
+		gtk_paint_focus(gtk_widget_get_style(widget),
+		                cr,
+		                gtk_widget_get_state(menubar),
+		                widget, "menubar-applet", 0, 0, -1, -1);
+
+	return FALSE;
+}
+
+static void
+about_cb (GtkAction *action G_GNUC_UNUSED,
+          gpointer   data G_GNUC_UNUSED)
+{
+	static const gchar *authors[] = {
+		"Ted Gould <ted@canonical.com>",
+		NULL
+	};
+
+	static gchar *license[] = {
+        N_("This program is free software: you can redistribute it and/or modify it "
+           "under the terms of the GNU General Public License version 3, as published "
+           "by the Free Software Foundation."),
+        N_("This program is distributed in the hope that it will be useful, but "
+           "WITHOUT ANY WARRANTY; without even the implied warranties of "
+           "MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR "
+           "PURPOSE.  See the GNU General Public License for more details."),
+        N_("You should have received a copy of the GNU General Public License along "
+           "with this program.  If not, see <http://www.gnu.org/licenses/>."),
+		NULL
+	};
+	gchar *license_i18n;
+
+	license_i18n = g_strconcat (_(license[0]), "\n\n", _(license[1]), "\n\n", _(license[2]), NULL);
+
+	gtk_show_about_dialog(NULL,
+		"version", VERSION,
+		"copyright", _("Copyright \xc2\xa9 2009-2010 Canonical, Ltd.\n"
+		               "Copyright \xc2\xa9 2011-2021 MATE developers"),
+#ifdef INDICATOR_APPLET_APPMENU
+		"comments", _("An applet to hold your application menus."),
+#endif
+		"comments", _("An applet to hold all of the system indicators."),
+		"authors", authors,
+		"license", license_i18n,
+		"wrap-license", TRUE,
+		"translator-credits", _("translator-credits"),
+		"logo-icon-name", "mate-indicator-applet",
+		"icon-name", "mate-indicator-applet",
+		"website", "https://mate-desktop.org",
+		"website-label", _("MATE Website"),
+		NULL
+	);
+
+	g_free (license_i18n);
+
+	return;
+}
+
+static gboolean
+swap_orient_cb (GtkWidget *item, gpointer data)
+{
+	GtkWidget *from = (GtkWidget *) data;
+	GtkWidget *to = (GtkWidget *) g_object_get_data(G_OBJECT(from), "to");
+	g_object_ref(G_OBJECT(item));
+	gtk_container_remove(GTK_CONTAINER(from), item);
+	if (GTK_IS_LABEL(item)) {
+			switch(packdirection) {
+			case GTK_PACK_DIRECTION_LTR:
+				gtk_label_set_angle(GTK_LABEL(item), 0.0);
+				break;
+			case GTK_PACK_DIRECTION_TTB:
+				gtk_label_set_angle(GTK_LABEL(item),
+						(orient == MATE_PANEL_APPLET_ORIENT_LEFT) ?
+						270.0 : 90.0);
+				break;
+			default:
+				break;
+		}
+	}
+	gtk_box_pack_start(GTK_BOX(to), item, FALSE, FALSE, 0);
+	return TRUE;
+}
+
+static gboolean
+reorient_box_cb (GtkWidget *menuitem, gpointer data)
+{
+	GtkWidget *from = g_object_get_data(G_OBJECT(menuitem), "box");
+	GtkWidget *to = (packdirection == GTK_PACK_DIRECTION_LTR) ?
+		gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0) : gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+	g_object_set_data(G_OBJECT(from), "to", to);
+	gtk_container_foreach(GTK_CONTAINER(from), (GtkCallback)swap_orient_cb,
+			from);
+	gtk_container_remove(GTK_CONTAINER(menuitem), from);
+	gtk_container_add(GTK_CONTAINER(menuitem), to);
+	g_object_set_data(G_OBJECT(menuitem), "box", to);
+	gtk_widget_show_all(menuitem);
+	return TRUE;
+}
+
+static gboolean
+matepanelapplet_reorient_cb (GtkWidget *applet, MatePanelAppletOrient neworient,
+		gpointer data)
+{
+	GtkWidget *menubar = (GtkWidget *)data;
+	if ((((neworient == MATE_PANEL_APPLET_ORIENT_UP) ||
+			(neworient == MATE_PANEL_APPLET_ORIENT_DOWN)) &&
+			((orient == MATE_PANEL_APPLET_ORIENT_LEFT) ||
+			(orient == MATE_PANEL_APPLET_ORIENT_RIGHT))) ||
+			(((neworient == MATE_PANEL_APPLET_ORIENT_LEFT) ||
+			(neworient == MATE_PANEL_APPLET_ORIENT_RIGHT)) &&
+			((orient == MATE_PANEL_APPLET_ORIENT_UP) ||
+			(orient == MATE_PANEL_APPLET_ORIENT_DOWN)))) {
+		packdirection = (packdirection == GTK_PACK_DIRECTION_LTR) ?
+				GTK_PACK_DIRECTION_TTB : GTK_PACK_DIRECTION_LTR;
+		gtk_menu_bar_set_pack_direction(GTK_MENU_BAR(menubar),
+				packdirection);
+		orient = neworient;
+		gtk_container_foreach(GTK_CONTAINER(menubar),
+				(GtkCallback)reorient_box_cb, NULL);
+	}
+	orient = neworient;
+	return FALSE;
+}
+
+#ifdef N_
+#undef N_
+#endif
+#define N_(x) x
+
+static void
+log_to_file_cb (GObject * source_obj G_GNUC_UNUSED,
+                GAsyncResult * result G_GNUC_UNUSED, gpointer user_data)
+{
+	g_free(user_data);
+	return;
+}
+
+static void
+log_to_file (const gchar * domain G_GNUC_UNUSED,
+             GLogLevelFlags level G_GNUC_UNUSED,
+             const gchar * message,
+             gpointer data G_GNUC_UNUSED)
+{
+	if (log_file == NULL) {
+		GError * error = NULL;
+		gchar * filename = g_build_filename(g_get_user_cache_dir(), LOG_FILE_NAME, NULL);
+		GFile * file = g_file_new_for_path(filename);
+		g_free(filename);
+
+		if (!g_file_test(g_get_user_cache_dir(), G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
+			GFile * cachedir = g_file_new_for_path(g_get_user_cache_dir());
+			g_file_make_directory_with_parents(cachedir, NULL, &error);
+
+			if (error != NULL) {
+				g_error("Unable to make directory '%s' for log file: %s", g_get_user_cache_dir(), error->message);
+			}
+		}
+
+		g_file_delete(file, NULL, NULL);
+
+		GFileIOStream * io = g_file_create_readwrite(file,
+		                          G_FILE_CREATE_REPLACE_DESTINATION, /* flags */
+		                          NULL, /* cancelable */
+		                          &error); /* error */
+		if (error != NULL) {
+			g_error("Unable to replace file: %s", error->message);
+		}
+
+		log_file = g_io_stream_get_output_stream(G_IO_STREAM(io));
+	}
+
+	gchar * outputstring = g_strdup_printf("%s\n", message);
+	g_output_stream_write_async(log_file,
+	                            outputstring, /* data */
+	                            strlen(outputstring), /* length */
+	                            G_PRIORITY_LOW, /* priority */
+	                            NULL, /* cancelable */
+	                            log_to_file_cb, /* callback */
+	                            outputstring); /* data */
+
+	return;
+}
+
+static gboolean
+applet_fill_cb (MatePanelApplet * applet, const gchar * iid G_GNUC_UNUSED,
+                gpointer data G_GNUC_UNUSED)
+{
+#if HAVE_AYATANA_INDICATOR_NG || HAVE_UBUNTU_INDICATOR_NG
+	ido_init();
+#endif
+
+	static const GtkActionEntry menu_actions[] = {
+		{"About", "help-about", N_("_About"), NULL, NULL, G_CALLBACK(about_cb)}
+	};
+	static const gchar *menu_xml = "<menuitem name=\"About\" action=\"About\"/>";
+
+	static gboolean first_time = FALSE;
+	GtkWidget *menubar;
+	gint indicators_loaded = 0;
+	GtkActionGroup *action_group;
+
+	if (!first_time)
+	{
+		first_time = TRUE;
+#ifdef INDICATOR_APPLET
+		g_set_application_name(_("Indicator Applet"));
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+		g_set_application_name(_("Indicator Applet Complete"));
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+		g_set_application_name(_("Indicator Applet Application Menu"));
+#endif
+
+		g_log_set_default_handler(log_to_file, NULL);
+
+		tomboy_keybinder_init();
+	}
+
+	/* Set panel options */
+	gtk_container_set_border_width(GTK_CONTAINER (applet), 0);
+	mate_panel_applet_set_flags(applet, MATE_PANEL_APPLET_EXPAND_MINOR);
+	menubar = gtk_menu_bar_new();
+	action_group = gtk_action_group_new ("Indicator Applet Actions");
+	gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+	gtk_action_group_add_actions (action_group, menu_actions,
+	                              G_N_ELEMENTS (menu_actions),
+	                              menubar);
+	mate_panel_applet_setup_menu(applet, menu_xml, action_group);
+	g_object_unref(action_group);
+#ifdef INDICATOR_APPLET
+	atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)),
+	                     "indicator-applet");
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+	atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)),
+	                     "indicator-applet-complete");
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+	atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)),
+	                     "indicator-applet-appmenu");
+#endif
+
+	/* Init some theme/icon stuff */
+	gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(),
+	                                  INDICATOR_ICONS_DIR);
+	/* g_debug("Icons directory: %s", INDICATOR_ICONS_DIR); */
+	gtk_widget_set_name(GTK_WIDGET (applet), "fast-user-switch-applet");
+
+	/* Build menubar */
+	size = (mate_panel_applet_get_size (applet));
+	orient = (mate_panel_applet_get_orient(applet));
+	packdirection = ((orient == MATE_PANEL_APPLET_ORIENT_UP) ||
+			(orient == MATE_PANEL_APPLET_ORIENT_DOWN)) ?
+			GTK_PACK_DIRECTION_LTR : GTK_PACK_DIRECTION_TTB;
+	gtk_menu_bar_set_pack_direction(GTK_MENU_BAR(menubar),
+			packdirection);
+	gtk_widget_set_can_focus (menubar, TRUE);
+	gtk_widget_set_name(GTK_WIDGET (menubar), "fast-user-switch-menubar");
+	g_signal_connect(menubar, "button-press-event", G_CALLBACK(menubar_press), NULL);
+	g_signal_connect_after(menubar, "draw", G_CALLBACK(menubar_on_draw), menubar);
+	g_signal_connect(applet, "change-orient",
+			G_CALLBACK(matepanelapplet_reorient_cb), menubar);
+	gtk_container_set_border_width(GTK_CONTAINER(menubar), 0);
+
+	/* Add in filter func */
+	tomboy_keybinder_bind(hotkey_keycode, hotkey_filter, menubar);
+
+	load_modules(applet, menubar, &indicators_loaded);
+#if HAVE_AYATANA_INDICATOR_NG || HAVE_UBUNTU_INDICATOR_NG
+	load_indicators_from_indicator_files(applet, menubar, &indicators_loaded);
+#endif
+
+	if (indicators_loaded == 0) {
+		/* A label to allow for click through */
+		GtkWidget * item = gtk_label_new(_("No Indicators"));
+		mate_panel_applet_set_background_widget(applet, item);
+		gtk_container_add(GTK_CONTAINER(applet), item);
+		gtk_widget_show(item);
+	} else {
+		gtk_container_add(GTK_CONTAINER(applet), menubar);
+		mate_panel_applet_set_background_widget(applet, menubar);
+		gtk_widget_show(menubar);
+	}
+
+	gtk_widget_show(GTK_WIDGET(applet));
+
+	return TRUE;
+
+}
+
+
+
+
+ + + diff --git a/2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/1.html b/2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/1.html new file mode 100644 index 0000000..6e484d7 --- /dev/null +++ b/2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/1.html @@ -0,0 +1,1229 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
/* eggaccelerators.c
+ * Copyright (C) 2002  Red Hat, Inc.; Copyright 1998, 2001 Tim Janik
+ * Developed by Havoc Pennington, Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+
+#include "eggaccelerators.h"
+
+#include <string.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
+
+enum
+{
+  EGG_MODMAP_ENTRY_SHIFT   = 0,
+  EGG_MODMAP_ENTRY_LOCK    = 1,
+  EGG_MODMAP_ENTRY_CONTROL = 2,
+  EGG_MODMAP_ENTRY_MOD1    = 3,
+  EGG_MODMAP_ENTRY_MOD2    = 4,
+  EGG_MODMAP_ENTRY_MOD3    = 5,
+  EGG_MODMAP_ENTRY_MOD4    = 6,
+  EGG_MODMAP_ENTRY_MOD5    = 7,
+  EGG_MODMAP_ENTRY_LAST    = 8
+};
+
+#define MODMAP_ENTRY_TO_MODIFIER(x) (1 << (x))
+
+typedef struct
+{
+  EggVirtualModifierType mapping[EGG_MODMAP_ENTRY_LAST];
+
+} EggModmap;
+
+const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap);
+
+static inline gboolean
+is_alt (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'a' || string[1] == 'A') &&
+	  (string[2] == 'l' || string[2] == 'L') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_ctl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_modx (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'd' || string[3] == 'D') &&
+	  (string[4] >= '1' && string[4] <= '5') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_ctrl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'r' || string[3] == 'R') &&
+	  (string[4] == 'l' || string[4] == 'L') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shft (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'f' || string[3] == 'F') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shift (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'i' || string[3] == 'I') &&
+	  (string[4] == 'f' || string[4] == 'F') &&
+	  (string[5] == 't' || string[5] == 'T') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_control (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'n' || string[3] == 'N') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == 'o' || string[6] == 'O') &&
+	  (string[7] == 'l' || string[7] == 'L') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_release (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'r' || string[1] == 'R') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'a' || string[5] == 'A') &&
+	  (string[6] == 's' || string[6] == 'S') &&
+	  (string[7] == 'e' || string[7] == 'E') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_meta (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == 'a' || string[4] == 'A') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_super (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'u' || string[2] == 'U') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_hyper (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'h' || string[1] == 'H') &&
+	  (string[2] == 'y' || string[2] == 'Y') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+/**
+ * egg_accelerator_parse_virtual:
+ * @accelerator:      string representing an accelerator
+ * @accelerator_key:  return location for accelerator keyval
+ * @accelerator_mods: return location for accelerator modifier mask
+ *
+ * Parses a string representing a virtual accelerator. The format
+ * looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1" or
+ * "&lt;Release&gt;z" (the last one is for key release).  The parser
+ * is fairly liberal and allows lower or upper case, and also
+ * abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;".
+ *
+ * If the parse fails, @accelerator_key and @accelerator_mods will
+ * be set to 0 (zero) and %FALSE will be returned. If the string contains
+ * only modifiers, @accelerator_key will be set to 0 but %TRUE will be
+ * returned.
+ *
+ * The virtual vs. concrete accelerator distinction is a relic of
+ * how the X Window System works; there are modifiers Mod2-Mod5 that
+ * can represent various keyboard keys (numlock, meta, hyper, etc.),
+ * the virtual modifier represents the keyboard key, the concrete
+ * modifier the actual Mod2-Mod5 bits in the key press event.
+ *
+ * Returns: %TRUE on success.
+ */
+gboolean
+egg_accelerator_parse_virtual (const gchar            *accelerator,
+                               guint                  *accelerator_key,
+                               EggVirtualModifierType *accelerator_mods)
+{
+  guint keyval;
+  GdkModifierType mods;
+  gint len;
+  gboolean bad_keyval;
+
+  if (accelerator_key)
+    *accelerator_key = 0;
+  if (accelerator_mods)
+    *accelerator_mods = 0;
+
+  g_return_val_if_fail (accelerator != NULL, FALSE);
+
+  bad_keyval = FALSE;
+
+  keyval = 0;
+  mods = 0;
+  len = strlen (accelerator);
+  while (len)
+    {
+      if (*accelerator == '<')
+	{
+	  if (len >= 9 && is_release (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_RELEASE_MASK;
+	    }
+	  else if (len >= 9 && is_control (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 7 && is_shift (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_shft (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_ctrl (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 6 && is_modx (accelerator))
+	    {
+	      static const guint mod_vals[] = {
+		EGG_VIRTUAL_ALT_MASK, EGG_VIRTUAL_MOD2_MASK, EGG_VIRTUAL_MOD3_MASK,
+		EGG_VIRTUAL_MOD4_MASK, EGG_VIRTUAL_MOD5_MASK
+	      };
+
+	      len -= 6;
+	      accelerator += 4;
+	      mods |= mod_vals[*accelerator - '1'];
+	      accelerator += 2;
+	    }
+	  else if (len >= 5 && is_ctl (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 5 && is_alt (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_ALT_MASK;
+	    }
+          else if (len >= 6 && is_meta (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_META_MASK;
+	    }
+          else if (len >= 7 && is_hyper (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_HYPER_MASK;
+	    }
+          else if (len >= 7 && is_super (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SUPER_MASK;
+	    }
+	  else
+	    {
+	      gchar last_ch;
+
+	      last_ch = *accelerator;
+	      while (last_ch && last_ch != '>')
+		{
+		  last_ch = *accelerator;
+		  accelerator += 1;
+		  len -= 1;
+		}
+	    }
+	}
+      else
+	{
+          keyval = gdk_keyval_from_name (accelerator);
+
+          if (keyval == 0)
+            bad_keyval = TRUE;
+
+          accelerator += len;
+          len -= len;
+	}
+    }
+
+  if (accelerator_key)
+    *accelerator_key = gdk_keyval_to_lower (keyval);
+  if (accelerator_mods)
+    *accelerator_mods = mods;
+
+  return !bad_keyval;
+}
+
+void
+egg_keymap_resolve_virtual_modifiers (GdkKeymap              *keymap,
+                                      EggVirtualModifierType  virtual_mods,
+                                      GdkModifierType        *concrete_mods)
+{
+  GdkModifierType concrete;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (concrete_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  concrete = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if (modmap->mapping[i] & virtual_mods)
+        concrete |= (1 << i);
+
+      ++i;
+    }
+
+  *concrete_mods = concrete;
+}
+
+void
+egg_keymap_virtualize_modifiers (GdkKeymap              *keymap,
+                                 GdkModifierType         concrete_mods,
+                                 EggVirtualModifierType *virtual_mods)
+{
+  GdkModifierType virtual;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (virtual_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  virtual = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if ((1 << i) & concrete_mods)
+        {
+          EggVirtualModifierType cleaned;
+
+          cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK |
+                                           EGG_VIRTUAL_MOD3_MASK |
+                                           EGG_VIRTUAL_MOD4_MASK |
+                                           EGG_VIRTUAL_MOD5_MASK);
+
+          if (cleaned != 0)
+            {
+              virtual |= cleaned;
+            }
+          else
+            {
+              /* Rather than dropping mod2->mod5 if not bound,
+               * go ahead and use the concrete names
+               */
+              virtual |= modmap->mapping[i];
+            }
+        }
+
+      ++i;
+    }
+
+  *virtual_mods = virtual;
+}
+
+static void
+reload_modmap (GdkKeymap *keymap,
+               EggModmap *modmap)
+{
+  XModifierKeymap *xmodmap;
+  int map_size;
+  int i;
+
+  /* FIXME multihead */
+  xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ());
+
+  memset (modmap->mapping, 0, sizeof (modmap->mapping));
+
+  /* there are 8 modifiers, and the first 3 are shift, shift lock,
+   * and control
+   */
+  map_size = 8 * xmodmap->max_keypermod;
+  i = 3 * xmodmap->max_keypermod;
+  while (i < map_size)
+    {
+      /* get the key code at this point in the map,
+       * see if its keysym is one we're interested in
+       */
+      int keycode = xmodmap->modifiermap[i];
+      GdkKeymapKey *keys;
+      guint *keyvals;
+      int n_entries;
+      int j;
+      EggVirtualModifierType mask;
+
+      keys = NULL;
+      keyvals = NULL;
+      n_entries = 0;
+
+      gdk_keymap_get_entries_for_keycode (keymap,
+                                          keycode,
+                                          &keys, &keyvals, &n_entries);
+
+      mask = 0;
+      j = 0;
+      while (j < n_entries)
+        {
+          if (keyvals[j] == GDK_KEY_Num_Lock)
+            mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Scroll_Lock)
+            mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Meta_L ||
+                   keyvals[j] == GDK_KEY_Meta_R)
+            mask |= EGG_VIRTUAL_META_MASK;
+          else if (keyvals[j] == GDK_KEY_Hyper_L ||
+                   keyvals[j] == GDK_KEY_Hyper_R)
+            mask |= EGG_VIRTUAL_HYPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Super_L ||
+                   keyvals[j] == GDK_KEY_Super_R)
+            mask |= EGG_VIRTUAL_SUPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Mode_switch)
+            mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
+
+          ++j;
+        }
+
+      /* Mod1Mask is 1 << 3 for example, i.e. the
+       * fourth modifier, i / keyspermod is the modifier
+       * index
+       */
+      modmap->mapping[i/xmodmap->max_keypermod] |= mask;
+
+      g_free (keyvals);
+      g_free (keys);
+
+      ++i;
+    }
+
+  /* Add in the not-really-virtual fixed entries */
+  modmap->mapping[EGG_MODMAP_ENTRY_SHIFT] |= EGG_VIRTUAL_SHIFT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_CONTROL] |= EGG_VIRTUAL_CONTROL_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_LOCK] |= EGG_VIRTUAL_LOCK_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD1] |= EGG_VIRTUAL_ALT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD2] |= EGG_VIRTUAL_MOD2_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK;
+
+  XFreeModifiermap (xmodmap);
+}
+
+const EggModmap*
+egg_keymap_get_modmap (GdkKeymap *keymap)
+{
+  EggModmap *modmap;
+
+  /* This is all a hack, much simpler when we can just
+   * modify GDK directly.
+   */
+
+  modmap = g_object_get_data (G_OBJECT (keymap),
+                              "egg-modmap");
+
+  if (modmap == NULL)
+    {
+      modmap = g_new0 (EggModmap, 1);
+
+      /* FIXME modify keymap change events with an event filter
+       * and force a reload if we get one
+       */
+
+      reload_modmap (keymap, modmap);
+
+      g_object_set_data_full (G_OBJECT (keymap),
+                              "egg-modmap",
+                              modmap,
+                              g_free);
+    }
+
+  g_assert (modmap != NULL);
+
+  return modmap;
+}
+
+
+
+
+ + + diff --git a/2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/2.html b/2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/2.html new file mode 100644 index 0000000..808ce42 --- /dev/null +++ b/2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/2.html @@ -0,0 +1,857 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
/* tomboykeybinder.c
+ * Copyright (C) 2008 Novell
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+#include <string.h>
+
+#include <gdk/gdk.h>
+#include <gdk/gdkwindow.h>
+#include <gdk/gdkx.h>
+#include <X11/Xlib.h>
+
+#include "eggaccelerators.h"
+#include "tomboykeybinder.h"
+
+/* Uncomment the next line to print a debug trace. */
+/* #define DEBUG */
+
+#ifdef DEBUG
+#  define TRACE(x) x
+#else
+#  define TRACE(x) do {} while (FALSE);
+#endif
+
+typedef struct _Binding {
+	TomboyBindkeyHandler  handler;
+	gpointer              user_data;
+	char                 *keystring;
+	uint                  keycode;
+	uint                  modifiers;
+} Binding;
+
+static GSList *bindings = NULL;
+static guint32 last_event_time = 0;
+static gboolean processing_event = FALSE;
+
+static guint num_lock_mask, caps_lock_mask, scroll_lock_mask;
+
+static void
+lookup_ignorable_modifiers (GdkKeymap *keymap)
+{
+	egg_keymap_resolve_virtual_modifiers (keymap,
+					      EGG_VIRTUAL_LOCK_MASK,
+					      &caps_lock_mask);
+
+	egg_keymap_resolve_virtual_modifiers (keymap,
+					      EGG_VIRTUAL_NUM_LOCK_MASK,
+					      &num_lock_mask);
+
+	egg_keymap_resolve_virtual_modifiers (keymap,
+					      EGG_VIRTUAL_SCROLL_LOCK_MASK,
+					      &scroll_lock_mask);
+}
+
+static void
+grab_ungrab_with_ignorable_modifiers (GdkWindow *rootwin,
+				      Binding   *binding,
+				      gboolean   grab)
+{
+	guint mod_masks [] = {
+		0, /* modifier only */
+		num_lock_mask,
+		caps_lock_mask,
+		scroll_lock_mask,
+		num_lock_mask  | caps_lock_mask,
+		num_lock_mask  | scroll_lock_mask,
+		caps_lock_mask | scroll_lock_mask,
+		num_lock_mask  | caps_lock_mask | scroll_lock_mask,
+	};
+	guint i;
+
+	for (i = 0; i < G_N_ELEMENTS (mod_masks); i++) {
+		if (grab) {
+			XGrabKey (GDK_WINDOW_XDISPLAY (rootwin),
+				  binding->keycode,
+				  binding->modifiers | mod_masks [i],
+				  GDK_WINDOW_XID (rootwin),
+				  False,
+				  GrabModeAsync,
+				  GrabModeAsync);
+		} else {
+			XUngrabKey (GDK_WINDOW_XDISPLAY (rootwin),
+				    binding->keycode,
+				    binding->modifiers | mod_masks [i],
+				    GDK_WINDOW_XID (rootwin));
+		}
+	}
+}
+
+static gboolean
+do_grab_key (Binding *binding)
+{
+	GdkDisplay *gdk_display = gdk_display_get_default ();
+	GdkKeymap *keymap = gdk_keymap_get_for_display (gdk_display);
+	GdkWindow *rootwin = gdk_get_default_root_window ();
+
+	EggVirtualModifierType virtual_mods = 0;
+	guint keysym = 0;
+
+	if (keymap == NULL || rootwin == NULL)
+		return FALSE;
+
+	if (!egg_accelerator_parse_virtual (binding->keystring,
+					    &keysym,
+					    &virtual_mods))
+		return FALSE;
+
+	TRACE (g_print ("Got accel %d, %d\n", keysym, virtual_mods));
+
+	binding->keycode = XKeysymToKeycode (GDK_WINDOW_XDISPLAY (rootwin),
+					     keysym);
+	if (binding->keycode == 0)
+		return FALSE;
+
+	TRACE (g_print ("Got keycode %d\n", binding->keycode));
+
+	egg_keymap_resolve_virtual_modifiers (keymap,
+					      virtual_mods,
+					      &binding->modifiers);
+	if (binding->modifiers == 0)
+		return FALSE;
+
+	TRACE (g_print ("Got modmask %d\n", binding->modifiers));
+
+	gdk_x11_display_error_trap_push (gdk_display);
+
+	grab_ungrab_with_ignorable_modifiers (rootwin,
+					      binding,
+					      TRUE /* grab */);
+
+	gdk_display_flush (gdk_display);
+
+	if (gdk_x11_display_error_trap_pop (gdk_display)) {
+	   g_warning ("Binding '%s' failed!\n", binding->keystring);
+	   return FALSE;
+	}
+
+	return TRUE;
+}
+
+static gboolean
+do_ungrab_key (Binding *binding)
+{
+	GdkWindow *rootwin = gdk_get_default_root_window ();
+
+	TRACE (g_print ("Removing grab for '%s'\n", binding->keystring));
+
+	grab_ungrab_with_ignorable_modifiers (rootwin,
+					      binding,
+					      FALSE /* ungrab */);
+
+	return TRUE;
+}
+
+static GdkFilterReturn
+filter_func (GdkXEvent *gdk_xevent, GdkEvent *event G_GNUC_UNUSED,
+             gpointer data G_GNUC_UNUSED)
+{
+	GdkFilterReturn return_val = GDK_FILTER_CONTINUE;
+	XEvent *xevent = (XEvent *) gdk_xevent;
+	guint event_mods;
+	GSList *iter;
+
+	TRACE (g_print ("Got Event! %d, %d\n", xevent->type, event->type));
+
+	switch (xevent->type) {
+	case KeyPress:
+		TRACE (g_print ("Got KeyPress! keycode: %d, modifiers: %d\n",
+				xevent->xkey.keycode,
+				xevent->xkey.state));
+
+		/*
+		 * Set the last event time for use when showing
+		 * windows to avoid anti-focus-stealing code.
+		 */
+		processing_event = TRUE;
+		last_event_time = xevent->xkey.time;
+
+		event_mods = xevent->xkey.state & ~(num_lock_mask  |
+						    caps_lock_mask |
+						    scroll_lock_mask);
+
+		for (iter = bindings; iter != NULL; iter = iter->next) {
+			Binding *binding = (Binding *) iter->data;
+
+			if (binding->keycode == xevent->xkey.keycode &&
+			    binding->modifiers == event_mods) {
+
+				TRACE (g_print ("Calling handler for '%s'...\n",
+						binding->keystring));
+
+				(binding->handler) (binding->keystring,
+						    binding->user_data);
+			}
+		}
+
+		processing_event = FALSE;
+		break;
+	case KeyRelease:
+		TRACE (g_print ("Got KeyRelease! \n"));
+		break;
+	}
+
+	return return_val;
+}
+
+static void
+keymap_changed (GdkKeymap *map G_GNUC_UNUSED)
+{
+	GdkKeymap *keymap = gdk_keymap_get_for_display (gdk_display_get_default ());
+	GSList *iter;
+
+	TRACE (g_print ("Keymap changed! Regrabbing keys..."));
+
+	for (iter = bindings; iter != NULL; iter = iter->next) {
+		Binding *binding = (Binding *) iter->data;
+		do_ungrab_key (binding);
+	}
+
+	lookup_ignorable_modifiers (keymap);
+
+	for (iter = bindings; iter != NULL; iter = iter->next) {
+		Binding *binding = (Binding *) iter->data;
+		do_grab_key (binding);
+	}
+}
+
+void
+tomboy_keybinder_init (void)
+{
+	GdkKeymap *keymap = gdk_keymap_get_for_display (gdk_display_get_default ());
+	GdkWindow *rootwin = gdk_get_default_root_window ();
+
+	lookup_ignorable_modifiers (keymap);
+
+	gdk_window_add_filter (rootwin,
+			       filter_func,
+			       NULL);
+
+	g_signal_connect (keymap,
+			  "keys_changed",
+			  G_CALLBACK (keymap_changed),
+			  NULL);
+}
+
+void
+tomboy_keybinder_bind (const char           *keystring,
+		       TomboyBindkeyHandler  handler,
+		       gpointer              user_data)
+{
+	Binding *binding;
+	gboolean success;
+
+	binding = g_new0 (Binding, 1);
+	binding->keystring = g_strdup (keystring);
+	binding->handler = handler;
+	binding->user_data = user_data;
+
+	/* Sets the binding's keycode and modifiers */
+	success = do_grab_key (binding);
+
+	if (success) {
+		bindings = g_slist_prepend (bindings, binding);
+	} else {
+		g_free (binding->keystring);
+		g_free (binding);
+	}
+}
+
+void
+tomboy_keybinder_unbind (const char           *keystring,
+			 TomboyBindkeyHandler  handler)<--- Parameter 'handler' can be declared with const
+{
+	GSList *iter;
+
+	for (iter = bindings; iter != NULL; iter = iter->next) {
+		Binding *binding = (Binding *) iter->data;
+
+		if (strcmp (keystring, binding->keystring) != 0 ||
+		    handler != binding->handler)
+			continue;
+
+		do_ungrab_key (binding);
+
+		bindings = g_slist_remove (bindings, binding);
+
+		g_free (binding->keystring);
+		g_free (binding);
+		break;
+	}
+}
+
+/*
+ * From eggcellrenderkeys.c.
+ */
+gboolean
+tomboy_keybinder_is_modifier (guint keycode)
+{
+	gint i;
+	gint map_size;
+	XModifierKeymap *mod_keymap;
+	gboolean retval = FALSE;
+
+	mod_keymap = XGetModifierMapping (gdk_x11_get_default_xdisplay());
+
+	map_size = 8 * mod_keymap->max_keypermod;
+
+	i = 0;
+	while (i < map_size) {
+		if (keycode == mod_keymap->modifiermap[i]) {
+			retval = TRUE;
+			break;
+		}
+		++i;
+	}
+
+	XFreeModifiermap (mod_keymap);
+
+	return retval;
+}
+
+guint32
+tomboy_keybinder_get_current_event_time (void)
+{
+	if (processing_event)
+		return last_event_time;
+	else
+		return GDK_CURRENT_TIME;
+}
+
+
+
+
+ + + diff --git a/2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/index.html b/2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/index.html new file mode 100644 index 0000000..bda6fb2 --- /dev/null +++ b/2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/index.html @@ -0,0 +1,122 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+ + + + + + + + + + + +
LineIdCWESeverityMessage
missingIncludeSysteminformationCppcheck cannot find all the include files (use --check-config for details)
src/applet-main.c
536constParameter398styleParameter 'entry' can be declared with const
src/eggaccelerators.c
321duplicateExpression398styleSame expression on both sides of '-='.
src/tomboykeybinder.c
284constParameter398styleParameter 'handler' can be declared with const
+
+
+ + + diff --git a/2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/stats.html b/2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/stats.html new file mode 100644 index 0000000..3074784 --- /dev/null +++ b/2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/stats.html @@ -0,0 +1,107 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+

Top 10 files for style severity, total findings: 3
+   1  src/tomboykeybinder.c
+   1  src/eggaccelerators.c
+   1  src/applet-main.c
+

+ +
+
+ + + diff --git a/2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/style.css b/2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-11-20-205656-2651-cppcheck@42e8a0e39a1f_master/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/0.html b/2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/0.html new file mode 100644 index 0000000..d57f9d5 --- /dev/null +++ b/2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/0.html @@ -0,0 +1,2381 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
/*
+A small wrapper utility to load indicators and put them as menu items
+into the mate-panel using it's applet interface.
+
+Copyright 2009-2010 Canonical Ltd.
+
+Authors:
+    Ted Gould <ted@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+#include <string.h>
+#include <config.h>
+#include <glib/gi18n.h>
+#include <mate-panel-applet.h>
+#include <gdk/gdkkeysyms.h>
+#include <gtk/gtk.h>
+
+#if HAVE_UBUNTU_INDICATOR
+
+#define INDICATOR_SERVICE_APPMENU	"libappmenu.so"
+#define INDICATOR_SERVICE_ME		"libme.so"
+#define INDICATOR_SERVICE_DATETIME	"libdatetime.so"
+
+#define INDICATOR_SERVICE_APPMENU_NG	"com.canonical.indicator.appmenu"
+#define INDICATOR_SERVICE_ME_NG		"com.canonical.indicator.me"
+#define INDICATOR_SERVICE_DATETIME_NG	"com.canonical.indicator.datetime"
+
+#include <libindicator/indicator-object.h>
+#endif
+
+#if HAVE_AYATANA_INDICATOR
+
+#define INDICATOR_SERVICE_APPMENU	"libayatana-appmenu.so"
+#define INDICATOR_SERVICE_ME		"libayatana-me.so"
+#define INDICATOR_SERVICE_DATETIME	"libayatana-datetime.so"
+
+#define INDICATOR_SERVICE_APPMENU_NG	"org.ayatana.indicator.appmenu"
+#define INDICATOR_SERVICE_ME_NG		"org.ayatana.indicator.me"
+#define INDICATOR_SERVICE_DATETIME_NG	"org.ayatana.indicator.datetime"
+
+#include <libayatana-indicator/indicator-object.h>
+#endif
+
+/* For new style indicators */
+
+#if HAVE_UBUNTU_INDICATOR && HAVE_UBUNTU_INDICATOR_NG
+
+#include <libido/libido.h>
+#include <libindicator/indicator-ng.h>
+
+#define INDICATOR_SERVICE_DIR "/usr/share/unity/indicators"
+
+#endif
+
+#if HAVE_AYATANA_INDICATOR && HAVE_AYATANA_INDICATOR_NG
+
+#include <libayatana-ido/libayatana-ido.h>
+#include <libayatana-indicator/indicator-ng.h>
+
+#define INDICATOR_SERVICE_DIR "/usr/share/ayatana/indicators"
+
+#endif
+
+#include "tomboykeybinder.h"
+
+static gchar * indicator_order[] = {
+#if HAVE_UBUNTU_INDICATOR
+	"libapplication.so",
+	"libmessaging.so",
+	"libsoundmenu.so",
+	"libdatetime.so",
+	"libsession.so",
+#endif
+#if HAVE_AYATANA_INDICATOR
+	"libayatana-application.so",
+	"libayatana-messaging.so",
+	"libayatana-soundmenu.so",
+	"libayatana-datetime.so",
+	"libayatana-session.so",
+#endif
+	NULL
+};
+
+static GtkPackDirection packdirection;
+static MatePanelAppletOrient orient;
+static guint size;
+
+#define  MENU_DATA_INDICATOR_OBJECT  "indicator-object"
+#define  MENU_DATA_INDICATOR_ENTRY   "indicator-entry"
+
+#define  IO_DATA_ORDER_NUMBER        "indicator-order-number"
+
+static gboolean     applet_fill_cb (MatePanelApplet * applet, const gchar * iid, gpointer data);
+
+static void update_accessible_desc (IndicatorObjectEntry * entry, GtkWidget * menuitem);
+
+/*************
+ * main
+ * ***********/
+
+#ifdef INDICATOR_APPLET
+MATE_PANEL_APPLET_OUT_PROCESS_FACTORY ("IndicatorAppletFactory",
+               PANEL_TYPE_APPLET,
+               "indicator-applet",
+               applet_fill_cb, NULL);
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+MATE_PANEL_APPLET_OUT_PROCESS_FACTORY ("IndicatorAppletCompleteFactory",
+               PANEL_TYPE_APPLET,
+               "indicator-applet-complete",
+               applet_fill_cb, NULL);
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+MATE_PANEL_APPLET_OUT_PROCESS_FACTORY ("IndicatorAppletAppmenuFactory",
+               PANEL_TYPE_APPLET,
+               "indicator-applet-appmenu",
+               applet_fill_cb, NULL);
+#endif
+
+/*************
+ * log files
+ * ***********/
+#ifdef INDICATOR_APPLET
+#define LOG_FILE_NAME  "indicator-applet.log"
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+#define LOG_FILE_NAME  "indicator-applet-complete.log"
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+#define LOG_FILE_NAME  "indicator-applet-appmenu.log"
+#endif
+GOutputStream * log_file = NULL;
+
+/*****************
+ * Hotkey support
+ * **************/
+#ifdef INDICATOR_APPLET
+gchar * hotkey_keycode = "<Super>M";
+#endif
+#ifdef INDICATOR_APPLET_SESSION
+gchar * hotkey_keycode = "<Super>S";
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+gchar * hotkey_keycode = "<Super>S";
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+gchar * hotkey_keycode = "<Super>F1";
+#endif
+
+/********************
+ * Environment Names
+ * *******************/
+#ifdef INDICATOR_APPLET
+#define INDICATOR_SPECIFIC_ENV  "indicator-applet-original"
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+#define INDICATOR_SPECIFIC_ENV  "indicator-applet-complete"
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+#define INDICATOR_SPECIFIC_ENV  "indicator-applet-appmenu"
+#endif
+
+static const gchar * indicator_env[] = {
+	"indicator-applet",
+	INDICATOR_SPECIFIC_ENV,
+	NULL
+};
+
+/*************
+ * init function
+ * ***********/
+
+static gint
+name2order (const gchar * name) {
+	int i;
+
+	for (i = 0; indicator_order[i] != NULL; i++) {
+		if (g_strcmp0(name, indicator_order[i]) == 0) {
+			return i;
+		}
+	}
+
+	return -1;
+}
+
+typedef struct _incoming_position_t incoming_position_t;
+struct _incoming_position_t {
+	gint objposition;
+	gint entryposition;
+	gint menupos;
+	gboolean found;
+};
+
+/* This function helps by determining where in the menu list
+   this new entry should be placed.  It compares the objects
+   that they're on, and then the individual entries.  Each
+   is progressively more expensive. */
+static void
+place_in_menu (GtkWidget * widget, gpointer user_data)
+{
+	incoming_position_t * position = (incoming_position_t *)user_data;
+	if (position->found) {
+		/* We've already been placed, just finish the foreach */
+		return;
+	}
+
+	IndicatorObject * io = INDICATOR_OBJECT(g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_OBJECT));
+	g_assert(io != NULL);
+
+	gint objposition = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER));
+	/* We've already passed it, well, then this is where
+	   we should be be.  Stop! */
+	if (objposition > position->objposition) {
+		position->found = TRUE;
+		return;
+	}
+
+	/* The objects don't match yet, keep looking */
+	if (objposition < position->objposition) {
+		position->menupos++;
+		return;
+	}
+
+	/* The objects are the same, let's start looking at entries. */
+	IndicatorObjectEntry * entry = (IndicatorObjectEntry *)g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY);
+	gint entryposition = indicator_object_get_location(io, entry);
+
+	if (entryposition > position->entryposition) {
+		position->found = TRUE;
+		return;
+	}
+
+	if (entryposition < position->entryposition) {
+		position->menupos++;
+		return;
+	}
+
+	/* We've got the same object and the same entry.  Well,
+	   let's just put it right here then. */
+	position->found = TRUE;
+	return;
+}
+
+static void
+something_shown (GtkWidget * widget, gpointer user_data)
+{
+	GtkWidget * menuitem = GTK_WIDGET(user_data);
+	gtk_widget_show(menuitem);
+}
+
+static void
+something_hidden (GtkWidget * widget, gpointer user_data)
+{
+	GtkWidget * menuitem = GTK_WIDGET(user_data);
+	gtk_widget_hide(menuitem);
+}
+
+static void
+sensitive_cb (GObject * obj, GParamSpec * pspec, gpointer user_data)
+{
+	g_return_if_fail(GTK_IS_WIDGET(obj));
+	g_return_if_fail(GTK_IS_WIDGET(user_data));
+
+	gtk_widget_set_sensitive(GTK_WIDGET(user_data), gtk_widget_get_sensitive(GTK_WIDGET(obj)));
+	return;
+}
+
+static void
+entry_activated (GtkWidget * widget, gpointer user_data)
+{
+	g_return_if_fail(GTK_IS_WIDGET(widget));
+	gpointer pio = g_object_get_data(G_OBJECT(widget), "indicator");
+	g_return_if_fail(INDICATOR_IS_OBJECT(pio));
+	IndicatorObject * io = INDICATOR_OBJECT(pio);
+
+	return indicator_object_entry_activate(io, (IndicatorObjectEntry *)user_data, gtk_get_current_event_time());
+}
+
+static gboolean
+entry_scrolled (GtkWidget *menuitem, GdkEventScroll *event, gpointer data)
+{
+	IndicatorObject *io = g_object_get_data (G_OBJECT (menuitem), MENU_DATA_INDICATOR_OBJECT);
+	IndicatorObjectEntry *entry = g_object_get_data (G_OBJECT (menuitem), MENU_DATA_INDICATOR_ENTRY);
+
+	g_return_val_if_fail(INDICATOR_IS_OBJECT(io), FALSE);
+
+	g_signal_emit_by_name (io, "scroll", 1, event->direction);
+	g_signal_emit_by_name (io, "scroll-entry", entry, 1, event->direction);
+	g_signal_emit_by_name (io, INDICATOR_OBJECT_SIGNAL_ENTRY_SCROLLED, entry, 1, event->direction);
+
+	return FALSE;
+}
+
+static gboolean
+entry_pressed (GtkWidget *menuitem, GdkEvent *event, gpointer data)
+{
+       g_return_val_if_fail(GTK_IS_MENU_ITEM(menuitem), FALSE);
+
+       if (((GdkEventButton*)event)->button == 2) /* middle button */
+       {
+               gtk_widget_grab_focus(menuitem);
+
+               return TRUE;
+       }
+
+       return FALSE;
+}
+
+static gboolean
+entry_released (GtkWidget *menuitem, GdkEvent *event, gpointer data)
+{
+       g_return_val_if_fail(GTK_IS_MENU_ITEM(menuitem), FALSE);
+
+       if (((GdkEventButton*)event)->button == 2) /* middle button */
+       {
+               IndicatorObject *io = g_object_get_data (G_OBJECT (menuitem), MENU_DATA_INDICATOR_OBJECT);
+               IndicatorObjectEntry *entry = g_object_get_data (G_OBJECT (menuitem), MENU_DATA_INDICATOR_ENTRY);
+
+               g_return_val_if_fail(INDICATOR_IS_OBJECT(io), FALSE);
+
+               g_signal_emit_by_name (io, INDICATOR_OBJECT_SIGNAL_SECONDARY_ACTIVATE, entry,
+                       ((GdkEventButton*)event)->time);
+
+               return TRUE;
+       }
+
+       return FALSE;
+}
+
+static void
+accessible_desc_update_cb (GtkWidget * widget, gpointer userdata)
+{
+	gpointer data = g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY);
+
+	if (data != userdata) {
+		return;
+	}
+
+	IndicatorObjectEntry * entry = (IndicatorObjectEntry *)data;
+	update_accessible_desc(entry, widget);
+}
+
+static void
+accessible_desc_update (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menubar)
+{
+	gtk_container_foreach(GTK_CONTAINER(menubar), accessible_desc_update_cb, entry);
+	return;
+}
+
+#define PANEL_PADDING 8
+static gboolean
+entry_resized (GtkWidget *applet, guint newsize, gpointer data)
+{
+	IndicatorObject *io = (IndicatorObject *)data;
+
+	size = newsize;
+
+	/* Work on the entries */
+	GList * entries = indicator_object_get_entries(io);
+	GList * entry = NULL;
+
+	for (entry = entries; entry != NULL; entry = g_list_next(entry)) {
+		IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)entry->data;
+		if (entrydata->image != NULL) {
+			/* Resize to fit panel */
+			gtk_image_set_pixel_size (entrydata->image, size - PANEL_PADDING);
+		}
+	}
+
+	return FALSE;
+}
+
+static void
+entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menubar)
+{
+	g_debug("Signal: Entry Added");
+	gboolean something_visible = FALSE;
+	gboolean something_sensitive = FALSE;
+
+	GtkWidget * menuitem = gtk_menu_item_new();
+	GtkWidget * box = (packdirection == GTK_PACK_DIRECTION_LTR) ?
+		gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3) : gtk_box_new(GTK_ORIENTATION_VERTICAL, 3);
+
+	/* Allows indicators to receive mouse scroll event */
+	gtk_widget_add_events(GTK_WIDGET(menuitem), GDK_SCROLL_MASK);
+	gtk_widget_add_events(GTK_WIDGET(menuitem), GDK_BUTTON_PRESS_MASK);
+	gtk_widget_add_events(GTK_WIDGET(menuitem), GDK_BUTTON_RELEASE_MASK);
+
+	g_object_set_data (G_OBJECT (menuitem), "indicator", io);
+	g_object_set_data (G_OBJECT (menuitem), "box", box);
+
+	g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(entry_activated), entry);
+	g_signal_connect(G_OBJECT(menuitem), "scroll-event", G_CALLBACK(entry_scrolled), entry);
+	g_signal_connect(G_OBJECT(menuitem), "button-press-event", G_CALLBACK(entry_pressed), entry);
+	g_signal_connect(G_OBJECT(menuitem), "button-release-event", G_CALLBACK(entry_released), entry);
+
+	if (entry->image != NULL) {
+		/* Resize to fit panel */
+		gtk_image_set_pixel_size (entry->image, size - PANEL_PADDING);
+		gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(entry->image), FALSE, FALSE, 1);
+		if (gtk_widget_get_visible(GTK_WIDGET(entry->image))) {
+			something_visible = TRUE;
+		}
+
+		if (gtk_widget_get_sensitive(GTK_WIDGET(entry->image))) {
+			something_sensitive = TRUE;
+		}
+
+		g_signal_connect(G_OBJECT(entry->image), "show", G_CALLBACK(something_shown), menuitem);
+		g_signal_connect(G_OBJECT(entry->image), "hide", G_CALLBACK(something_hidden), menuitem);
+
+		g_signal_connect(G_OBJECT(entry->image), "notify::sensitive", G_CALLBACK(sensitive_cb), menuitem);
+	}
+	if (entry->label != NULL) {
+		switch(packdirection) {
+			case GTK_PACK_DIRECTION_LTR:
+				gtk_label_set_angle(GTK_LABEL(entry->label), 0.0);
+				break;
+			case GTK_PACK_DIRECTION_TTB:
+				gtk_label_set_angle(GTK_LABEL(entry->label),
+						(orient == MATE_PANEL_APPLET_ORIENT_LEFT) ?
+						270.0 : 90.0);
+				break;
+			default:
+				break;
+		}
+		gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(entry->label), FALSE, FALSE, 1);
+
+		if (gtk_widget_get_visible(GTK_WIDGET(entry->label))) {
+			something_visible = TRUE;
+		}
+
+		if (gtk_widget_get_sensitive(GTK_WIDGET(entry->label))) {
+			something_sensitive = TRUE;
+		}
+
+		g_signal_connect(G_OBJECT(entry->label), "show", G_CALLBACK(something_shown), menuitem);
+		g_signal_connect(G_OBJECT(entry->label), "hide", G_CALLBACK(something_hidden), menuitem);
+
+		g_signal_connect(G_OBJECT(entry->label), "notify::sensitive", G_CALLBACK(sensitive_cb), menuitem);
+	}
+	gtk_container_add(GTK_CONTAINER(menuitem), box);
+	gtk_widget_show(box);
+
+	if (entry->menu != NULL) {
+		gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(entry->menu));
+	}
+
+	incoming_position_t position;
+	position.objposition = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER));
+	position.entryposition = indicator_object_get_location(io, entry);
+	position.menupos = 0;
+	position.found = FALSE;
+
+	gtk_container_foreach(GTK_CONTAINER(menubar), place_in_menu, &position);
+
+	gtk_menu_shell_insert(GTK_MENU_SHELL(menubar), menuitem, position.menupos);
+
+	if (something_visible) {
+		if (entry->accessible_desc != NULL) {
+			update_accessible_desc(entry, menuitem);
+		}
+		gtk_widget_show(menuitem);
+	}
+	gtk_widget_set_sensitive(menuitem, something_sensitive);
+
+	g_object_set_data(G_OBJECT(menuitem), MENU_DATA_INDICATOR_ENTRY,  entry);
+	g_object_set_data(G_OBJECT(menuitem), MENU_DATA_INDICATOR_OBJECT, io);
+
+	return;
+}
+
+static void
+entry_removed_cb (GtkWidget * widget, gpointer userdata)
+{
+	gpointer data = g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY);
+
+	if (data != userdata) {
+		return;
+	}
+
+	IndicatorObjectEntry * entry = (IndicatorObjectEntry *)data;
+	if (entry->label != NULL) {
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->label), G_CALLBACK(something_shown), widget);
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->label), G_CALLBACK(something_hidden), widget);
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->label), G_CALLBACK(sensitive_cb), widget);
+	}
+	if (entry->image != NULL) {
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->image), G_CALLBACK(something_shown), widget);
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->image), G_CALLBACK(something_hidden), widget);
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->image), G_CALLBACK(sensitive_cb), widget);
+	}
+
+	gtk_widget_destroy(widget);
+	return;
+}
+
+static void
+entry_removed (IndicatorObject * io G_GNUC_UNUSED, IndicatorObjectEntry * entry,
+               gpointer user_data)
+{
+	g_debug("Signal: Entry Removed");
+
+	gtk_container_foreach(GTK_CONTAINER(user_data), entry_removed_cb, entry);
+
+	return;
+}
+
+static void
+entry_moved_find_cb (GtkWidget * widget, gpointer userdata)
+{
+	gpointer * array = (gpointer *)userdata;
+	if (array[1] != NULL) {
+		return;
+	}
+
+	gpointer data = g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY);
+
+	if (data != array[0]) {
+		return;
+	}
+
+	array[1] = widget;
+	return;
+}
+
+/* Gets called when an entry for an object was moved. */
+static void
+entry_moved (IndicatorObject * io, IndicatorObjectEntry * entry,
+             gint old G_GNUC_UNUSED, gint new G_GNUC_UNUSED, gpointer user_data)
+{
+	GtkWidget * menubar = GTK_WIDGET(user_data);
+
+	gpointer array[2];
+	array[0] = entry;
+	array[1] = NULL;
+
+	gtk_container_foreach(GTK_CONTAINER(menubar), entry_moved_find_cb, array);
+	if (array[1] == NULL) {
+		g_warning("Moving an entry that isn't in our menus.");
+		return;
+	}
+
+	GtkWidget * mi = GTK_WIDGET(array[1]);
+	g_object_ref(G_OBJECT(mi));
+	gtk_container_remove(GTK_CONTAINER(menubar), mi);
+
+	incoming_position_t position;
+	position.objposition = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER));
+	position.entryposition = indicator_object_get_location(io, entry);
+	position.menupos = 0;
+	position.found = FALSE;
+
+	gtk_container_foreach(GTK_CONTAINER(menubar), place_in_menu, &position);
+
+	gtk_menu_shell_insert(GTK_MENU_SHELL(menubar), mi, position.menupos);
+	g_object_unref(G_OBJECT(mi));
+
+	return;
+}
+
+static void
+menu_show (IndicatorObject * io, IndicatorObjectEntry * entry,<--- Parameter 'entry' can be declared with const
+           guint32 timestamp, gpointer user_data)
+{
+	GtkWidget * menubar = GTK_WIDGET(user_data);
+
+	if (entry == NULL) {
+		/* Close any open menus instead of opening one */
+		GList * entries = indicator_object_get_entries(io);
+		GList * iterator = NULL;
+		for (iterator = entries; iterator != NULL; iterator = g_list_next(iterator)) {
+			IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)iterator->data;
+			gtk_menu_popdown(entrydata->menu);
+		}
+		g_list_free(entries);
+
+		/* And tell the menubar to exit activation mode too */
+		gtk_menu_shell_cancel(GTK_MENU_SHELL(menubar));
+		return;
+	}
+
+	// TODO: do something sensible here
+}
+
+static void
+update_accessible_desc(IndicatorObjectEntry * entry, GtkWidget * menuitem)
+{
+	/* FIXME: We need to deal with the use case where the contents of the
+	   label overrides what is found in the atk object's name, or at least
+	   orca speaks the label instead of the atk object name.
+	 */
+	AtkObject * menuitem_obj = gtk_widget_get_accessible(menuitem);
+	if (menuitem_obj == NULL) {
+		/* Should there be an error printed here? */
+		return;
+	}
+
+	if (entry->accessible_desc != NULL) {
+		atk_object_set_name(menuitem_obj, entry->accessible_desc);
+	} else {
+		atk_object_set_name(menuitem_obj, "");
+	}
+	return;
+}
+
+static void
+load_indicator (MatePanelApplet *applet, GtkWidget * menubar, IndicatorObject *io, const gchar *name)
+{
+	/* Set the environment it's in */
+	indicator_object_set_environment(io, (const GStrv)indicator_env);
+
+	/* Attach the 'name' to the object */
+#if HAVE_AYATANA_INDICATOR_NG || HAVE_UBUNTU_INDICATOR_NG
+	int pos = 5000 - indicator_object_get_position(io);
+	if (pos > 5000) {
+		pos = name2order(name);
+	}
+#else
+	int pos = name2order(name);
+#endif
+
+	g_object_set_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER, GINT_TO_POINTER(pos));
+
+	/* Connect to its signals */
+	g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED,   G_CALLBACK(entry_added),    menubar);
+	g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED, G_CALLBACK(entry_removed),  menubar);
+	g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED,   G_CALLBACK(entry_moved),    menubar);
+	g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_MENU_SHOW,     G_CALLBACK(menu_show),      menubar);
+	g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE, G_CALLBACK(accessible_desc_update), menubar);
+
+	/* Track panel resize */
+	g_signal_connect_object(G_OBJECT(applet), "change-size", G_CALLBACK(entry_resized), G_OBJECT(io), 0);
+
+	/* Work on the entries */
+	GList * entries = indicator_object_get_entries(io);
+	GList * entry = NULL;
+
+	for (entry = entries; entry != NULL; entry = g_list_next(entry)) {
+		IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)entry->data;
+		entry_added(io, entrydata, menubar);
+	}
+
+	g_list_free(entries);
+}
+
+static gboolean
+load_module (const gchar * name, MatePanelApplet *applet, GtkWidget * menubar)
+{
+	g_debug("Looking at Module: %s", name);
+	g_return_val_if_fail(name != NULL, FALSE);
+
+	if (!g_str_has_suffix(name, G_MODULE_SUFFIX)) {
+		return FALSE;
+	}
+
+	g_debug("Loading Module: %s", name);
+
+	/* Build the object for the module */
+	gchar * fullpath = g_build_filename(INDICATOR_DIR, name, NULL);
+	IndicatorObject * io = indicator_object_new_from_file(fullpath);
+	g_free(fullpath);
+
+	load_indicator(applet, menubar, io, name);
+
+	return TRUE;
+}
+
+static void
+load_modules (MatePanelApplet *applet, GtkWidget *menubar, gint *indicators_loaded)
+{
+	if (g_file_test(INDICATOR_DIR, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) {
+		GDir * dir = g_dir_open(INDICATOR_DIR, 0, NULL);
+
+		const gchar * name;
+		gint count = 0;
+		while ((name = g_dir_read_name(dir)) != NULL) {
+#ifdef INDICATOR_APPLET_APPMENU
+			if (g_strcmp0(name, INDICATOR_SERVICE_APPMENU)) {
+				continue;
+			}
+#else
+			if (!g_strcmp0(name, INDICATOR_SERVICE_APPMENU)) {
+				continue;
+			}
+#endif
+#ifdef INDICATOR_APPLET
+			if (!g_strcmp0(name, INDICATOR_SERVICE_ME)) {
+				continue;
+			}
+			if (!g_strcmp0(name, INDICATOR_SERVICE_DATETIME)) {
+				continue;
+			}
+#endif
+			if (load_module(name, applet, menubar)) {
+				count++;
+			}
+		}
+
+		*indicators_loaded += count;
+
+		g_dir_close (dir);
+	}
+}
+
+#if HAVE_AYATANA_INDICATOR_NG || HAVE_UBUNTU_INDICATOR_NG
+
+static void
+load_indicators_from_indicator_files (MatePanelApplet *applet, GtkWidget *menubar, gint *indicators_loaded)
+{
+	GDir *dir;
+	const gchar *name;
+	GError *error = NULL;
+
+	dir = g_dir_open (INDICATOR_SERVICE_DIR, 0, &error);
+
+	if (!dir) {
+		g_warning ("unable to open indicator service file directory: %s", error->message);
+		g_error_free (error);
+
+		return;
+	}
+
+	gint count = 0;
+	while ((name = g_dir_read_name (dir))) {
+		gchar *filename;
+		IndicatorNg *indicator;
+
+		filename = g_build_filename (INDICATOR_SERVICE_DIR, name, NULL);
+		indicator = indicator_ng_new_for_profile (filename, "desktop", &error);
+		g_free (filename);
+
+#ifdef INDICATOR_APPLET_APPMENU
+		if (g_strcmp0(name, INDICATOR_SERVICE_APPMENU_NG)) {
+			continue;
+		}
+#else
+		if (!g_strcmp0(name, INDICATOR_SERVICE_APPMENU_NG)) {
+			continue;
+		}
+#endif
+#ifdef INDICATOR_APPLET
+		if (!g_strcmp0(name, INDICATOR_SERVICE_ME_NG)) {
+			continue;
+		}
+		if (!g_strcmp0(name, INDICATOR_SERVICE_DATETIME_NG)) {
+			continue;
+		}
+#endif
+
+		if (indicator) {
+			load_indicator(applet, menubar, INDICATOR_OBJECT (indicator), name);
+			count++;
+		}else{
+			g_warning ("unable to load '%s': %s", name, error->message);
+			g_clear_error (&error);
+		}
+	}
+
+	*indicators_loaded += count;
+
+	g_dir_close (dir);
+}
+#endif  /* HAVE_AYATANA_INDICATOR_NG || HAVE_UBUNTU_INDICATOR_NG */
+
+static void
+hotkey_filter (char * keystring G_GNUC_UNUSED, gpointer data)
+{
+	g_return_if_fail(GTK_IS_MENU_SHELL(data));
+
+	/* Oh, wow, it's us! */
+	GList * children = gtk_container_get_children(GTK_CONTAINER(data));
+	if (children == NULL) {
+		g_debug("Menubar has no children");
+		return;
+	}
+
+	gtk_menu_shell_select_item(GTK_MENU_SHELL(data), GTK_WIDGET(g_list_last(children)->data));
+	g_list_free(children);
+	return;
+}
+
+static gboolean
+menubar_press (GtkWidget * widget,
+                    GdkEventButton *event,
+                    gpointer data G_GNUC_UNUSED)
+{
+	if (event->button != 1) {
+		g_signal_stop_emission_by_name(widget, "button-press-event");
+	}
+
+	return FALSE;
+}
+
+static gboolean
+menubar_on_draw (GtkWidget * widget,
+                 cairo_t * cr,
+                 GtkWidget * menubar)
+{
+	/* FIXME: either port to gtk_render_focus or remove this function */
+	if (gtk_widget_has_focus(menubar))
+		gtk_paint_focus(gtk_widget_get_style(widget),
+		                cr,
+		                gtk_widget_get_state(menubar),
+		                widget, "menubar-applet", 0, 0, -1, -1);
+
+	return FALSE;
+}
+
+static void
+about_cb (GtkAction *action G_GNUC_UNUSED,
+          gpointer   data G_GNUC_UNUSED)
+{
+	static const gchar *authors[] = {
+		"Ted Gould <ted@canonical.com>",
+		NULL
+	};
+
+	static gchar *license[] = {
+        N_("This program is free software: you can redistribute it and/or modify it "
+           "under the terms of the GNU General Public License version 3, as published "
+           "by the Free Software Foundation."),
+        N_("This program is distributed in the hope that it will be useful, but "
+           "WITHOUT ANY WARRANTY; without even the implied warranties of "
+           "MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR "
+           "PURPOSE.  See the GNU General Public License for more details."),
+        N_("You should have received a copy of the GNU General Public License along "
+           "with this program.  If not, see <http://www.gnu.org/licenses/>."),
+		NULL
+	};
+	gchar *license_i18n;
+
+	license_i18n = g_strconcat (_(license[0]), "\n\n", _(license[1]), "\n\n", _(license[2]), NULL);
+
+	gtk_show_about_dialog(NULL,
+		"version", VERSION,
+		"copyright", _("Copyright \xc2\xa9 2009-2010 Canonical, Ltd.\n"
+		               "Copyright \xc2\xa9 2011-2021 MATE developers"),
+#ifdef INDICATOR_APPLET_APPMENU
+		"comments", _("An applet to hold your application menus."),
+#endif
+		"comments", _("An applet to hold all of the system indicators."),
+		"authors", authors,
+		"license", license_i18n,
+		"wrap-license", TRUE,
+		"translator-credits", _("translator-credits"),
+		"logo-icon-name", "mate-indicator-applet",
+		"icon-name", "mate-indicator-applet",
+		"website", "https://mate-desktop.org",
+		"website-label", _("MATE Website"),
+		NULL
+	);
+
+	g_free (license_i18n);
+
+	return;
+}
+
+static gboolean
+swap_orient_cb (GtkWidget *item, gpointer data)
+{
+	GtkWidget *from = (GtkWidget *) data;
+	GtkWidget *to = (GtkWidget *) g_object_get_data(G_OBJECT(from), "to");
+	g_object_ref(G_OBJECT(item));
+	gtk_container_remove(GTK_CONTAINER(from), item);
+	if (GTK_IS_LABEL(item)) {
+			switch(packdirection) {
+			case GTK_PACK_DIRECTION_LTR:
+				gtk_label_set_angle(GTK_LABEL(item), 0.0);
+				break;
+			case GTK_PACK_DIRECTION_TTB:
+				gtk_label_set_angle(GTK_LABEL(item),
+						(orient == MATE_PANEL_APPLET_ORIENT_LEFT) ?
+						270.0 : 90.0);
+				break;
+			default:
+				break;
+		}
+	}
+	gtk_box_pack_start(GTK_BOX(to), item, FALSE, FALSE, 0);
+	return TRUE;
+}
+
+static gboolean
+reorient_box_cb (GtkWidget *menuitem, gpointer data)
+{
+	GtkWidget *from = g_object_get_data(G_OBJECT(menuitem), "box");
+	GtkWidget *to = (packdirection == GTK_PACK_DIRECTION_LTR) ?
+		gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0) : gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+	g_object_set_data(G_OBJECT(from), "to", to);
+	gtk_container_foreach(GTK_CONTAINER(from), (GtkCallback)swap_orient_cb,
+			from);
+	gtk_container_remove(GTK_CONTAINER(menuitem), from);
+	gtk_container_add(GTK_CONTAINER(menuitem), to);
+	g_object_set_data(G_OBJECT(menuitem), "box", to);
+	gtk_widget_show_all(menuitem);
+	return TRUE;
+}
+
+static gboolean
+matepanelapplet_reorient_cb (GtkWidget *applet, MatePanelAppletOrient neworient,
+		gpointer data)
+{
+	GtkWidget *menubar = (GtkWidget *)data;
+	if ((((neworient == MATE_PANEL_APPLET_ORIENT_UP) ||
+			(neworient == MATE_PANEL_APPLET_ORIENT_DOWN)) &&
+			((orient == MATE_PANEL_APPLET_ORIENT_LEFT) ||
+			(orient == MATE_PANEL_APPLET_ORIENT_RIGHT))) ||
+			(((neworient == MATE_PANEL_APPLET_ORIENT_LEFT) ||
+			(neworient == MATE_PANEL_APPLET_ORIENT_RIGHT)) &&
+			((orient == MATE_PANEL_APPLET_ORIENT_UP) ||
+			(orient == MATE_PANEL_APPLET_ORIENT_DOWN)))) {
+		packdirection = (packdirection == GTK_PACK_DIRECTION_LTR) ?
+				GTK_PACK_DIRECTION_TTB : GTK_PACK_DIRECTION_LTR;
+		gtk_menu_bar_set_pack_direction(GTK_MENU_BAR(menubar),
+				packdirection);
+		orient = neworient;
+		gtk_container_foreach(GTK_CONTAINER(menubar),
+				(GtkCallback)reorient_box_cb, NULL);
+	}
+	orient = neworient;
+	return FALSE;
+}
+
+#ifdef N_
+#undef N_
+#endif
+#define N_(x) x
+
+static void
+log_to_file_cb (GObject * source_obj G_GNUC_UNUSED,
+                GAsyncResult * result G_GNUC_UNUSED, gpointer user_data)
+{
+	g_free(user_data);
+	return;
+}
+
+static void
+log_to_file (const gchar * domain G_GNUC_UNUSED,
+             GLogLevelFlags level G_GNUC_UNUSED,
+             const gchar * message,
+             gpointer data G_GNUC_UNUSED)
+{
+	if (log_file == NULL) {
+		GError * error = NULL;
+		gchar * filename = g_build_filename(g_get_user_cache_dir(), LOG_FILE_NAME, NULL);
+		GFile * file = g_file_new_for_path(filename);
+		g_free(filename);
+
+		if (!g_file_test(g_get_user_cache_dir(), G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
+			GFile * cachedir = g_file_new_for_path(g_get_user_cache_dir());
+			g_file_make_directory_with_parents(cachedir, NULL, &error);
+
+			if (error != NULL) {
+				g_error("Unable to make directory '%s' for log file: %s", g_get_user_cache_dir(), error->message);
+			}
+		}
+
+		g_file_delete(file, NULL, NULL);
+
+		GFileIOStream * io = g_file_create_readwrite(file,
+		                          G_FILE_CREATE_REPLACE_DESTINATION, /* flags */
+		                          NULL, /* cancelable */
+		                          &error); /* error */
+		if (error != NULL) {
+			g_error("Unable to replace file: %s", error->message);
+		}
+
+		log_file = g_io_stream_get_output_stream(G_IO_STREAM(io));
+	}
+
+	gchar * outputstring = g_strdup_printf("%s\n", message);
+	g_output_stream_write_async(log_file,
+	                            outputstring, /* data */
+	                            strlen(outputstring), /* length */
+	                            G_PRIORITY_LOW, /* priority */
+	                            NULL, /* cancelable */
+	                            log_to_file_cb, /* callback */
+	                            outputstring); /* data */
+
+	return;
+}
+
+static gboolean
+applet_fill_cb (MatePanelApplet * applet, const gchar * iid G_GNUC_UNUSED,
+                gpointer data G_GNUC_UNUSED)
+{
+#if HAVE_AYATANA_INDICATOR_NG || HAVE_UBUNTU_INDICATOR_NG
+	ido_init();
+#endif
+
+	static const GtkActionEntry menu_actions[] = {
+		{"About", "help-about", N_("_About"), NULL, NULL, G_CALLBACK(about_cb)}
+	};
+	static const gchar *menu_xml = "<menuitem name=\"About\" action=\"About\"/>";
+
+	static gboolean first_time = FALSE;
+	GtkWidget *menubar;
+	gint indicators_loaded = 0;
+	GtkActionGroup *action_group;
+
+	if (!first_time)
+	{
+		first_time = TRUE;
+#ifdef INDICATOR_APPLET
+		g_set_application_name(_("Indicator Applet"));
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+		g_set_application_name(_("Indicator Applet Complete"));
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+		g_set_application_name(_("Indicator Applet Application Menu"));
+#endif
+
+		g_log_set_default_handler(log_to_file, NULL);
+
+		tomboy_keybinder_init();
+	}
+
+	/* Set panel options */
+	gtk_container_set_border_width(GTK_CONTAINER (applet), 0);
+	mate_panel_applet_set_flags(applet, MATE_PANEL_APPLET_EXPAND_MINOR);
+	menubar = gtk_menu_bar_new();
+	action_group = gtk_action_group_new ("Indicator Applet Actions");
+	gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+	gtk_action_group_add_actions (action_group, menu_actions,
+	                              G_N_ELEMENTS (menu_actions),
+	                              menubar);
+	mate_panel_applet_setup_menu(applet, menu_xml, action_group);
+	g_object_unref(action_group);
+#ifdef INDICATOR_APPLET
+	atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)),
+	                     "indicator-applet");
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+	atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)),
+	                     "indicator-applet-complete");
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+	atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)),
+	                     "indicator-applet-appmenu");
+#endif
+
+	/* Init some theme/icon stuff */
+	gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(),
+	                                  INDICATOR_ICONS_DIR);
+	/* g_debug("Icons directory: %s", INDICATOR_ICONS_DIR); */
+	gtk_widget_set_name(GTK_WIDGET (applet), "fast-user-switch-applet");
+
+	/* Build menubar */
+	size = (mate_panel_applet_get_size (applet));
+	orient = (mate_panel_applet_get_orient(applet));
+	packdirection = ((orient == MATE_PANEL_APPLET_ORIENT_UP) ||
+			(orient == MATE_PANEL_APPLET_ORIENT_DOWN)) ?
+			GTK_PACK_DIRECTION_LTR : GTK_PACK_DIRECTION_TTB;
+	gtk_menu_bar_set_pack_direction(GTK_MENU_BAR(menubar),
+			packdirection);
+	gtk_widget_set_can_focus (menubar, TRUE);
+	gtk_widget_set_name(GTK_WIDGET (menubar), "fast-user-switch-menubar");
+	g_signal_connect(menubar, "button-press-event", G_CALLBACK(menubar_press), NULL);
+	g_signal_connect_after(menubar, "draw", G_CALLBACK(menubar_on_draw), menubar);
+	g_signal_connect(applet, "change-orient",
+			G_CALLBACK(matepanelapplet_reorient_cb), menubar);
+	gtk_container_set_border_width(GTK_CONTAINER(menubar), 0);
+
+	/* Add in filter func */
+	tomboy_keybinder_bind(hotkey_keycode, hotkey_filter, menubar);
+
+	load_modules(applet, menubar, &indicators_loaded);
+#if HAVE_AYATANA_INDICATOR_NG || HAVE_UBUNTU_INDICATOR_NG
+	load_indicators_from_indicator_files(applet, menubar, &indicators_loaded);
+#endif
+
+	if (indicators_loaded == 0) {
+		/* A label to allow for click through */
+		GtkWidget * item = gtk_label_new(_("No Indicators"));
+		mate_panel_applet_set_background_widget(applet, item);
+		gtk_container_add(GTK_CONTAINER(applet), item);
+		gtk_widget_show(item);
+	} else {
+		gtk_container_add(GTK_CONTAINER(applet), menubar);
+		mate_panel_applet_set_background_widget(applet, menubar);
+		gtk_widget_show(menubar);
+	}
+
+	gtk_widget_show(GTK_WIDGET(applet));
+
+	return TRUE;
+
+}
+
+
+
+
+ + + diff --git a/2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/1.html b/2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/1.html new file mode 100644 index 0000000..6e484d7 --- /dev/null +++ b/2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/1.html @@ -0,0 +1,1229 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
/* eggaccelerators.c
+ * Copyright (C) 2002  Red Hat, Inc.; Copyright 1998, 2001 Tim Janik
+ * Developed by Havoc Pennington, Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+
+#include "eggaccelerators.h"
+
+#include <string.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
+
+enum
+{
+  EGG_MODMAP_ENTRY_SHIFT   = 0,
+  EGG_MODMAP_ENTRY_LOCK    = 1,
+  EGG_MODMAP_ENTRY_CONTROL = 2,
+  EGG_MODMAP_ENTRY_MOD1    = 3,
+  EGG_MODMAP_ENTRY_MOD2    = 4,
+  EGG_MODMAP_ENTRY_MOD3    = 5,
+  EGG_MODMAP_ENTRY_MOD4    = 6,
+  EGG_MODMAP_ENTRY_MOD5    = 7,
+  EGG_MODMAP_ENTRY_LAST    = 8
+};
+
+#define MODMAP_ENTRY_TO_MODIFIER(x) (1 << (x))
+
+typedef struct
+{
+  EggVirtualModifierType mapping[EGG_MODMAP_ENTRY_LAST];
+
+} EggModmap;
+
+const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap);
+
+static inline gboolean
+is_alt (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'a' || string[1] == 'A') &&
+	  (string[2] == 'l' || string[2] == 'L') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_ctl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_modx (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'd' || string[3] == 'D') &&
+	  (string[4] >= '1' && string[4] <= '5') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_ctrl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'r' || string[3] == 'R') &&
+	  (string[4] == 'l' || string[4] == 'L') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shft (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'f' || string[3] == 'F') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shift (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'i' || string[3] == 'I') &&
+	  (string[4] == 'f' || string[4] == 'F') &&
+	  (string[5] == 't' || string[5] == 'T') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_control (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'n' || string[3] == 'N') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == 'o' || string[6] == 'O') &&
+	  (string[7] == 'l' || string[7] == 'L') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_release (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'r' || string[1] == 'R') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'a' || string[5] == 'A') &&
+	  (string[6] == 's' || string[6] == 'S') &&
+	  (string[7] == 'e' || string[7] == 'E') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_meta (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == 'a' || string[4] == 'A') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_super (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'u' || string[2] == 'U') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_hyper (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'h' || string[1] == 'H') &&
+	  (string[2] == 'y' || string[2] == 'Y') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+/**
+ * egg_accelerator_parse_virtual:
+ * @accelerator:      string representing an accelerator
+ * @accelerator_key:  return location for accelerator keyval
+ * @accelerator_mods: return location for accelerator modifier mask
+ *
+ * Parses a string representing a virtual accelerator. The format
+ * looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1" or
+ * "&lt;Release&gt;z" (the last one is for key release).  The parser
+ * is fairly liberal and allows lower or upper case, and also
+ * abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;".
+ *
+ * If the parse fails, @accelerator_key and @accelerator_mods will
+ * be set to 0 (zero) and %FALSE will be returned. If the string contains
+ * only modifiers, @accelerator_key will be set to 0 but %TRUE will be
+ * returned.
+ *
+ * The virtual vs. concrete accelerator distinction is a relic of
+ * how the X Window System works; there are modifiers Mod2-Mod5 that
+ * can represent various keyboard keys (numlock, meta, hyper, etc.),
+ * the virtual modifier represents the keyboard key, the concrete
+ * modifier the actual Mod2-Mod5 bits in the key press event.
+ *
+ * Returns: %TRUE on success.
+ */
+gboolean
+egg_accelerator_parse_virtual (const gchar            *accelerator,
+                               guint                  *accelerator_key,
+                               EggVirtualModifierType *accelerator_mods)
+{
+  guint keyval;
+  GdkModifierType mods;
+  gint len;
+  gboolean bad_keyval;
+
+  if (accelerator_key)
+    *accelerator_key = 0;
+  if (accelerator_mods)
+    *accelerator_mods = 0;
+
+  g_return_val_if_fail (accelerator != NULL, FALSE);
+
+  bad_keyval = FALSE;
+
+  keyval = 0;
+  mods = 0;
+  len = strlen (accelerator);
+  while (len)
+    {
+      if (*accelerator == '<')
+	{
+	  if (len >= 9 && is_release (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_RELEASE_MASK;
+	    }
+	  else if (len >= 9 && is_control (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 7 && is_shift (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_shft (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_ctrl (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 6 && is_modx (accelerator))
+	    {
+	      static const guint mod_vals[] = {
+		EGG_VIRTUAL_ALT_MASK, EGG_VIRTUAL_MOD2_MASK, EGG_VIRTUAL_MOD3_MASK,
+		EGG_VIRTUAL_MOD4_MASK, EGG_VIRTUAL_MOD5_MASK
+	      };
+
+	      len -= 6;
+	      accelerator += 4;
+	      mods |= mod_vals[*accelerator - '1'];
+	      accelerator += 2;
+	    }
+	  else if (len >= 5 && is_ctl (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 5 && is_alt (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_ALT_MASK;
+	    }
+          else if (len >= 6 && is_meta (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_META_MASK;
+	    }
+          else if (len >= 7 && is_hyper (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_HYPER_MASK;
+	    }
+          else if (len >= 7 && is_super (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SUPER_MASK;
+	    }
+	  else
+	    {
+	      gchar last_ch;
+
+	      last_ch = *accelerator;
+	      while (last_ch && last_ch != '>')
+		{
+		  last_ch = *accelerator;
+		  accelerator += 1;
+		  len -= 1;
+		}
+	    }
+	}
+      else
+	{
+          keyval = gdk_keyval_from_name (accelerator);
+
+          if (keyval == 0)
+            bad_keyval = TRUE;
+
+          accelerator += len;
+          len -= len;
+	}
+    }
+
+  if (accelerator_key)
+    *accelerator_key = gdk_keyval_to_lower (keyval);
+  if (accelerator_mods)
+    *accelerator_mods = mods;
+
+  return !bad_keyval;
+}
+
+void
+egg_keymap_resolve_virtual_modifiers (GdkKeymap              *keymap,
+                                      EggVirtualModifierType  virtual_mods,
+                                      GdkModifierType        *concrete_mods)
+{
+  GdkModifierType concrete;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (concrete_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  concrete = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if (modmap->mapping[i] & virtual_mods)
+        concrete |= (1 << i);
+
+      ++i;
+    }
+
+  *concrete_mods = concrete;
+}
+
+void
+egg_keymap_virtualize_modifiers (GdkKeymap              *keymap,
+                                 GdkModifierType         concrete_mods,
+                                 EggVirtualModifierType *virtual_mods)
+{
+  GdkModifierType virtual;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (virtual_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  virtual = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if ((1 << i) & concrete_mods)
+        {
+          EggVirtualModifierType cleaned;
+
+          cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK |
+                                           EGG_VIRTUAL_MOD3_MASK |
+                                           EGG_VIRTUAL_MOD4_MASK |
+                                           EGG_VIRTUAL_MOD5_MASK);
+
+          if (cleaned != 0)
+            {
+              virtual |= cleaned;
+            }
+          else
+            {
+              /* Rather than dropping mod2->mod5 if not bound,
+               * go ahead and use the concrete names
+               */
+              virtual |= modmap->mapping[i];
+            }
+        }
+
+      ++i;
+    }
+
+  *virtual_mods = virtual;
+}
+
+static void
+reload_modmap (GdkKeymap *keymap,
+               EggModmap *modmap)
+{
+  XModifierKeymap *xmodmap;
+  int map_size;
+  int i;
+
+  /* FIXME multihead */
+  xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ());
+
+  memset (modmap->mapping, 0, sizeof (modmap->mapping));
+
+  /* there are 8 modifiers, and the first 3 are shift, shift lock,
+   * and control
+   */
+  map_size = 8 * xmodmap->max_keypermod;
+  i = 3 * xmodmap->max_keypermod;
+  while (i < map_size)
+    {
+      /* get the key code at this point in the map,
+       * see if its keysym is one we're interested in
+       */
+      int keycode = xmodmap->modifiermap[i];
+      GdkKeymapKey *keys;
+      guint *keyvals;
+      int n_entries;
+      int j;
+      EggVirtualModifierType mask;
+
+      keys = NULL;
+      keyvals = NULL;
+      n_entries = 0;
+
+      gdk_keymap_get_entries_for_keycode (keymap,
+                                          keycode,
+                                          &keys, &keyvals, &n_entries);
+
+      mask = 0;
+      j = 0;
+      while (j < n_entries)
+        {
+          if (keyvals[j] == GDK_KEY_Num_Lock)
+            mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Scroll_Lock)
+            mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Meta_L ||
+                   keyvals[j] == GDK_KEY_Meta_R)
+            mask |= EGG_VIRTUAL_META_MASK;
+          else if (keyvals[j] == GDK_KEY_Hyper_L ||
+                   keyvals[j] == GDK_KEY_Hyper_R)
+            mask |= EGG_VIRTUAL_HYPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Super_L ||
+                   keyvals[j] == GDK_KEY_Super_R)
+            mask |= EGG_VIRTUAL_SUPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Mode_switch)
+            mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
+
+          ++j;
+        }
+
+      /* Mod1Mask is 1 << 3 for example, i.e. the
+       * fourth modifier, i / keyspermod is the modifier
+       * index
+       */
+      modmap->mapping[i/xmodmap->max_keypermod] |= mask;
+
+      g_free (keyvals);
+      g_free (keys);
+
+      ++i;
+    }
+
+  /* Add in the not-really-virtual fixed entries */
+  modmap->mapping[EGG_MODMAP_ENTRY_SHIFT] |= EGG_VIRTUAL_SHIFT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_CONTROL] |= EGG_VIRTUAL_CONTROL_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_LOCK] |= EGG_VIRTUAL_LOCK_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD1] |= EGG_VIRTUAL_ALT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD2] |= EGG_VIRTUAL_MOD2_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK;
+
+  XFreeModifiermap (xmodmap);
+}
+
+const EggModmap*
+egg_keymap_get_modmap (GdkKeymap *keymap)
+{
+  EggModmap *modmap;
+
+  /* This is all a hack, much simpler when we can just
+   * modify GDK directly.
+   */
+
+  modmap = g_object_get_data (G_OBJECT (keymap),
+                              "egg-modmap");
+
+  if (modmap == NULL)
+    {
+      modmap = g_new0 (EggModmap, 1);
+
+      /* FIXME modify keymap change events with an event filter
+       * and force a reload if we get one
+       */
+
+      reload_modmap (keymap, modmap);
+
+      g_object_set_data_full (G_OBJECT (keymap),
+                              "egg-modmap",
+                              modmap,
+                              g_free);
+    }
+
+  g_assert (modmap != NULL);
+
+  return modmap;
+}
+
+
+
+
+ + + diff --git a/2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/2.html b/2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/2.html new file mode 100644 index 0000000..808ce42 --- /dev/null +++ b/2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/2.html @@ -0,0 +1,857 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
/* tomboykeybinder.c
+ * Copyright (C) 2008 Novell
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+#include <string.h>
+
+#include <gdk/gdk.h>
+#include <gdk/gdkwindow.h>
+#include <gdk/gdkx.h>
+#include <X11/Xlib.h>
+
+#include "eggaccelerators.h"
+#include "tomboykeybinder.h"
+
+/* Uncomment the next line to print a debug trace. */
+/* #define DEBUG */
+
+#ifdef DEBUG
+#  define TRACE(x) x
+#else
+#  define TRACE(x) do {} while (FALSE);
+#endif
+
+typedef struct _Binding {
+	TomboyBindkeyHandler  handler;
+	gpointer              user_data;
+	char                 *keystring;
+	uint                  keycode;
+	uint                  modifiers;
+} Binding;
+
+static GSList *bindings = NULL;
+static guint32 last_event_time = 0;
+static gboolean processing_event = FALSE;
+
+static guint num_lock_mask, caps_lock_mask, scroll_lock_mask;
+
+static void
+lookup_ignorable_modifiers (GdkKeymap *keymap)
+{
+	egg_keymap_resolve_virtual_modifiers (keymap,
+					      EGG_VIRTUAL_LOCK_MASK,
+					      &caps_lock_mask);
+
+	egg_keymap_resolve_virtual_modifiers (keymap,
+					      EGG_VIRTUAL_NUM_LOCK_MASK,
+					      &num_lock_mask);
+
+	egg_keymap_resolve_virtual_modifiers (keymap,
+					      EGG_VIRTUAL_SCROLL_LOCK_MASK,
+					      &scroll_lock_mask);
+}
+
+static void
+grab_ungrab_with_ignorable_modifiers (GdkWindow *rootwin,
+				      Binding   *binding,
+				      gboolean   grab)
+{
+	guint mod_masks [] = {
+		0, /* modifier only */
+		num_lock_mask,
+		caps_lock_mask,
+		scroll_lock_mask,
+		num_lock_mask  | caps_lock_mask,
+		num_lock_mask  | scroll_lock_mask,
+		caps_lock_mask | scroll_lock_mask,
+		num_lock_mask  | caps_lock_mask | scroll_lock_mask,
+	};
+	guint i;
+
+	for (i = 0; i < G_N_ELEMENTS (mod_masks); i++) {
+		if (grab) {
+			XGrabKey (GDK_WINDOW_XDISPLAY (rootwin),
+				  binding->keycode,
+				  binding->modifiers | mod_masks [i],
+				  GDK_WINDOW_XID (rootwin),
+				  False,
+				  GrabModeAsync,
+				  GrabModeAsync);
+		} else {
+			XUngrabKey (GDK_WINDOW_XDISPLAY (rootwin),
+				    binding->keycode,
+				    binding->modifiers | mod_masks [i],
+				    GDK_WINDOW_XID (rootwin));
+		}
+	}
+}
+
+static gboolean
+do_grab_key (Binding *binding)
+{
+	GdkDisplay *gdk_display = gdk_display_get_default ();
+	GdkKeymap *keymap = gdk_keymap_get_for_display (gdk_display);
+	GdkWindow *rootwin = gdk_get_default_root_window ();
+
+	EggVirtualModifierType virtual_mods = 0;
+	guint keysym = 0;
+
+	if (keymap == NULL || rootwin == NULL)
+		return FALSE;
+
+	if (!egg_accelerator_parse_virtual (binding->keystring,
+					    &keysym,
+					    &virtual_mods))
+		return FALSE;
+
+	TRACE (g_print ("Got accel %d, %d\n", keysym, virtual_mods));
+
+	binding->keycode = XKeysymToKeycode (GDK_WINDOW_XDISPLAY (rootwin),
+					     keysym);
+	if (binding->keycode == 0)
+		return FALSE;
+
+	TRACE (g_print ("Got keycode %d\n", binding->keycode));
+
+	egg_keymap_resolve_virtual_modifiers (keymap,
+					      virtual_mods,
+					      &binding->modifiers);
+	if (binding->modifiers == 0)
+		return FALSE;
+
+	TRACE (g_print ("Got modmask %d\n", binding->modifiers));
+
+	gdk_x11_display_error_trap_push (gdk_display);
+
+	grab_ungrab_with_ignorable_modifiers (rootwin,
+					      binding,
+					      TRUE /* grab */);
+
+	gdk_display_flush (gdk_display);
+
+	if (gdk_x11_display_error_trap_pop (gdk_display)) {
+	   g_warning ("Binding '%s' failed!\n", binding->keystring);
+	   return FALSE;
+	}
+
+	return TRUE;
+}
+
+static gboolean
+do_ungrab_key (Binding *binding)
+{
+	GdkWindow *rootwin = gdk_get_default_root_window ();
+
+	TRACE (g_print ("Removing grab for '%s'\n", binding->keystring));
+
+	grab_ungrab_with_ignorable_modifiers (rootwin,
+					      binding,
+					      FALSE /* ungrab */);
+
+	return TRUE;
+}
+
+static GdkFilterReturn
+filter_func (GdkXEvent *gdk_xevent, GdkEvent *event G_GNUC_UNUSED,
+             gpointer data G_GNUC_UNUSED)
+{
+	GdkFilterReturn return_val = GDK_FILTER_CONTINUE;
+	XEvent *xevent = (XEvent *) gdk_xevent;
+	guint event_mods;
+	GSList *iter;
+
+	TRACE (g_print ("Got Event! %d, %d\n", xevent->type, event->type));
+
+	switch (xevent->type) {
+	case KeyPress:
+		TRACE (g_print ("Got KeyPress! keycode: %d, modifiers: %d\n",
+				xevent->xkey.keycode,
+				xevent->xkey.state));
+
+		/*
+		 * Set the last event time for use when showing
+		 * windows to avoid anti-focus-stealing code.
+		 */
+		processing_event = TRUE;
+		last_event_time = xevent->xkey.time;
+
+		event_mods = xevent->xkey.state & ~(num_lock_mask  |
+						    caps_lock_mask |
+						    scroll_lock_mask);
+
+		for (iter = bindings; iter != NULL; iter = iter->next) {
+			Binding *binding = (Binding *) iter->data;
+
+			if (binding->keycode == xevent->xkey.keycode &&
+			    binding->modifiers == event_mods) {
+
+				TRACE (g_print ("Calling handler for '%s'...\n",
+						binding->keystring));
+
+				(binding->handler) (binding->keystring,
+						    binding->user_data);
+			}
+		}
+
+		processing_event = FALSE;
+		break;
+	case KeyRelease:
+		TRACE (g_print ("Got KeyRelease! \n"));
+		break;
+	}
+
+	return return_val;
+}
+
+static void
+keymap_changed (GdkKeymap *map G_GNUC_UNUSED)
+{
+	GdkKeymap *keymap = gdk_keymap_get_for_display (gdk_display_get_default ());
+	GSList *iter;
+
+	TRACE (g_print ("Keymap changed! Regrabbing keys..."));
+
+	for (iter = bindings; iter != NULL; iter = iter->next) {
+		Binding *binding = (Binding *) iter->data;
+		do_ungrab_key (binding);
+	}
+
+	lookup_ignorable_modifiers (keymap);
+
+	for (iter = bindings; iter != NULL; iter = iter->next) {
+		Binding *binding = (Binding *) iter->data;
+		do_grab_key (binding);
+	}
+}
+
+void
+tomboy_keybinder_init (void)
+{
+	GdkKeymap *keymap = gdk_keymap_get_for_display (gdk_display_get_default ());
+	GdkWindow *rootwin = gdk_get_default_root_window ();
+
+	lookup_ignorable_modifiers (keymap);
+
+	gdk_window_add_filter (rootwin,
+			       filter_func,
+			       NULL);
+
+	g_signal_connect (keymap,
+			  "keys_changed",
+			  G_CALLBACK (keymap_changed),
+			  NULL);
+}
+
+void
+tomboy_keybinder_bind (const char           *keystring,
+		       TomboyBindkeyHandler  handler,
+		       gpointer              user_data)
+{
+	Binding *binding;
+	gboolean success;
+
+	binding = g_new0 (Binding, 1);
+	binding->keystring = g_strdup (keystring);
+	binding->handler = handler;
+	binding->user_data = user_data;
+
+	/* Sets the binding's keycode and modifiers */
+	success = do_grab_key (binding);
+
+	if (success) {
+		bindings = g_slist_prepend (bindings, binding);
+	} else {
+		g_free (binding->keystring);
+		g_free (binding);
+	}
+}
+
+void
+tomboy_keybinder_unbind (const char           *keystring,
+			 TomboyBindkeyHandler  handler)<--- Parameter 'handler' can be declared with const
+{
+	GSList *iter;
+
+	for (iter = bindings; iter != NULL; iter = iter->next) {
+		Binding *binding = (Binding *) iter->data;
+
+		if (strcmp (keystring, binding->keystring) != 0 ||
+		    handler != binding->handler)
+			continue;
+
+		do_ungrab_key (binding);
+
+		bindings = g_slist_remove (bindings, binding);
+
+		g_free (binding->keystring);
+		g_free (binding);
+		break;
+	}
+}
+
+/*
+ * From eggcellrenderkeys.c.
+ */
+gboolean
+tomboy_keybinder_is_modifier (guint keycode)
+{
+	gint i;
+	gint map_size;
+	XModifierKeymap *mod_keymap;
+	gboolean retval = FALSE;
+
+	mod_keymap = XGetModifierMapping (gdk_x11_get_default_xdisplay());
+
+	map_size = 8 * mod_keymap->max_keypermod;
+
+	i = 0;
+	while (i < map_size) {
+		if (keycode == mod_keymap->modifiermap[i]) {
+			retval = TRUE;
+			break;
+		}
+		++i;
+	}
+
+	XFreeModifiermap (mod_keymap);
+
+	return retval;
+}
+
+guint32
+tomboy_keybinder_get_current_event_time (void)
+{
+	if (processing_event)
+		return last_event_time;
+	else
+		return GDK_CURRENT_TIME;
+}
+
+
+
+
+ + + diff --git a/2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/index.html b/2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/index.html new file mode 100644 index 0000000..ff55bd0 --- /dev/null +++ b/2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/index.html @@ -0,0 +1,122 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+ + + + + + + + + + + +
LineIdCWESeverityMessage
missingIncludeSysteminformationCppcheck cannot find all the include files (use --check-config for details)
src/applet-main.c
576constParameter398styleParameter 'entry' can be declared with const
src/eggaccelerators.c
321duplicateExpression398styleSame expression on both sides of '-='.
src/tomboykeybinder.c
284constParameter398styleParameter 'handler' can be declared with const
+
+
+ + + diff --git a/2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/stats.html b/2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/stats.html new file mode 100644 index 0000000..3074784 --- /dev/null +++ b/2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/stats.html @@ -0,0 +1,107 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+

Top 10 files for style severity, total findings: 3
+   1  src/tomboykeybinder.c
+   1  src/eggaccelerators.c
+   1  src/applet-main.c
+

+ +
+
+ + + diff --git a/2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/style.css b/2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-11-20-205807-3444-cppcheck@8f9ca2537035_master/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/0.html b/2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/0.html new file mode 100644 index 0000000..d57f9d5 --- /dev/null +++ b/2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/0.html @@ -0,0 +1,2381 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
/*
+A small wrapper utility to load indicators and put them as menu items
+into the mate-panel using it's applet interface.
+
+Copyright 2009-2010 Canonical Ltd.
+
+Authors:
+    Ted Gould <ted@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+#include <string.h>
+#include <config.h>
+#include <glib/gi18n.h>
+#include <mate-panel-applet.h>
+#include <gdk/gdkkeysyms.h>
+#include <gtk/gtk.h>
+
+#if HAVE_UBUNTU_INDICATOR
+
+#define INDICATOR_SERVICE_APPMENU	"libappmenu.so"
+#define INDICATOR_SERVICE_ME		"libme.so"
+#define INDICATOR_SERVICE_DATETIME	"libdatetime.so"
+
+#define INDICATOR_SERVICE_APPMENU_NG	"com.canonical.indicator.appmenu"
+#define INDICATOR_SERVICE_ME_NG		"com.canonical.indicator.me"
+#define INDICATOR_SERVICE_DATETIME_NG	"com.canonical.indicator.datetime"
+
+#include <libindicator/indicator-object.h>
+#endif
+
+#if HAVE_AYATANA_INDICATOR
+
+#define INDICATOR_SERVICE_APPMENU	"libayatana-appmenu.so"
+#define INDICATOR_SERVICE_ME		"libayatana-me.so"
+#define INDICATOR_SERVICE_DATETIME	"libayatana-datetime.so"
+
+#define INDICATOR_SERVICE_APPMENU_NG	"org.ayatana.indicator.appmenu"
+#define INDICATOR_SERVICE_ME_NG		"org.ayatana.indicator.me"
+#define INDICATOR_SERVICE_DATETIME_NG	"org.ayatana.indicator.datetime"
+
+#include <libayatana-indicator/indicator-object.h>
+#endif
+
+/* For new style indicators */
+
+#if HAVE_UBUNTU_INDICATOR && HAVE_UBUNTU_INDICATOR_NG
+
+#include <libido/libido.h>
+#include <libindicator/indicator-ng.h>
+
+#define INDICATOR_SERVICE_DIR "/usr/share/unity/indicators"
+
+#endif
+
+#if HAVE_AYATANA_INDICATOR && HAVE_AYATANA_INDICATOR_NG
+
+#include <libayatana-ido/libayatana-ido.h>
+#include <libayatana-indicator/indicator-ng.h>
+
+#define INDICATOR_SERVICE_DIR "/usr/share/ayatana/indicators"
+
+#endif
+
+#include "tomboykeybinder.h"
+
+static gchar * indicator_order[] = {
+#if HAVE_UBUNTU_INDICATOR
+	"libapplication.so",
+	"libmessaging.so",
+	"libsoundmenu.so",
+	"libdatetime.so",
+	"libsession.so",
+#endif
+#if HAVE_AYATANA_INDICATOR
+	"libayatana-application.so",
+	"libayatana-messaging.so",
+	"libayatana-soundmenu.so",
+	"libayatana-datetime.so",
+	"libayatana-session.so",
+#endif
+	NULL
+};
+
+static GtkPackDirection packdirection;
+static MatePanelAppletOrient orient;
+static guint size;
+
+#define  MENU_DATA_INDICATOR_OBJECT  "indicator-object"
+#define  MENU_DATA_INDICATOR_ENTRY   "indicator-entry"
+
+#define  IO_DATA_ORDER_NUMBER        "indicator-order-number"
+
+static gboolean     applet_fill_cb (MatePanelApplet * applet, const gchar * iid, gpointer data);
+
+static void update_accessible_desc (IndicatorObjectEntry * entry, GtkWidget * menuitem);
+
+/*************
+ * main
+ * ***********/
+
+#ifdef INDICATOR_APPLET
+MATE_PANEL_APPLET_OUT_PROCESS_FACTORY ("IndicatorAppletFactory",
+               PANEL_TYPE_APPLET,
+               "indicator-applet",
+               applet_fill_cb, NULL);
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+MATE_PANEL_APPLET_OUT_PROCESS_FACTORY ("IndicatorAppletCompleteFactory",
+               PANEL_TYPE_APPLET,
+               "indicator-applet-complete",
+               applet_fill_cb, NULL);
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+MATE_PANEL_APPLET_OUT_PROCESS_FACTORY ("IndicatorAppletAppmenuFactory",
+               PANEL_TYPE_APPLET,
+               "indicator-applet-appmenu",
+               applet_fill_cb, NULL);
+#endif
+
+/*************
+ * log files
+ * ***********/
+#ifdef INDICATOR_APPLET
+#define LOG_FILE_NAME  "indicator-applet.log"
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+#define LOG_FILE_NAME  "indicator-applet-complete.log"
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+#define LOG_FILE_NAME  "indicator-applet-appmenu.log"
+#endif
+GOutputStream * log_file = NULL;
+
+/*****************
+ * Hotkey support
+ * **************/
+#ifdef INDICATOR_APPLET
+gchar * hotkey_keycode = "<Super>M";
+#endif
+#ifdef INDICATOR_APPLET_SESSION
+gchar * hotkey_keycode = "<Super>S";
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+gchar * hotkey_keycode = "<Super>S";
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+gchar * hotkey_keycode = "<Super>F1";
+#endif
+
+/********************
+ * Environment Names
+ * *******************/
+#ifdef INDICATOR_APPLET
+#define INDICATOR_SPECIFIC_ENV  "indicator-applet-original"
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+#define INDICATOR_SPECIFIC_ENV  "indicator-applet-complete"
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+#define INDICATOR_SPECIFIC_ENV  "indicator-applet-appmenu"
+#endif
+
+static const gchar * indicator_env[] = {
+	"indicator-applet",
+	INDICATOR_SPECIFIC_ENV,
+	NULL
+};
+
+/*************
+ * init function
+ * ***********/
+
+static gint
+name2order (const gchar * name) {
+	int i;
+
+	for (i = 0; indicator_order[i] != NULL; i++) {
+		if (g_strcmp0(name, indicator_order[i]) == 0) {
+			return i;
+		}
+	}
+
+	return -1;
+}
+
+typedef struct _incoming_position_t incoming_position_t;
+struct _incoming_position_t {
+	gint objposition;
+	gint entryposition;
+	gint menupos;
+	gboolean found;
+};
+
+/* This function helps by determining where in the menu list
+   this new entry should be placed.  It compares the objects
+   that they're on, and then the individual entries.  Each
+   is progressively more expensive. */
+static void
+place_in_menu (GtkWidget * widget, gpointer user_data)
+{
+	incoming_position_t * position = (incoming_position_t *)user_data;
+	if (position->found) {
+		/* We've already been placed, just finish the foreach */
+		return;
+	}
+
+	IndicatorObject * io = INDICATOR_OBJECT(g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_OBJECT));
+	g_assert(io != NULL);
+
+	gint objposition = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER));
+	/* We've already passed it, well, then this is where
+	   we should be be.  Stop! */
+	if (objposition > position->objposition) {
+		position->found = TRUE;
+		return;
+	}
+
+	/* The objects don't match yet, keep looking */
+	if (objposition < position->objposition) {
+		position->menupos++;
+		return;
+	}
+
+	/* The objects are the same, let's start looking at entries. */
+	IndicatorObjectEntry * entry = (IndicatorObjectEntry *)g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY);
+	gint entryposition = indicator_object_get_location(io, entry);
+
+	if (entryposition > position->entryposition) {
+		position->found = TRUE;
+		return;
+	}
+
+	if (entryposition < position->entryposition) {
+		position->menupos++;
+		return;
+	}
+
+	/* We've got the same object and the same entry.  Well,
+	   let's just put it right here then. */
+	position->found = TRUE;
+	return;
+}
+
+static void
+something_shown (GtkWidget * widget, gpointer user_data)
+{
+	GtkWidget * menuitem = GTK_WIDGET(user_data);
+	gtk_widget_show(menuitem);
+}
+
+static void
+something_hidden (GtkWidget * widget, gpointer user_data)
+{
+	GtkWidget * menuitem = GTK_WIDGET(user_data);
+	gtk_widget_hide(menuitem);
+}
+
+static void
+sensitive_cb (GObject * obj, GParamSpec * pspec, gpointer user_data)
+{
+	g_return_if_fail(GTK_IS_WIDGET(obj));
+	g_return_if_fail(GTK_IS_WIDGET(user_data));
+
+	gtk_widget_set_sensitive(GTK_WIDGET(user_data), gtk_widget_get_sensitive(GTK_WIDGET(obj)));
+	return;
+}
+
+static void
+entry_activated (GtkWidget * widget, gpointer user_data)
+{
+	g_return_if_fail(GTK_IS_WIDGET(widget));
+	gpointer pio = g_object_get_data(G_OBJECT(widget), "indicator");
+	g_return_if_fail(INDICATOR_IS_OBJECT(pio));
+	IndicatorObject * io = INDICATOR_OBJECT(pio);
+
+	return indicator_object_entry_activate(io, (IndicatorObjectEntry *)user_data, gtk_get_current_event_time());
+}
+
+static gboolean
+entry_scrolled (GtkWidget *menuitem, GdkEventScroll *event, gpointer data)
+{
+	IndicatorObject *io = g_object_get_data (G_OBJECT (menuitem), MENU_DATA_INDICATOR_OBJECT);
+	IndicatorObjectEntry *entry = g_object_get_data (G_OBJECT (menuitem), MENU_DATA_INDICATOR_ENTRY);
+
+	g_return_val_if_fail(INDICATOR_IS_OBJECT(io), FALSE);
+
+	g_signal_emit_by_name (io, "scroll", 1, event->direction);
+	g_signal_emit_by_name (io, "scroll-entry", entry, 1, event->direction);
+	g_signal_emit_by_name (io, INDICATOR_OBJECT_SIGNAL_ENTRY_SCROLLED, entry, 1, event->direction);
+
+	return FALSE;
+}
+
+static gboolean
+entry_pressed (GtkWidget *menuitem, GdkEvent *event, gpointer data)
+{
+       g_return_val_if_fail(GTK_IS_MENU_ITEM(menuitem), FALSE);
+
+       if (((GdkEventButton*)event)->button == 2) /* middle button */
+       {
+               gtk_widget_grab_focus(menuitem);
+
+               return TRUE;
+       }
+
+       return FALSE;
+}
+
+static gboolean
+entry_released (GtkWidget *menuitem, GdkEvent *event, gpointer data)
+{
+       g_return_val_if_fail(GTK_IS_MENU_ITEM(menuitem), FALSE);
+
+       if (((GdkEventButton*)event)->button == 2) /* middle button */
+       {
+               IndicatorObject *io = g_object_get_data (G_OBJECT (menuitem), MENU_DATA_INDICATOR_OBJECT);
+               IndicatorObjectEntry *entry = g_object_get_data (G_OBJECT (menuitem), MENU_DATA_INDICATOR_ENTRY);
+
+               g_return_val_if_fail(INDICATOR_IS_OBJECT(io), FALSE);
+
+               g_signal_emit_by_name (io, INDICATOR_OBJECT_SIGNAL_SECONDARY_ACTIVATE, entry,
+                       ((GdkEventButton*)event)->time);
+
+               return TRUE;
+       }
+
+       return FALSE;
+}
+
+static void
+accessible_desc_update_cb (GtkWidget * widget, gpointer userdata)
+{
+	gpointer data = g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY);
+
+	if (data != userdata) {
+		return;
+	}
+
+	IndicatorObjectEntry * entry = (IndicatorObjectEntry *)data;
+	update_accessible_desc(entry, widget);
+}
+
+static void
+accessible_desc_update (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menubar)
+{
+	gtk_container_foreach(GTK_CONTAINER(menubar), accessible_desc_update_cb, entry);
+	return;
+}
+
+#define PANEL_PADDING 8
+static gboolean
+entry_resized (GtkWidget *applet, guint newsize, gpointer data)
+{
+	IndicatorObject *io = (IndicatorObject *)data;
+
+	size = newsize;
+
+	/* Work on the entries */
+	GList * entries = indicator_object_get_entries(io);
+	GList * entry = NULL;
+
+	for (entry = entries; entry != NULL; entry = g_list_next(entry)) {
+		IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)entry->data;
+		if (entrydata->image != NULL) {
+			/* Resize to fit panel */
+			gtk_image_set_pixel_size (entrydata->image, size - PANEL_PADDING);
+		}
+	}
+
+	return FALSE;
+}
+
+static void
+entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menubar)
+{
+	g_debug("Signal: Entry Added");
+	gboolean something_visible = FALSE;
+	gboolean something_sensitive = FALSE;
+
+	GtkWidget * menuitem = gtk_menu_item_new();
+	GtkWidget * box = (packdirection == GTK_PACK_DIRECTION_LTR) ?
+		gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3) : gtk_box_new(GTK_ORIENTATION_VERTICAL, 3);
+
+	/* Allows indicators to receive mouse scroll event */
+	gtk_widget_add_events(GTK_WIDGET(menuitem), GDK_SCROLL_MASK);
+	gtk_widget_add_events(GTK_WIDGET(menuitem), GDK_BUTTON_PRESS_MASK);
+	gtk_widget_add_events(GTK_WIDGET(menuitem), GDK_BUTTON_RELEASE_MASK);
+
+	g_object_set_data (G_OBJECT (menuitem), "indicator", io);
+	g_object_set_data (G_OBJECT (menuitem), "box", box);
+
+	g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(entry_activated), entry);
+	g_signal_connect(G_OBJECT(menuitem), "scroll-event", G_CALLBACK(entry_scrolled), entry);
+	g_signal_connect(G_OBJECT(menuitem), "button-press-event", G_CALLBACK(entry_pressed), entry);
+	g_signal_connect(G_OBJECT(menuitem), "button-release-event", G_CALLBACK(entry_released), entry);
+
+	if (entry->image != NULL) {
+		/* Resize to fit panel */
+		gtk_image_set_pixel_size (entry->image, size - PANEL_PADDING);
+		gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(entry->image), FALSE, FALSE, 1);
+		if (gtk_widget_get_visible(GTK_WIDGET(entry->image))) {
+			something_visible = TRUE;
+		}
+
+		if (gtk_widget_get_sensitive(GTK_WIDGET(entry->image))) {
+			something_sensitive = TRUE;
+		}
+
+		g_signal_connect(G_OBJECT(entry->image), "show", G_CALLBACK(something_shown), menuitem);
+		g_signal_connect(G_OBJECT(entry->image), "hide", G_CALLBACK(something_hidden), menuitem);
+
+		g_signal_connect(G_OBJECT(entry->image), "notify::sensitive", G_CALLBACK(sensitive_cb), menuitem);
+	}
+	if (entry->label != NULL) {
+		switch(packdirection) {
+			case GTK_PACK_DIRECTION_LTR:
+				gtk_label_set_angle(GTK_LABEL(entry->label), 0.0);
+				break;
+			case GTK_PACK_DIRECTION_TTB:
+				gtk_label_set_angle(GTK_LABEL(entry->label),
+						(orient == MATE_PANEL_APPLET_ORIENT_LEFT) ?
+						270.0 : 90.0);
+				break;
+			default:
+				break;
+		}
+		gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(entry->label), FALSE, FALSE, 1);
+
+		if (gtk_widget_get_visible(GTK_WIDGET(entry->label))) {
+			something_visible = TRUE;
+		}
+
+		if (gtk_widget_get_sensitive(GTK_WIDGET(entry->label))) {
+			something_sensitive = TRUE;
+		}
+
+		g_signal_connect(G_OBJECT(entry->label), "show", G_CALLBACK(something_shown), menuitem);
+		g_signal_connect(G_OBJECT(entry->label), "hide", G_CALLBACK(something_hidden), menuitem);
+
+		g_signal_connect(G_OBJECT(entry->label), "notify::sensitive", G_CALLBACK(sensitive_cb), menuitem);
+	}
+	gtk_container_add(GTK_CONTAINER(menuitem), box);
+	gtk_widget_show(box);
+
+	if (entry->menu != NULL) {
+		gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(entry->menu));
+	}
+
+	incoming_position_t position;
+	position.objposition = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER));
+	position.entryposition = indicator_object_get_location(io, entry);
+	position.menupos = 0;
+	position.found = FALSE;
+
+	gtk_container_foreach(GTK_CONTAINER(menubar), place_in_menu, &position);
+
+	gtk_menu_shell_insert(GTK_MENU_SHELL(menubar), menuitem, position.menupos);
+
+	if (something_visible) {
+		if (entry->accessible_desc != NULL) {
+			update_accessible_desc(entry, menuitem);
+		}
+		gtk_widget_show(menuitem);
+	}
+	gtk_widget_set_sensitive(menuitem, something_sensitive);
+
+	g_object_set_data(G_OBJECT(menuitem), MENU_DATA_INDICATOR_ENTRY,  entry);
+	g_object_set_data(G_OBJECT(menuitem), MENU_DATA_INDICATOR_OBJECT, io);
+
+	return;
+}
+
+static void
+entry_removed_cb (GtkWidget * widget, gpointer userdata)
+{
+	gpointer data = g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY);
+
+	if (data != userdata) {
+		return;
+	}
+
+	IndicatorObjectEntry * entry = (IndicatorObjectEntry *)data;
+	if (entry->label != NULL) {
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->label), G_CALLBACK(something_shown), widget);
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->label), G_CALLBACK(something_hidden), widget);
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->label), G_CALLBACK(sensitive_cb), widget);
+	}
+	if (entry->image != NULL) {
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->image), G_CALLBACK(something_shown), widget);
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->image), G_CALLBACK(something_hidden), widget);
+		g_signal_handlers_disconnect_by_func(G_OBJECT(entry->image), G_CALLBACK(sensitive_cb), widget);
+	}
+
+	gtk_widget_destroy(widget);
+	return;
+}
+
+static void
+entry_removed (IndicatorObject * io G_GNUC_UNUSED, IndicatorObjectEntry * entry,
+               gpointer user_data)
+{
+	g_debug("Signal: Entry Removed");
+
+	gtk_container_foreach(GTK_CONTAINER(user_data), entry_removed_cb, entry);
+
+	return;
+}
+
+static void
+entry_moved_find_cb (GtkWidget * widget, gpointer userdata)
+{
+	gpointer * array = (gpointer *)userdata;
+	if (array[1] != NULL) {
+		return;
+	}
+
+	gpointer data = g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY);
+
+	if (data != array[0]) {
+		return;
+	}
+
+	array[1] = widget;
+	return;
+}
+
+/* Gets called when an entry for an object was moved. */
+static void
+entry_moved (IndicatorObject * io, IndicatorObjectEntry * entry,
+             gint old G_GNUC_UNUSED, gint new G_GNUC_UNUSED, gpointer user_data)
+{
+	GtkWidget * menubar = GTK_WIDGET(user_data);
+
+	gpointer array[2];
+	array[0] = entry;
+	array[1] = NULL;
+
+	gtk_container_foreach(GTK_CONTAINER(menubar), entry_moved_find_cb, array);
+	if (array[1] == NULL) {
+		g_warning("Moving an entry that isn't in our menus.");
+		return;
+	}
+
+	GtkWidget * mi = GTK_WIDGET(array[1]);
+	g_object_ref(G_OBJECT(mi));
+	gtk_container_remove(GTK_CONTAINER(menubar), mi);
+
+	incoming_position_t position;
+	position.objposition = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER));
+	position.entryposition = indicator_object_get_location(io, entry);
+	position.menupos = 0;
+	position.found = FALSE;
+
+	gtk_container_foreach(GTK_CONTAINER(menubar), place_in_menu, &position);
+
+	gtk_menu_shell_insert(GTK_MENU_SHELL(menubar), mi, position.menupos);
+	g_object_unref(G_OBJECT(mi));
+
+	return;
+}
+
+static void
+menu_show (IndicatorObject * io, IndicatorObjectEntry * entry,<--- Parameter 'entry' can be declared with const
+           guint32 timestamp, gpointer user_data)
+{
+	GtkWidget * menubar = GTK_WIDGET(user_data);
+
+	if (entry == NULL) {
+		/* Close any open menus instead of opening one */
+		GList * entries = indicator_object_get_entries(io);
+		GList * iterator = NULL;
+		for (iterator = entries; iterator != NULL; iterator = g_list_next(iterator)) {
+			IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)iterator->data;
+			gtk_menu_popdown(entrydata->menu);
+		}
+		g_list_free(entries);
+
+		/* And tell the menubar to exit activation mode too */
+		gtk_menu_shell_cancel(GTK_MENU_SHELL(menubar));
+		return;
+	}
+
+	// TODO: do something sensible here
+}
+
+static void
+update_accessible_desc(IndicatorObjectEntry * entry, GtkWidget * menuitem)
+{
+	/* FIXME: We need to deal with the use case where the contents of the
+	   label overrides what is found in the atk object's name, or at least
+	   orca speaks the label instead of the atk object name.
+	 */
+	AtkObject * menuitem_obj = gtk_widget_get_accessible(menuitem);
+	if (menuitem_obj == NULL) {
+		/* Should there be an error printed here? */
+		return;
+	}
+
+	if (entry->accessible_desc != NULL) {
+		atk_object_set_name(menuitem_obj, entry->accessible_desc);
+	} else {
+		atk_object_set_name(menuitem_obj, "");
+	}
+	return;
+}
+
+static void
+load_indicator (MatePanelApplet *applet, GtkWidget * menubar, IndicatorObject *io, const gchar *name)
+{
+	/* Set the environment it's in */
+	indicator_object_set_environment(io, (const GStrv)indicator_env);
+
+	/* Attach the 'name' to the object */
+#if HAVE_AYATANA_INDICATOR_NG || HAVE_UBUNTU_INDICATOR_NG
+	int pos = 5000 - indicator_object_get_position(io);
+	if (pos > 5000) {
+		pos = name2order(name);
+	}
+#else
+	int pos = name2order(name);
+#endif
+
+	g_object_set_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER, GINT_TO_POINTER(pos));
+
+	/* Connect to its signals */
+	g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED,   G_CALLBACK(entry_added),    menubar);
+	g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED, G_CALLBACK(entry_removed),  menubar);
+	g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED,   G_CALLBACK(entry_moved),    menubar);
+	g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_MENU_SHOW,     G_CALLBACK(menu_show),      menubar);
+	g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE, G_CALLBACK(accessible_desc_update), menubar);
+
+	/* Track panel resize */
+	g_signal_connect_object(G_OBJECT(applet), "change-size", G_CALLBACK(entry_resized), G_OBJECT(io), 0);
+
+	/* Work on the entries */
+	GList * entries = indicator_object_get_entries(io);
+	GList * entry = NULL;
+
+	for (entry = entries; entry != NULL; entry = g_list_next(entry)) {
+		IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)entry->data;
+		entry_added(io, entrydata, menubar);
+	}
+
+	g_list_free(entries);
+}
+
+static gboolean
+load_module (const gchar * name, MatePanelApplet *applet, GtkWidget * menubar)
+{
+	g_debug("Looking at Module: %s", name);
+	g_return_val_if_fail(name != NULL, FALSE);
+
+	if (!g_str_has_suffix(name, G_MODULE_SUFFIX)) {
+		return FALSE;
+	}
+
+	g_debug("Loading Module: %s", name);
+
+	/* Build the object for the module */
+	gchar * fullpath = g_build_filename(INDICATOR_DIR, name, NULL);
+	IndicatorObject * io = indicator_object_new_from_file(fullpath);
+	g_free(fullpath);
+
+	load_indicator(applet, menubar, io, name);
+
+	return TRUE;
+}
+
+static void
+load_modules (MatePanelApplet *applet, GtkWidget *menubar, gint *indicators_loaded)
+{
+	if (g_file_test(INDICATOR_DIR, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) {
+		GDir * dir = g_dir_open(INDICATOR_DIR, 0, NULL);
+
+		const gchar * name;
+		gint count = 0;
+		while ((name = g_dir_read_name(dir)) != NULL) {
+#ifdef INDICATOR_APPLET_APPMENU
+			if (g_strcmp0(name, INDICATOR_SERVICE_APPMENU)) {
+				continue;
+			}
+#else
+			if (!g_strcmp0(name, INDICATOR_SERVICE_APPMENU)) {
+				continue;
+			}
+#endif
+#ifdef INDICATOR_APPLET
+			if (!g_strcmp0(name, INDICATOR_SERVICE_ME)) {
+				continue;
+			}
+			if (!g_strcmp0(name, INDICATOR_SERVICE_DATETIME)) {
+				continue;
+			}
+#endif
+			if (load_module(name, applet, menubar)) {
+				count++;
+			}
+		}
+
+		*indicators_loaded += count;
+
+		g_dir_close (dir);
+	}
+}
+
+#if HAVE_AYATANA_INDICATOR_NG || HAVE_UBUNTU_INDICATOR_NG
+
+static void
+load_indicators_from_indicator_files (MatePanelApplet *applet, GtkWidget *menubar, gint *indicators_loaded)
+{
+	GDir *dir;
+	const gchar *name;
+	GError *error = NULL;
+
+	dir = g_dir_open (INDICATOR_SERVICE_DIR, 0, &error);
+
+	if (!dir) {
+		g_warning ("unable to open indicator service file directory: %s", error->message);
+		g_error_free (error);
+
+		return;
+	}
+
+	gint count = 0;
+	while ((name = g_dir_read_name (dir))) {
+		gchar *filename;
+		IndicatorNg *indicator;
+
+		filename = g_build_filename (INDICATOR_SERVICE_DIR, name, NULL);
+		indicator = indicator_ng_new_for_profile (filename, "desktop", &error);
+		g_free (filename);
+
+#ifdef INDICATOR_APPLET_APPMENU
+		if (g_strcmp0(name, INDICATOR_SERVICE_APPMENU_NG)) {
+			continue;
+		}
+#else
+		if (!g_strcmp0(name, INDICATOR_SERVICE_APPMENU_NG)) {
+			continue;
+		}
+#endif
+#ifdef INDICATOR_APPLET
+		if (!g_strcmp0(name, INDICATOR_SERVICE_ME_NG)) {
+			continue;
+		}
+		if (!g_strcmp0(name, INDICATOR_SERVICE_DATETIME_NG)) {
+			continue;
+		}
+#endif
+
+		if (indicator) {
+			load_indicator(applet, menubar, INDICATOR_OBJECT (indicator), name);
+			count++;
+		}else{
+			g_warning ("unable to load '%s': %s", name, error->message);
+			g_clear_error (&error);
+		}
+	}
+
+	*indicators_loaded += count;
+
+	g_dir_close (dir);
+}
+#endif  /* HAVE_AYATANA_INDICATOR_NG || HAVE_UBUNTU_INDICATOR_NG */
+
+static void
+hotkey_filter (char * keystring G_GNUC_UNUSED, gpointer data)
+{
+	g_return_if_fail(GTK_IS_MENU_SHELL(data));
+
+	/* Oh, wow, it's us! */
+	GList * children = gtk_container_get_children(GTK_CONTAINER(data));
+	if (children == NULL) {
+		g_debug("Menubar has no children");
+		return;
+	}
+
+	gtk_menu_shell_select_item(GTK_MENU_SHELL(data), GTK_WIDGET(g_list_last(children)->data));
+	g_list_free(children);
+	return;
+}
+
+static gboolean
+menubar_press (GtkWidget * widget,
+                    GdkEventButton *event,
+                    gpointer data G_GNUC_UNUSED)
+{
+	if (event->button != 1) {
+		g_signal_stop_emission_by_name(widget, "button-press-event");
+	}
+
+	return FALSE;
+}
+
+static gboolean
+menubar_on_draw (GtkWidget * widget,
+                 cairo_t * cr,
+                 GtkWidget * menubar)
+{
+	/* FIXME: either port to gtk_render_focus or remove this function */
+	if (gtk_widget_has_focus(menubar))
+		gtk_paint_focus(gtk_widget_get_style(widget),
+		                cr,
+		                gtk_widget_get_state(menubar),
+		                widget, "menubar-applet", 0, 0, -1, -1);
+
+	return FALSE;
+}
+
+static void
+about_cb (GtkAction *action G_GNUC_UNUSED,
+          gpointer   data G_GNUC_UNUSED)
+{
+	static const gchar *authors[] = {
+		"Ted Gould <ted@canonical.com>",
+		NULL
+	};
+
+	static gchar *license[] = {
+        N_("This program is free software: you can redistribute it and/or modify it "
+           "under the terms of the GNU General Public License version 3, as published "
+           "by the Free Software Foundation."),
+        N_("This program is distributed in the hope that it will be useful, but "
+           "WITHOUT ANY WARRANTY; without even the implied warranties of "
+           "MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR "
+           "PURPOSE.  See the GNU General Public License for more details."),
+        N_("You should have received a copy of the GNU General Public License along "
+           "with this program.  If not, see <http://www.gnu.org/licenses/>."),
+		NULL
+	};
+	gchar *license_i18n;
+
+	license_i18n = g_strconcat (_(license[0]), "\n\n", _(license[1]), "\n\n", _(license[2]), NULL);
+
+	gtk_show_about_dialog(NULL,
+		"version", VERSION,
+		"copyright", _("Copyright \xc2\xa9 2009-2010 Canonical, Ltd.\n"
+		               "Copyright \xc2\xa9 2011-2021 MATE developers"),
+#ifdef INDICATOR_APPLET_APPMENU
+		"comments", _("An applet to hold your application menus."),
+#endif
+		"comments", _("An applet to hold all of the system indicators."),
+		"authors", authors,
+		"license", license_i18n,
+		"wrap-license", TRUE,
+		"translator-credits", _("translator-credits"),
+		"logo-icon-name", "mate-indicator-applet",
+		"icon-name", "mate-indicator-applet",
+		"website", "https://mate-desktop.org",
+		"website-label", _("MATE Website"),
+		NULL
+	);
+
+	g_free (license_i18n);
+
+	return;
+}
+
+static gboolean
+swap_orient_cb (GtkWidget *item, gpointer data)
+{
+	GtkWidget *from = (GtkWidget *) data;
+	GtkWidget *to = (GtkWidget *) g_object_get_data(G_OBJECT(from), "to");
+	g_object_ref(G_OBJECT(item));
+	gtk_container_remove(GTK_CONTAINER(from), item);
+	if (GTK_IS_LABEL(item)) {
+			switch(packdirection) {
+			case GTK_PACK_DIRECTION_LTR:
+				gtk_label_set_angle(GTK_LABEL(item), 0.0);
+				break;
+			case GTK_PACK_DIRECTION_TTB:
+				gtk_label_set_angle(GTK_LABEL(item),
+						(orient == MATE_PANEL_APPLET_ORIENT_LEFT) ?
+						270.0 : 90.0);
+				break;
+			default:
+				break;
+		}
+	}
+	gtk_box_pack_start(GTK_BOX(to), item, FALSE, FALSE, 0);
+	return TRUE;
+}
+
+static gboolean
+reorient_box_cb (GtkWidget *menuitem, gpointer data)
+{
+	GtkWidget *from = g_object_get_data(G_OBJECT(menuitem), "box");
+	GtkWidget *to = (packdirection == GTK_PACK_DIRECTION_LTR) ?
+		gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0) : gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+	g_object_set_data(G_OBJECT(from), "to", to);
+	gtk_container_foreach(GTK_CONTAINER(from), (GtkCallback)swap_orient_cb,
+			from);
+	gtk_container_remove(GTK_CONTAINER(menuitem), from);
+	gtk_container_add(GTK_CONTAINER(menuitem), to);
+	g_object_set_data(G_OBJECT(menuitem), "box", to);
+	gtk_widget_show_all(menuitem);
+	return TRUE;
+}
+
+static gboolean
+matepanelapplet_reorient_cb (GtkWidget *applet, MatePanelAppletOrient neworient,
+		gpointer data)
+{
+	GtkWidget *menubar = (GtkWidget *)data;
+	if ((((neworient == MATE_PANEL_APPLET_ORIENT_UP) ||
+			(neworient == MATE_PANEL_APPLET_ORIENT_DOWN)) &&
+			((orient == MATE_PANEL_APPLET_ORIENT_LEFT) ||
+			(orient == MATE_PANEL_APPLET_ORIENT_RIGHT))) ||
+			(((neworient == MATE_PANEL_APPLET_ORIENT_LEFT) ||
+			(neworient == MATE_PANEL_APPLET_ORIENT_RIGHT)) &&
+			((orient == MATE_PANEL_APPLET_ORIENT_UP) ||
+			(orient == MATE_PANEL_APPLET_ORIENT_DOWN)))) {
+		packdirection = (packdirection == GTK_PACK_DIRECTION_LTR) ?
+				GTK_PACK_DIRECTION_TTB : GTK_PACK_DIRECTION_LTR;
+		gtk_menu_bar_set_pack_direction(GTK_MENU_BAR(menubar),
+				packdirection);
+		orient = neworient;
+		gtk_container_foreach(GTK_CONTAINER(menubar),
+				(GtkCallback)reorient_box_cb, NULL);
+	}
+	orient = neworient;
+	return FALSE;
+}
+
+#ifdef N_
+#undef N_
+#endif
+#define N_(x) x
+
+static void
+log_to_file_cb (GObject * source_obj G_GNUC_UNUSED,
+                GAsyncResult * result G_GNUC_UNUSED, gpointer user_data)
+{
+	g_free(user_data);
+	return;
+}
+
+static void
+log_to_file (const gchar * domain G_GNUC_UNUSED,
+             GLogLevelFlags level G_GNUC_UNUSED,
+             const gchar * message,
+             gpointer data G_GNUC_UNUSED)
+{
+	if (log_file == NULL) {
+		GError * error = NULL;
+		gchar * filename = g_build_filename(g_get_user_cache_dir(), LOG_FILE_NAME, NULL);
+		GFile * file = g_file_new_for_path(filename);
+		g_free(filename);
+
+		if (!g_file_test(g_get_user_cache_dir(), G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
+			GFile * cachedir = g_file_new_for_path(g_get_user_cache_dir());
+			g_file_make_directory_with_parents(cachedir, NULL, &error);
+
+			if (error != NULL) {
+				g_error("Unable to make directory '%s' for log file: %s", g_get_user_cache_dir(), error->message);
+			}
+		}
+
+		g_file_delete(file, NULL, NULL);
+
+		GFileIOStream * io = g_file_create_readwrite(file,
+		                          G_FILE_CREATE_REPLACE_DESTINATION, /* flags */
+		                          NULL, /* cancelable */
+		                          &error); /* error */
+		if (error != NULL) {
+			g_error("Unable to replace file: %s", error->message);
+		}
+
+		log_file = g_io_stream_get_output_stream(G_IO_STREAM(io));
+	}
+
+	gchar * outputstring = g_strdup_printf("%s\n", message);
+	g_output_stream_write_async(log_file,
+	                            outputstring, /* data */
+	                            strlen(outputstring), /* length */
+	                            G_PRIORITY_LOW, /* priority */
+	                            NULL, /* cancelable */
+	                            log_to_file_cb, /* callback */
+	                            outputstring); /* data */
+
+	return;
+}
+
+static gboolean
+applet_fill_cb (MatePanelApplet * applet, const gchar * iid G_GNUC_UNUSED,
+                gpointer data G_GNUC_UNUSED)
+{
+#if HAVE_AYATANA_INDICATOR_NG || HAVE_UBUNTU_INDICATOR_NG
+	ido_init();
+#endif
+
+	static const GtkActionEntry menu_actions[] = {
+		{"About", "help-about", N_("_About"), NULL, NULL, G_CALLBACK(about_cb)}
+	};
+	static const gchar *menu_xml = "<menuitem name=\"About\" action=\"About\"/>";
+
+	static gboolean first_time = FALSE;
+	GtkWidget *menubar;
+	gint indicators_loaded = 0;
+	GtkActionGroup *action_group;
+
+	if (!first_time)
+	{
+		first_time = TRUE;
+#ifdef INDICATOR_APPLET
+		g_set_application_name(_("Indicator Applet"));
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+		g_set_application_name(_("Indicator Applet Complete"));
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+		g_set_application_name(_("Indicator Applet Application Menu"));
+#endif
+
+		g_log_set_default_handler(log_to_file, NULL);
+
+		tomboy_keybinder_init();
+	}
+
+	/* Set panel options */
+	gtk_container_set_border_width(GTK_CONTAINER (applet), 0);
+	mate_panel_applet_set_flags(applet, MATE_PANEL_APPLET_EXPAND_MINOR);
+	menubar = gtk_menu_bar_new();
+	action_group = gtk_action_group_new ("Indicator Applet Actions");
+	gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+	gtk_action_group_add_actions (action_group, menu_actions,
+	                              G_N_ELEMENTS (menu_actions),
+	                              menubar);
+	mate_panel_applet_setup_menu(applet, menu_xml, action_group);
+	g_object_unref(action_group);
+#ifdef INDICATOR_APPLET
+	atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)),
+	                     "indicator-applet");
+#endif
+#ifdef INDICATOR_APPLET_COMPLETE
+	atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)),
+	                     "indicator-applet-complete");
+#endif
+#ifdef INDICATOR_APPLET_APPMENU
+	atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)),
+	                     "indicator-applet-appmenu");
+#endif
+
+	/* Init some theme/icon stuff */
+	gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(),
+	                                  INDICATOR_ICONS_DIR);
+	/* g_debug("Icons directory: %s", INDICATOR_ICONS_DIR); */
+	gtk_widget_set_name(GTK_WIDGET (applet), "fast-user-switch-applet");
+
+	/* Build menubar */
+	size = (mate_panel_applet_get_size (applet));
+	orient = (mate_panel_applet_get_orient(applet));
+	packdirection = ((orient == MATE_PANEL_APPLET_ORIENT_UP) ||
+			(orient == MATE_PANEL_APPLET_ORIENT_DOWN)) ?
+			GTK_PACK_DIRECTION_LTR : GTK_PACK_DIRECTION_TTB;
+	gtk_menu_bar_set_pack_direction(GTK_MENU_BAR(menubar),
+			packdirection);
+	gtk_widget_set_can_focus (menubar, TRUE);
+	gtk_widget_set_name(GTK_WIDGET (menubar), "fast-user-switch-menubar");
+	g_signal_connect(menubar, "button-press-event", G_CALLBACK(menubar_press), NULL);
+	g_signal_connect_after(menubar, "draw", G_CALLBACK(menubar_on_draw), menubar);
+	g_signal_connect(applet, "change-orient",
+			G_CALLBACK(matepanelapplet_reorient_cb), menubar);
+	gtk_container_set_border_width(GTK_CONTAINER(menubar), 0);
+
+	/* Add in filter func */
+	tomboy_keybinder_bind(hotkey_keycode, hotkey_filter, menubar);
+
+	load_modules(applet, menubar, &indicators_loaded);
+#if HAVE_AYATANA_INDICATOR_NG || HAVE_UBUNTU_INDICATOR_NG
+	load_indicators_from_indicator_files(applet, menubar, &indicators_loaded);
+#endif
+
+	if (indicators_loaded == 0) {
+		/* A label to allow for click through */
+		GtkWidget * item = gtk_label_new(_("No Indicators"));
+		mate_panel_applet_set_background_widget(applet, item);
+		gtk_container_add(GTK_CONTAINER(applet), item);
+		gtk_widget_show(item);
+	} else {
+		gtk_container_add(GTK_CONTAINER(applet), menubar);
+		mate_panel_applet_set_background_widget(applet, menubar);
+		gtk_widget_show(menubar);
+	}
+
+	gtk_widget_show(GTK_WIDGET(applet));
+
+	return TRUE;
+
+}
+
+
+
+
+ + + diff --git a/2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/1.html b/2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/1.html new file mode 100644 index 0000000..6e484d7 --- /dev/null +++ b/2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/1.html @@ -0,0 +1,1229 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
/* eggaccelerators.c
+ * Copyright (C) 2002  Red Hat, Inc.; Copyright 1998, 2001 Tim Janik
+ * Developed by Havoc Pennington, Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+
+#include "eggaccelerators.h"
+
+#include <string.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
+
+enum
+{
+  EGG_MODMAP_ENTRY_SHIFT   = 0,
+  EGG_MODMAP_ENTRY_LOCK    = 1,
+  EGG_MODMAP_ENTRY_CONTROL = 2,
+  EGG_MODMAP_ENTRY_MOD1    = 3,
+  EGG_MODMAP_ENTRY_MOD2    = 4,
+  EGG_MODMAP_ENTRY_MOD3    = 5,
+  EGG_MODMAP_ENTRY_MOD4    = 6,
+  EGG_MODMAP_ENTRY_MOD5    = 7,
+  EGG_MODMAP_ENTRY_LAST    = 8
+};
+
+#define MODMAP_ENTRY_TO_MODIFIER(x) (1 << (x))
+
+typedef struct
+{
+  EggVirtualModifierType mapping[EGG_MODMAP_ENTRY_LAST];
+
+} EggModmap;
+
+const EggModmap* egg_keymap_get_modmap (GdkKeymap *keymap);
+
+static inline gboolean
+is_alt (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'a' || string[1] == 'A') &&
+	  (string[2] == 'l' || string[2] == 'L') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_ctl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == '>'));
+}
+
+static inline gboolean
+is_modx (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'd' || string[3] == 'D') &&
+	  (string[4] >= '1' && string[4] <= '5') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_ctrl (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 't' || string[2] == 'T') &&
+	  (string[3] == 'r' || string[3] == 'R') &&
+	  (string[4] == 'l' || string[4] == 'L') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shft (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'f' || string[3] == 'F') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_shift (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'h' || string[2] == 'H') &&
+	  (string[3] == 'i' || string[3] == 'I') &&
+	  (string[4] == 'f' || string[4] == 'F') &&
+	  (string[5] == 't' || string[5] == 'T') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_control (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'c' || string[1] == 'C') &&
+	  (string[2] == 'o' || string[2] == 'O') &&
+	  (string[3] == 'n' || string[3] == 'N') &&
+	  (string[4] == 't' || string[4] == 'T') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == 'o' || string[6] == 'O') &&
+	  (string[7] == 'l' || string[7] == 'L') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_release (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'r' || string[1] == 'R') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 'l' || string[3] == 'L') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'a' || string[5] == 'A') &&
+	  (string[6] == 's' || string[6] == 'S') &&
+	  (string[7] == 'e' || string[7] == 'E') &&
+	  (string[8] == '>'));
+}
+
+static inline gboolean
+is_meta (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'm' || string[1] == 'M') &&
+	  (string[2] == 'e' || string[2] == 'E') &&
+	  (string[3] == 't' || string[3] == 'T') &&
+	  (string[4] == 'a' || string[4] == 'A') &&
+	  (string[5] == '>'));
+}
+
+static inline gboolean
+is_super (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 's' || string[1] == 'S') &&
+	  (string[2] == 'u' || string[2] == 'U') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+static inline gboolean
+is_hyper (const gchar *string)
+{
+  return ((string[0] == '<') &&
+	  (string[1] == 'h' || string[1] == 'H') &&
+	  (string[2] == 'y' || string[2] == 'Y') &&
+	  (string[3] == 'p' || string[3] == 'P') &&
+	  (string[4] == 'e' || string[4] == 'E') &&
+	  (string[5] == 'r' || string[5] == 'R') &&
+	  (string[6] == '>'));
+}
+
+/**
+ * egg_accelerator_parse_virtual:
+ * @accelerator:      string representing an accelerator
+ * @accelerator_key:  return location for accelerator keyval
+ * @accelerator_mods: return location for accelerator modifier mask
+ *
+ * Parses a string representing a virtual accelerator. The format
+ * looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1" or
+ * "&lt;Release&gt;z" (the last one is for key release).  The parser
+ * is fairly liberal and allows lower or upper case, and also
+ * abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;".
+ *
+ * If the parse fails, @accelerator_key and @accelerator_mods will
+ * be set to 0 (zero) and %FALSE will be returned. If the string contains
+ * only modifiers, @accelerator_key will be set to 0 but %TRUE will be
+ * returned.
+ *
+ * The virtual vs. concrete accelerator distinction is a relic of
+ * how the X Window System works; there are modifiers Mod2-Mod5 that
+ * can represent various keyboard keys (numlock, meta, hyper, etc.),
+ * the virtual modifier represents the keyboard key, the concrete
+ * modifier the actual Mod2-Mod5 bits in the key press event.
+ *
+ * Returns: %TRUE on success.
+ */
+gboolean
+egg_accelerator_parse_virtual (const gchar            *accelerator,
+                               guint                  *accelerator_key,
+                               EggVirtualModifierType *accelerator_mods)
+{
+  guint keyval;
+  GdkModifierType mods;
+  gint len;
+  gboolean bad_keyval;
+
+  if (accelerator_key)
+    *accelerator_key = 0;
+  if (accelerator_mods)
+    *accelerator_mods = 0;
+
+  g_return_val_if_fail (accelerator != NULL, FALSE);
+
+  bad_keyval = FALSE;
+
+  keyval = 0;
+  mods = 0;
+  len = strlen (accelerator);
+  while (len)
+    {
+      if (*accelerator == '<')
+	{
+	  if (len >= 9 && is_release (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_RELEASE_MASK;
+	    }
+	  else if (len >= 9 && is_control (accelerator))
+	    {
+	      accelerator += 9;
+	      len -= 9;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 7 && is_shift (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_shft (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_SHIFT_MASK;
+	    }
+	  else if (len >= 6 && is_ctrl (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 6 && is_modx (accelerator))
+	    {
+	      static const guint mod_vals[] = {
+		EGG_VIRTUAL_ALT_MASK, EGG_VIRTUAL_MOD2_MASK, EGG_VIRTUAL_MOD3_MASK,
+		EGG_VIRTUAL_MOD4_MASK, EGG_VIRTUAL_MOD5_MASK
+	      };
+
+	      len -= 6;
+	      accelerator += 4;
+	      mods |= mod_vals[*accelerator - '1'];
+	      accelerator += 2;
+	    }
+	  else if (len >= 5 && is_ctl (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_CONTROL_MASK;
+	    }
+	  else if (len >= 5 && is_alt (accelerator))
+	    {
+	      accelerator += 5;
+	      len -= 5;
+	      mods |= EGG_VIRTUAL_ALT_MASK;
+	    }
+          else if (len >= 6 && is_meta (accelerator))
+	    {
+	      accelerator += 6;
+	      len -= 6;
+	      mods |= EGG_VIRTUAL_META_MASK;
+	    }
+          else if (len >= 7 && is_hyper (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_HYPER_MASK;
+	    }
+          else if (len >= 7 && is_super (accelerator))
+	    {
+	      accelerator += 7;
+	      len -= 7;
+	      mods |= EGG_VIRTUAL_SUPER_MASK;
+	    }
+	  else
+	    {
+	      gchar last_ch;
+
+	      last_ch = *accelerator;
+	      while (last_ch && last_ch != '>')
+		{
+		  last_ch = *accelerator;
+		  accelerator += 1;
+		  len -= 1;
+		}
+	    }
+	}
+      else
+	{
+          keyval = gdk_keyval_from_name (accelerator);
+
+          if (keyval == 0)
+            bad_keyval = TRUE;
+
+          accelerator += len;
+          len -= len;
+	}
+    }
+
+  if (accelerator_key)
+    *accelerator_key = gdk_keyval_to_lower (keyval);
+  if (accelerator_mods)
+    *accelerator_mods = mods;
+
+  return !bad_keyval;
+}
+
+void
+egg_keymap_resolve_virtual_modifiers (GdkKeymap              *keymap,
+                                      EggVirtualModifierType  virtual_mods,
+                                      GdkModifierType        *concrete_mods)
+{
+  GdkModifierType concrete;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (concrete_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  concrete = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if (modmap->mapping[i] & virtual_mods)
+        concrete |= (1 << i);
+
+      ++i;
+    }
+
+  *concrete_mods = concrete;
+}
+
+void
+egg_keymap_virtualize_modifiers (GdkKeymap              *keymap,
+                                 GdkModifierType         concrete_mods,
+                                 EggVirtualModifierType *virtual_mods)
+{
+  GdkModifierType virtual;
+  int i;
+  const EggModmap *modmap;
+
+  g_return_if_fail (GDK_IS_KEYMAP (keymap));
+  g_return_if_fail (virtual_mods != NULL);
+
+  modmap = egg_keymap_get_modmap (keymap);
+
+  /* Not so sure about this algorithm. */
+
+  virtual = 0;
+  i = 0;
+  while (i < EGG_MODMAP_ENTRY_LAST)
+    {
+      if ((1 << i) & concrete_mods)
+        {
+          EggVirtualModifierType cleaned;
+
+          cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK |
+                                           EGG_VIRTUAL_MOD3_MASK |
+                                           EGG_VIRTUAL_MOD4_MASK |
+                                           EGG_VIRTUAL_MOD5_MASK);
+
+          if (cleaned != 0)
+            {
+              virtual |= cleaned;
+            }
+          else
+            {
+              /* Rather than dropping mod2->mod5 if not bound,
+               * go ahead and use the concrete names
+               */
+              virtual |= modmap->mapping[i];
+            }
+        }
+
+      ++i;
+    }
+
+  *virtual_mods = virtual;
+}
+
+static void
+reload_modmap (GdkKeymap *keymap,
+               EggModmap *modmap)
+{
+  XModifierKeymap *xmodmap;
+  int map_size;
+  int i;
+
+  /* FIXME multihead */
+  xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ());
+
+  memset (modmap->mapping, 0, sizeof (modmap->mapping));
+
+  /* there are 8 modifiers, and the first 3 are shift, shift lock,
+   * and control
+   */
+  map_size = 8 * xmodmap->max_keypermod;
+  i = 3 * xmodmap->max_keypermod;
+  while (i < map_size)
+    {
+      /* get the key code at this point in the map,
+       * see if its keysym is one we're interested in
+       */
+      int keycode = xmodmap->modifiermap[i];
+      GdkKeymapKey *keys;
+      guint *keyvals;
+      int n_entries;
+      int j;
+      EggVirtualModifierType mask;
+
+      keys = NULL;
+      keyvals = NULL;
+      n_entries = 0;
+
+      gdk_keymap_get_entries_for_keycode (keymap,
+                                          keycode,
+                                          &keys, &keyvals, &n_entries);
+
+      mask = 0;
+      j = 0;
+      while (j < n_entries)
+        {
+          if (keyvals[j] == GDK_KEY_Num_Lock)
+            mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Scroll_Lock)
+            mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
+          else if (keyvals[j] == GDK_KEY_Meta_L ||
+                   keyvals[j] == GDK_KEY_Meta_R)
+            mask |= EGG_VIRTUAL_META_MASK;
+          else if (keyvals[j] == GDK_KEY_Hyper_L ||
+                   keyvals[j] == GDK_KEY_Hyper_R)
+            mask |= EGG_VIRTUAL_HYPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Super_L ||
+                   keyvals[j] == GDK_KEY_Super_R)
+            mask |= EGG_VIRTUAL_SUPER_MASK;
+          else if (keyvals[j] == GDK_KEY_Mode_switch)
+            mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
+
+          ++j;
+        }
+
+      /* Mod1Mask is 1 << 3 for example, i.e. the
+       * fourth modifier, i / keyspermod is the modifier
+       * index
+       */
+      modmap->mapping[i/xmodmap->max_keypermod] |= mask;
+
+      g_free (keyvals);
+      g_free (keys);
+
+      ++i;
+    }
+
+  /* Add in the not-really-virtual fixed entries */
+  modmap->mapping[EGG_MODMAP_ENTRY_SHIFT] |= EGG_VIRTUAL_SHIFT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_CONTROL] |= EGG_VIRTUAL_CONTROL_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_LOCK] |= EGG_VIRTUAL_LOCK_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD1] |= EGG_VIRTUAL_ALT_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD2] |= EGG_VIRTUAL_MOD2_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK;
+  modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK;
+
+  XFreeModifiermap (xmodmap);
+}
+
+const EggModmap*
+egg_keymap_get_modmap (GdkKeymap *keymap)
+{
+  EggModmap *modmap;
+
+  /* This is all a hack, much simpler when we can just
+   * modify GDK directly.
+   */
+
+  modmap = g_object_get_data (G_OBJECT (keymap),
+                              "egg-modmap");
+
+  if (modmap == NULL)
+    {
+      modmap = g_new0 (EggModmap, 1);
+
+      /* FIXME modify keymap change events with an event filter
+       * and force a reload if we get one
+       */
+
+      reload_modmap (keymap, modmap);
+
+      g_object_set_data_full (G_OBJECT (keymap),
+                              "egg-modmap",
+                              modmap,
+                              g_free);
+    }
+
+  g_assert (modmap != NULL);
+
+  return modmap;
+}
+
+
+
+
+ + + diff --git a/2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/2.html b/2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/2.html new file mode 100644 index 0000000..808ce42 --- /dev/null +++ b/2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/2.html @@ -0,0 +1,857 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
/* tomboykeybinder.c
+ * Copyright (C) 2008 Novell
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ */
+#include <string.h>
+
+#include <gdk/gdk.h>
+#include <gdk/gdkwindow.h>
+#include <gdk/gdkx.h>
+#include <X11/Xlib.h>
+
+#include "eggaccelerators.h"
+#include "tomboykeybinder.h"
+
+/* Uncomment the next line to print a debug trace. */
+/* #define DEBUG */
+
+#ifdef DEBUG
+#  define TRACE(x) x
+#else
+#  define TRACE(x) do {} while (FALSE);
+#endif
+
+typedef struct _Binding {
+	TomboyBindkeyHandler  handler;
+	gpointer              user_data;
+	char                 *keystring;
+	uint                  keycode;
+	uint                  modifiers;
+} Binding;
+
+static GSList *bindings = NULL;
+static guint32 last_event_time = 0;
+static gboolean processing_event = FALSE;
+
+static guint num_lock_mask, caps_lock_mask, scroll_lock_mask;
+
+static void
+lookup_ignorable_modifiers (GdkKeymap *keymap)
+{
+	egg_keymap_resolve_virtual_modifiers (keymap,
+					      EGG_VIRTUAL_LOCK_MASK,
+					      &caps_lock_mask);
+
+	egg_keymap_resolve_virtual_modifiers (keymap,
+					      EGG_VIRTUAL_NUM_LOCK_MASK,
+					      &num_lock_mask);
+
+	egg_keymap_resolve_virtual_modifiers (keymap,
+					      EGG_VIRTUAL_SCROLL_LOCK_MASK,
+					      &scroll_lock_mask);
+}
+
+static void
+grab_ungrab_with_ignorable_modifiers (GdkWindow *rootwin,
+				      Binding   *binding,
+				      gboolean   grab)
+{
+	guint mod_masks [] = {
+		0, /* modifier only */
+		num_lock_mask,
+		caps_lock_mask,
+		scroll_lock_mask,
+		num_lock_mask  | caps_lock_mask,
+		num_lock_mask  | scroll_lock_mask,
+		caps_lock_mask | scroll_lock_mask,
+		num_lock_mask  | caps_lock_mask | scroll_lock_mask,
+	};
+	guint i;
+
+	for (i = 0; i < G_N_ELEMENTS (mod_masks); i++) {
+		if (grab) {
+			XGrabKey (GDK_WINDOW_XDISPLAY (rootwin),
+				  binding->keycode,
+				  binding->modifiers | mod_masks [i],
+				  GDK_WINDOW_XID (rootwin),
+				  False,
+				  GrabModeAsync,
+				  GrabModeAsync);
+		} else {
+			XUngrabKey (GDK_WINDOW_XDISPLAY (rootwin),
+				    binding->keycode,
+				    binding->modifiers | mod_masks [i],
+				    GDK_WINDOW_XID (rootwin));
+		}
+	}
+}
+
+static gboolean
+do_grab_key (Binding *binding)
+{
+	GdkDisplay *gdk_display = gdk_display_get_default ();
+	GdkKeymap *keymap = gdk_keymap_get_for_display (gdk_display);
+	GdkWindow *rootwin = gdk_get_default_root_window ();
+
+	EggVirtualModifierType virtual_mods = 0;
+	guint keysym = 0;
+
+	if (keymap == NULL || rootwin == NULL)
+		return FALSE;
+
+	if (!egg_accelerator_parse_virtual (binding->keystring,
+					    &keysym,
+					    &virtual_mods))
+		return FALSE;
+
+	TRACE (g_print ("Got accel %d, %d\n", keysym, virtual_mods));
+
+	binding->keycode = XKeysymToKeycode (GDK_WINDOW_XDISPLAY (rootwin),
+					     keysym);
+	if (binding->keycode == 0)
+		return FALSE;
+
+	TRACE (g_print ("Got keycode %d\n", binding->keycode));
+
+	egg_keymap_resolve_virtual_modifiers (keymap,
+					      virtual_mods,
+					      &binding->modifiers);
+	if (binding->modifiers == 0)
+		return FALSE;
+
+	TRACE (g_print ("Got modmask %d\n", binding->modifiers));
+
+	gdk_x11_display_error_trap_push (gdk_display);
+
+	grab_ungrab_with_ignorable_modifiers (rootwin,
+					      binding,
+					      TRUE /* grab */);
+
+	gdk_display_flush (gdk_display);
+
+	if (gdk_x11_display_error_trap_pop (gdk_display)) {
+	   g_warning ("Binding '%s' failed!\n", binding->keystring);
+	   return FALSE;
+	}
+
+	return TRUE;
+}
+
+static gboolean
+do_ungrab_key (Binding *binding)
+{
+	GdkWindow *rootwin = gdk_get_default_root_window ();
+
+	TRACE (g_print ("Removing grab for '%s'\n", binding->keystring));
+
+	grab_ungrab_with_ignorable_modifiers (rootwin,
+					      binding,
+					      FALSE /* ungrab */);
+
+	return TRUE;
+}
+
+static GdkFilterReturn
+filter_func (GdkXEvent *gdk_xevent, GdkEvent *event G_GNUC_UNUSED,
+             gpointer data G_GNUC_UNUSED)
+{
+	GdkFilterReturn return_val = GDK_FILTER_CONTINUE;
+	XEvent *xevent = (XEvent *) gdk_xevent;
+	guint event_mods;
+	GSList *iter;
+
+	TRACE (g_print ("Got Event! %d, %d\n", xevent->type, event->type));
+
+	switch (xevent->type) {
+	case KeyPress:
+		TRACE (g_print ("Got KeyPress! keycode: %d, modifiers: %d\n",
+				xevent->xkey.keycode,
+				xevent->xkey.state));
+
+		/*
+		 * Set the last event time for use when showing
+		 * windows to avoid anti-focus-stealing code.
+		 */
+		processing_event = TRUE;
+		last_event_time = xevent->xkey.time;
+
+		event_mods = xevent->xkey.state & ~(num_lock_mask  |
+						    caps_lock_mask |
+						    scroll_lock_mask);
+
+		for (iter = bindings; iter != NULL; iter = iter->next) {
+			Binding *binding = (Binding *) iter->data;
+
+			if (binding->keycode == xevent->xkey.keycode &&
+			    binding->modifiers == event_mods) {
+
+				TRACE (g_print ("Calling handler for '%s'...\n",
+						binding->keystring));
+
+				(binding->handler) (binding->keystring,
+						    binding->user_data);
+			}
+		}
+
+		processing_event = FALSE;
+		break;
+	case KeyRelease:
+		TRACE (g_print ("Got KeyRelease! \n"));
+		break;
+	}
+
+	return return_val;
+}
+
+static void
+keymap_changed (GdkKeymap *map G_GNUC_UNUSED)
+{
+	GdkKeymap *keymap = gdk_keymap_get_for_display (gdk_display_get_default ());
+	GSList *iter;
+
+	TRACE (g_print ("Keymap changed! Regrabbing keys..."));
+
+	for (iter = bindings; iter != NULL; iter = iter->next) {
+		Binding *binding = (Binding *) iter->data;
+		do_ungrab_key (binding);
+	}
+
+	lookup_ignorable_modifiers (keymap);
+
+	for (iter = bindings; iter != NULL; iter = iter->next) {
+		Binding *binding = (Binding *) iter->data;
+		do_grab_key (binding);
+	}
+}
+
+void
+tomboy_keybinder_init (void)
+{
+	GdkKeymap *keymap = gdk_keymap_get_for_display (gdk_display_get_default ());
+	GdkWindow *rootwin = gdk_get_default_root_window ();
+
+	lookup_ignorable_modifiers (keymap);
+
+	gdk_window_add_filter (rootwin,
+			       filter_func,
+			       NULL);
+
+	g_signal_connect (keymap,
+			  "keys_changed",
+			  G_CALLBACK (keymap_changed),
+			  NULL);
+}
+
+void
+tomboy_keybinder_bind (const char           *keystring,
+		       TomboyBindkeyHandler  handler,
+		       gpointer              user_data)
+{
+	Binding *binding;
+	gboolean success;
+
+	binding = g_new0 (Binding, 1);
+	binding->keystring = g_strdup (keystring);
+	binding->handler = handler;
+	binding->user_data = user_data;
+
+	/* Sets the binding's keycode and modifiers */
+	success = do_grab_key (binding);
+
+	if (success) {
+		bindings = g_slist_prepend (bindings, binding);
+	} else {
+		g_free (binding->keystring);
+		g_free (binding);
+	}
+}
+
+void
+tomboy_keybinder_unbind (const char           *keystring,
+			 TomboyBindkeyHandler  handler)<--- Parameter 'handler' can be declared with const
+{
+	GSList *iter;
+
+	for (iter = bindings; iter != NULL; iter = iter->next) {
+		Binding *binding = (Binding *) iter->data;
+
+		if (strcmp (keystring, binding->keystring) != 0 ||
+		    handler != binding->handler)
+			continue;
+
+		do_ungrab_key (binding);
+
+		bindings = g_slist_remove (bindings, binding);
+
+		g_free (binding->keystring);
+		g_free (binding);
+		break;
+	}
+}
+
+/*
+ * From eggcellrenderkeys.c.
+ */
+gboolean
+tomboy_keybinder_is_modifier (guint keycode)
+{
+	gint i;
+	gint map_size;
+	XModifierKeymap *mod_keymap;
+	gboolean retval = FALSE;
+
+	mod_keymap = XGetModifierMapping (gdk_x11_get_default_xdisplay());
+
+	map_size = 8 * mod_keymap->max_keypermod;
+
+	i = 0;
+	while (i < map_size) {
+		if (keycode == mod_keymap->modifiermap[i]) {
+			retval = TRUE;
+			break;
+		}
+		++i;
+	}
+
+	XFreeModifiermap (mod_keymap);
+
+	return retval;
+}
+
+guint32
+tomboy_keybinder_get_current_event_time (void)
+{
+	if (processing_event)
+		return last_event_time;
+	else
+		return GDK_CURRENT_TIME;
+}
+
+
+
+
+ + + diff --git a/2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/index.html b/2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/index.html new file mode 100644 index 0000000..ff55bd0 --- /dev/null +++ b/2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/index.html @@ -0,0 +1,122 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+ + + + + + + + + + + +
LineIdCWESeverityMessage
missingIncludeSysteminformationCppcheck cannot find all the include files (use --check-config for details)
src/applet-main.c
576constParameter398styleParameter 'entry' can be declared with const
src/eggaccelerators.c
321duplicateExpression398styleSame expression on both sides of '-='.
src/tomboykeybinder.c
284constParameter398styleParameter 'handler' can be declared with const
+
+
+ + + diff --git a/2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/stats.html b/2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/stats.html new file mode 100644 index 0000000..3074784 --- /dev/null +++ b/2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/stats.html @@ -0,0 +1,107 @@ + + + + + + Cppcheck - HTML report - mate-indicator-applet + + + + + + +
+ +
+

Top 10 files for style severity, total findings: 3
+   1  src/tomboykeybinder.c
+   1  src/eggaccelerators.c
+   1  src/applet-main.c
+

+ +
+
+ + + diff --git a/2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/style.css b/2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2022-02-13-182412-3485-cppcheck@ed5cb09d01f5_master/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/CNAME b/CNAME new file mode 100644 index 0000000..8108cac --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +mate-indicator-applet.mate-desktop.dev diff --git a/index.html b/index.html new file mode 100644 index 0000000..88c90fa --- /dev/null +++ b/index.html @@ -0,0 +1,46 @@ + + + + + mate-indicator-applet Code Analyzer results + + +

+ mate-desktop/mate-indicator-applet Static analyzer results +

+ GitHub + Build Status +
+Commit: ed5cb09d01f58a982dee276996f44133d13fea63
+Compare: 8f9ca2537035...ed5cb09d01f5
+Branch: master
+Time: 2022-02-13 18:24:12+00:00
+Messages:
+
+ci: drop -Wunused-parameter compiler cflag from debian build
+
+
+ + + -- cgit v1.2.1