From 8f6ca4c787210df90e5e371a3cafe54400785252 Mon Sep 17 00:00:00 2001 From: "raveit65 (via Travis CI)" <15132211195@163.com> Date: Fri, 21 Jul 2023 03:09:56 +0000 Subject: Deploy mate-desktop/mate-netbook to github.com/mate-desktop/mate-netbook.git:gh-pages --- .../0.html | 1487 ++++++++++++++++++++ .../1.html | 379 +++++ .../2.html | 1271 +++++++++++++++++ .../3.html | 1163 +++++++++++++++ .../4.html | 853 +++++++++++ .../index.html | 132 ++ .../stats.html | 109 ++ .../style.css | 137 ++ 8 files changed, 5531 insertions(+) create mode 100644 2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/0.html create mode 100644 2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/1.html create mode 100644 2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/2.html create mode 100644 2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/3.html create mode 100644 2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/4.html create mode 100644 2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/index.html create mode 100644 2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/stats.html create mode 100644 2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/style.css (limited to '2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master') diff --git a/2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/0.html b/2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/0.html new file mode 100644 index 0000000..7ae72e5 --- /dev/null +++ b/2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/0.html @@ -0,0 +1,1487 @@ + + + + + + Cppcheck - HTML report - mate-netbook + + + + + + +
+ +
+
  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
/* eggaccelerators.c
+ * Copyright (C) 2002  Red Hat, Inc.; Copyright 1998, 2001 Tim Janik
+ * Copyright (C) 2012-2021 MATE Developers
+ * 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;
+}
+
+/**
+ * egg_virtual_accelerator_name:
+ * @accelerator_key:  accelerator keyval
+ * @accelerator_mods: accelerator modifier mask
+ * @returns:          a newly-allocated accelerator name
+ * 
+ * Converts an accelerator keyval and modifier mask
+ * into a string parseable by egg_accelerator_parse_virtual().
+ * For example, if you pass in #GDK_q and #EGG_VIRTUAL_CONTROL_MASK,
+ * this function returns "&lt;Control&gt;q".
+ *
+ * The caller of this function must free the returned string.
+ */
+gchar*
+egg_virtual_accelerator_name (guint                  accelerator_key,
+                              EggVirtualModifierType accelerator_mods)
+{
+  static const gchar text_release[] = "<Release>";
+  static const gchar text_shift[] = "<Shift>";
+  static const gchar text_control[] = "<Control>";
+  static const gchar text_mod1[] = "<Alt>";
+  static const gchar text_mod2[] = "<Mod2>";
+  static const gchar text_mod3[] = "<Mod3>";
+  static const gchar text_mod4[] = "<Mod4>";
+  static const gchar text_mod5[] = "<Mod5>";
+  static const gchar text_meta[] = "<Meta>";
+  static const gchar text_super[] = "<Super>";
+  static const gchar text_hyper[] = "<Hyper>";
+  guint l;
+  gchar *keyval_name;
+  gchar *accelerator;
+
+  accelerator_mods &= EGG_VIRTUAL_MODIFIER_MASK;
+
+  keyval_name = gdk_keyval_name (gdk_keyval_to_lower (accelerator_key));
+  if (!keyval_name)
+    keyval_name = "";
+
+  l = 0;
+  if (accelerator_mods & EGG_VIRTUAL_RELEASE_MASK)
+    l += sizeof (text_release) - 1;
+  if (accelerator_mods & EGG_VIRTUAL_SHIFT_MASK)
+    l += sizeof (text_shift) - 1;
+  if (accelerator_mods & EGG_VIRTUAL_CONTROL_MASK)
+    l += sizeof (text_control) - 1;
+  if (accelerator_mods & EGG_VIRTUAL_ALT_MASK)
+    l += sizeof (text_mod1) - 1;
+  if (accelerator_mods & EGG_VIRTUAL_MOD2_MASK)
+    l += sizeof (text_mod2) - 1;
+  if (accelerator_mods & EGG_VIRTUAL_MOD3_MASK)
+    l += sizeof (text_mod3) - 1;
+  if (accelerator_mods & EGG_VIRTUAL_MOD4_MASK)
+    l += sizeof (text_mod4) - 1;
+  if (accelerator_mods & EGG_VIRTUAL_MOD5_MASK)
+    l += sizeof (text_mod5) - 1;
+  if (accelerator_mods & EGG_VIRTUAL_META_MASK)
+    l += sizeof (text_meta) - 1;
+  if (accelerator_mods & EGG_VIRTUAL_HYPER_MASK)
+    l += sizeof (text_hyper) - 1;
+  if (accelerator_mods & EGG_VIRTUAL_SUPER_MASK)
+    l += sizeof (text_super) - 1;
+  l += strlen (keyval_name);
+
+  accelerator = g_new (gchar, l + 1);
+
+  l = 0;
+  accelerator[l] = 0;
+  if (accelerator_mods & EGG_VIRTUAL_RELEASE_MASK)
+    {
+      strcpy (accelerator + l, text_release);
+      l += sizeof (text_release) - 1;
+    }
+  if (accelerator_mods & EGG_VIRTUAL_SHIFT_MASK)
+    {
+      strcpy (accelerator + l, text_shift);
+      l += sizeof (text_shift) - 1;
+    }
+  if (accelerator_mods & EGG_VIRTUAL_CONTROL_MASK)
+    {
+      strcpy (accelerator + l, text_control);
+      l += sizeof (text_control) - 1;
+    }
+  if (accelerator_mods & EGG_VIRTUAL_ALT_MASK)
+    {
+      strcpy (accelerator + l, text_mod1);
+      l += sizeof (text_mod1) - 1;
+    }
+  if (accelerator_mods & EGG_VIRTUAL_MOD2_MASK)
+    {
+      strcpy (accelerator + l, text_mod2);
+      l += sizeof (text_mod2) - 1;
+    }
+  if (accelerator_mods & EGG_VIRTUAL_MOD3_MASK)
+    {
+      strcpy (accelerator + l, text_mod3);
+      l += sizeof (text_mod3) - 1;
+    }
+  if (accelerator_mods & EGG_VIRTUAL_MOD4_MASK)
+    {
+      strcpy (accelerator + l, text_mod4);
+      l += sizeof (text_mod4) - 1;
+    }
+  if (accelerator_mods & EGG_VIRTUAL_MOD5_MASK)
+    {
+      strcpy (accelerator + l, text_mod5);
+      l += sizeof (text_mod5) - 1;
+    }
+  if (accelerator_mods & EGG_VIRTUAL_META_MASK)
+    {
+      strcpy (accelerator + l, text_meta);
+      l += sizeof (text_meta) - 1;
+    }
+  if (accelerator_mods & EGG_VIRTUAL_HYPER_MASK)
+    {
+      strcpy (accelerator + l, text_hyper);
+      l += sizeof (text_hyper) - 1;
+    }
+  if (accelerator_mods & EGG_VIRTUAL_SUPER_MASK)
+    {
+      strcpy (accelerator + l, text_super);
+      l += sizeof (text_super) - 1;
+    }
+  
+  strcpy (accelerator + l, keyval_name);
+
+  return accelerator;
+}
+
+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-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/1.html b/2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/1.html new file mode 100644 index 0000000..e6eb3fc --- /dev/null +++ b/2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/1.html @@ -0,0 +1,379 @@ + + + + + + Cppcheck - HTML report - mate-netbook + + + + + + +
+ +
+
  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
/*
+ * Copyright (C) 2008 Canonical Ltd
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * 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 warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by Neil Jagdish Patel <neil.patel@canonical.com>
+ *
+ */
+
+#include <glib.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+
+#include <gio/gio.h>
+
+#include "maximus-app.h"
+
+#ifdef __GNUC__
+#define UNUSED_VARIABLE __attribute__ ((unused))
+#else
+#define UNUSED_VARIABLE
+#endif
+
+static gboolean version    = FALSE;
+gboolean no_maximize = FALSE;
+
+GOptionEntry entries[] =
+{
+ {
+   "version", 'v',
+   0, G_OPTION_ARG_NONE,
+   &version,
+   "Prints the version number", NULL
+ },
+ {
+   "no-maximize", 'm',
+   0, G_OPTION_ARG_NONE,
+   &no_maximize,
+   "Do not automatically maximize every window", NULL
+ },
+ {
+   NULL
+ }
+};
+
+gint main (gint argc, gchar *argv[])
+{
+  GApplication *application;
+  MaximusApp UNUSED_VARIABLE *app;
+  GOptionContext  *context;
+  GError *error = NULL;
+  GdkDisplay *gdk_display;
+
+  g_set_application_name ("Maximus");
+
+  gtk_init (&argc, &argv);
+
+  application = g_application_new ("com.canonical.Maximus", G_APPLICATION_FLAGS_NONE);
+
+  if (!g_application_register (application, NULL, &error))
+  {
+    g_warning ("%s", error->message);
+    g_error_free (error);
+    return 1;
+  }
+
+  if (g_application_get_is_remote(application))
+  {
+    return 0;
+  }
+
+  context = g_option_context_new ("- Maximus");
+  g_option_context_add_main_entries (context, entries, "maximus");
+  g_option_context_add_group (context, gtk_get_option_group (TRUE));
+  g_option_context_parse (context, &argc, &argv, NULL);
+  g_option_context_free(context);
+
+  gdk_display = gdk_display_get_default ();
+  gdk_x11_display_error_trap_push (gdk_display);
+  app = maximus_app_get_default ();<--- Variable 'app' is assigned a value that is never used.
+  gdk_x11_display_error_trap_pop_ignored (gdk_display);
+
+  gtk_main ();
+
+  return EXIT_SUCCESS;
+}
+
+
+
+
+ + + diff --git a/2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/2.html b/2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/2.html new file mode 100644 index 0000000..de08493 --- /dev/null +++ b/2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/2.html @@ -0,0 +1,1271 @@ + + + + + + Cppcheck - HTML report - mate-netbook + + + + + + +
+ +
+
  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
/*
+ * Copyright (C) 2008 Canonical Ltd
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * 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 warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by Neil Jagdish Patel <neil.patel@canonical.com>
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+#include <gio/gio.h>
+
+#include "maximus-app.h"
+#include "maximus-bind.h"
+#include "xutils.h"
+
+/* GSettings schemas and keys */
+#define APP_SCHEMA        "org.mate.maximus"
+#define APP_EXCLUDE_CLASS "exclude-class"
+#define APP_UNDECORATE    "undecorate"
+#define APP_NO_MAXIMIZE   "no-maximize"
+
+/* A set of default exceptions */
+static gchar *default_exclude_classes[] = 
+{
+  "Apport-gtk",
+  "Bluetooth-properties",
+  "Bluetooth-wizard",
+  "Download", /* Firefox Download Window */
+  "Ekiga",
+  "Extension", /* Firefox Add-Ons/Extension Window */
+  "Gcalctool",
+  "Gimp",
+  "Global", /* Firefox Error Console Window */
+  "Mate-dictionary",
+  "Mate-language-selector",
+  "Mate-nettool",
+  "Mate-volume-control",
+  "Kiten",
+  "Kmplot",
+  "Nm-editor",
+  "Pidgin",
+  "Polkit-mate-authorization",
+  "Update-manager",
+  "Skype",
+  "Toplevel", /* Firefox "Clear Private Data" Window */
+  "Transmission"
+};
+
+struct _MaximusAppPrivate
+{
+  MaximusBind *bind;
+  WnckScreen *screen;
+  GSettings *settings;
+
+  gchar **exclude_class_list;
+  gboolean undecorate;
+  gboolean no_maximize;
+};
+
+static GQuark was_decorated = 0;
+
+/* <TAKEN FROM GDK> */
+typedef struct {
+    unsigned long flags;
+    unsigned long functions;
+    unsigned long decorations;
+    long input_mode;
+    unsigned long status;
+} MotifWmHints, MwmHints;
+
+#define MWM_HINTS_FUNCTIONS     (1L << 0)
+#define MWM_HINTS_DECORATIONS   (1L << 1)
+#define _XA_MOTIF_WM_HINTS		"_MOTIF_WM_HINTS"
+
+G_DEFINE_TYPE_WITH_PRIVATE (MaximusApp, maximus_app, G_TYPE_OBJECT);
+
+static gboolean
+wnck_window_is_decorated (WnckWindow *window)
+{
+  GdkDisplay *display = gdk_display_get_default();
+  Atom hints_atom = None;
+  guchar *data = NULL;
+  MotifWmHints *hints = NULL;
+  Atom type = None;
+  gint format;
+  gulong nitems;
+  gulong bytes_after;
+  gboolean retval;
+
+  g_return_val_if_fail (WNCK_IS_WINDOW (window), FALSE);
+  
+  hints_atom = gdk_x11_get_xatom_by_name_for_display (display, 
+                                                      _XA_MOTIF_WM_HINTS);
+
+  XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), 
+                      wnck_window_get_xid (window),
+		                  hints_atom, 0, sizeof (MotifWmHints)/sizeof (long),
+		                  False, AnyPropertyType, &type, &format, &nitems,
+		                  &bytes_after, &data);
+  
+  if (type == None || !data) return TRUE;<--- Assuming that condition '!data' is not redundant
+  
+  hints = (MotifWmHints *)data; 
+  
+  retval = hints->decorations;
+  
+  if (data)<--- Condition 'data' is always true
+    XFree (data);
+
+  return retval;
+}
+
+static void
+gdk_window_set_mwm_hints (WnckWindow *window,
+                          MotifWmHints *new_hints)
+{
+  GdkDisplay *display = gdk_display_get_default();
+  Atom hints_atom = None;
+  guchar *data = NULL;
+  MotifWmHints *hints = NULL;
+  Atom type = None;
+  gint format;
+  gulong nitems;
+  gulong bytes_after;
+
+  g_return_if_fail (WNCK_IS_WINDOW (window));
+  g_return_if_fail (GDK_IS_DISPLAY (display));
+  
+  hints_atom = gdk_x11_get_xatom_by_name_for_display (display, 
+                                                      _XA_MOTIF_WM_HINTS);
+
+  gdk_x11_display_error_trap_push (display);
+  XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), 
+                      wnck_window_get_xid (window),
+		                  hints_atom, 0, sizeof (MotifWmHints)/sizeof (long),
+		                  False, AnyPropertyType, &type, &format, &nitems,
+		                  &bytes_after, &data);
+  if (gdk_x11_display_error_trap_pop (display))
+    return;
+  
+  if (type != hints_atom || !data)
+    hints = new_hints;
+  else
+  {
+    hints = (MotifWmHints *)data;
+	
+    if (new_hints->flags & MWM_HINTS_FUNCTIONS)
+    {
+      hints->flags |= MWM_HINTS_FUNCTIONS;
+      hints->functions = new_hints->functions;  
+    }
+    if (new_hints->flags & MWM_HINTS_DECORATIONS)
+    {
+      hints->flags |= MWM_HINTS_DECORATIONS;
+      hints->decorations = new_hints->decorations;
+    }
+  }
+  
+  _wnck_error_trap_push ();
+  XChangeProperty (GDK_DISPLAY_XDISPLAY (display), 
+                   wnck_window_get_xid (window),
+                   hints_atom, hints_atom, 32, PropModeReplace,
+                   (guchar *)hints, sizeof (MotifWmHints)/sizeof (long));
+  gdk_display_flush (display);
+  _wnck_error_trap_pop ();
+  
+  if (data)
+    XFree (data);
+}
+
+static void
+_window_set_decorations (WnckWindow      *window,
+			                   GdkWMDecoration decorations)
+{
+  MotifWmHints *hints;
+  
+  g_return_if_fail (WNCK_IS_WINDOW (window));
+  
+  /* initialize to zero to avoid writing uninitialized data to socket */
+  hints = g_slice_new0 (MotifWmHints);
+  hints->flags = MWM_HINTS_DECORATIONS;
+  hints->decorations = decorations;
+ 
+  gdk_window_set_mwm_hints (window, hints);
+
+  g_slice_free (MotifWmHints, hints);
+}
+
+/* </TAKEN FROM GDK> */
+
+gboolean
+window_is_too_large_for_screen (WnckWindow *window)
+{
+  static GdkScreen *screen = NULL;
+  gint x=0, y=0, w=0, h=0;
+
+  g_return_val_if_fail (WNCK_IS_WINDOW (window), FALSE);
+
+  if (screen == NULL)
+    screen = gdk_screen_get_default ();
+    
+  wnck_window_get_geometry (window, &x, &y, &w, &h);
+  
+  /* some wiggle room */
+  return (screen && 
+          (w > (WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) + 20) ||
+           h > (HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) + 20)));
+}
+
+static gboolean
+on_window_maximised_changed (WnckWindow *window)
+{
+  g_return_val_if_fail (WNCK_IS_WINDOW (window), FALSE);
+
+  if (window_is_too_large_for_screen (window))
+    {
+      _window_set_decorations (window, 1);
+      wnck_window_unmaximize (window);
+    }
+  else
+    {
+      _window_set_decorations (window, 0);
+    }
+  return FALSE;
+}
+
+static gboolean
+enable_window_decorations (WnckWindow *window)
+{
+  g_return_val_if_fail (WNCK_IS_WINDOW (window), FALSE);
+
+  _window_set_decorations (window, 1);
+  return FALSE;
+}
+
+static void
+on_window_state_changed (WnckWindow      *window,
+                         WnckWindowState  change_mask,
+                         WnckWindowState  new_state,
+                         MaximusApp     *app)
+{
+  g_return_if_fail (WNCK_IS_WINDOW (window));
+
+  if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window), "exclude"))==1)
+    return;
+  
+  if (change_mask & WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY
+      || change_mask & WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY)
+  {
+    if (wnck_window_is_maximized (window) && app->priv->undecorate)
+    {
+      g_idle_add ((GSourceFunc)on_window_maximised_changed, window);
+    }
+    else
+    {
+      g_idle_add ((GSourceFunc)enable_window_decorations, window);
+    }
+  }
+}
+
+static gboolean
+is_excluded (MaximusApp *app, WnckWindow *window)
+{
+  MaximusAppPrivate *priv;
+  WnckWindowType type;
+  WnckWindowActions actions;
+  gchar *res_name;
+  gchar *class_name;
+  gint i;
+
+  g_return_val_if_fail (MAXIMUS_IS_APP (app), TRUE);
+  g_return_val_if_fail (WNCK_IS_WINDOW (window), TRUE);
+  priv = app->priv;
+
+  type = wnck_window_get_window_type (window);
+  if (type != WNCK_WINDOW_NORMAL)
+    return TRUE;
+
+  if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window), "exclude"))==1)
+    return TRUE;
+
+  /* Ignore if the window is already fullscreen */
+  if (wnck_window_is_fullscreen (window))
+  {
+    g_debug ("Excluding (is fullscreen): %s\n",wnck_window_get_name (window));
+    return TRUE;
+  }
+  
+  /* Make sure the window supports maximising */
+  actions = wnck_window_get_actions (window);
+  if (actions & WNCK_WINDOW_ACTION_RESIZE
+      && actions & WNCK_WINDOW_ACTION_MAXIMIZE_HORIZONTALLY
+      && actions & WNCK_WINDOW_ACTION_MAXIMIZE_VERTICALLY
+      && actions & WNCK_WINDOW_ACTION_MAXIMIZE)
+    ; /* Is good to maximise */
+  else
+    return TRUE;
+
+  _wnck_get_wmclass (wnck_window_get_xid (window), &res_name, &class_name);
+
+  g_debug ("Window opened: res_name=%s -- class_name=%s", res_name, class_name);
+ 
+  /* Check internal list of class_ids */
+  for (i = 0; i < G_N_ELEMENTS (default_exclude_classes); i++)
+  {
+    if ((class_name && default_exclude_classes[i] 
+        && strstr (class_name, default_exclude_classes[i]))
+        || (res_name && default_exclude_classes[i] && strstr (res_name, 
+                                            default_exclude_classes[i])))
+    {
+      g_debug ("Excluding: %s\n", wnck_window_get_name (window));
+      return TRUE;
+    } 
+  }
+
+  /* Check user list */
+  for (i = 0; priv->exclude_class_list[i] != NULL; i++)
+  {
+    if ((class_name && strstr (class_name, priv->exclude_class_list[i]))
+        || (res_name && strstr (res_name, priv->exclude_class_list[i]) ))
+    {
+      g_debug ("Excluding: %s\n", wnck_window_get_name (window));
+      return TRUE;
+    }
+  }
+
+  g_free (res_name);
+  g_free (class_name);
+  return FALSE;
+}
+
+extern gboolean no_maximize;
+
+static void
+on_window_opened (WnckScreen  *screen,
+                  WnckWindow  *window,
+                  MaximusApp *app)
+{ 
+  MaximusAppPrivate *priv;
+  WnckWindowType type;
+  gint exclude = 0;
+  GdkDisplay *gdk_display = gdk_display_get_default ();
+  
+  g_return_if_fail (MAXIMUS_IS_APP (app));
+  g_return_if_fail (WNCK_IS_WINDOW (window));
+  priv = app->priv;
+
+  type = wnck_window_get_window_type (window);
+  if (type != WNCK_WINDOW_NORMAL)
+    return;
+
+  /* Ignore undecorated windows */
+  gdk_x11_display_error_trap_push (gdk_display);
+  exclude = wnck_window_is_decorated (window) ? 0 : 1;
+  if (gdk_x11_display_error_trap_pop (gdk_display))
+    return;
+
+  if (wnck_window_is_maximized (window))
+    exclude = 0;
+  g_object_set_data (G_OBJECT (window), "exclude", GINT_TO_POINTER (exclude));
+
+  if (is_excluded (app, window))
+  {
+    g_signal_connect (window, "state-changed",
+                      G_CALLBACK (on_window_state_changed), app);
+    return;
+  }
+
+  if (no_maximize || priv->no_maximize)
+  {
+    if (wnck_window_is_maximized(window) && priv->undecorate)
+    {
+      _window_set_decorations (window, 0);
+      gdk_display_flush (gdk_display);
+    }
+    g_signal_connect (window, "state-changed",
+                      G_CALLBACK (on_window_state_changed), app);
+    return;
+  }
+
+  if (priv->undecorate)
+  {
+    /* Only undecorate right now if the window is smaller than the screen */
+    if (!window_is_too_large_for_screen (window))
+    {
+      _window_set_decorations (window, 0);
+      gdk_display_flush (gdk_display);
+    }
+  }
+
+  wnck_window_maximize (window);
+
+  g_signal_connect (window, "state-changed",
+                    G_CALLBACK (on_window_state_changed), app);
+}
+
+/* GSettings Callbacks */
+static void
+on_app_no_maximize_changed (GSettings *settings,
+                            gchar *key,
+                            MaximusApp *app)
+{
+  MaximusAppPrivate *priv;
+
+  g_return_if_fail (MAXIMUS_IS_APP (app));
+  priv = app->priv;
+  priv->no_maximize = g_settings_get_boolean (settings, key);
+}
+
+static void
+on_exclude_class_changed (GSettings *settings,
+                          gchar *key,
+                          MaximusApp         *app)
+{
+  MaximusAppPrivate *priv;
+  
+  g_return_if_fail (MAXIMUS_IS_APP (app));
+  priv = app->priv;
+
+  if (priv->exclude_class_list)
+    g_strfreev (priv->exclude_class_list);
+  
+  priv->exclude_class_list= g_settings_get_strv (settings, 
+                                                 APP_EXCLUDE_CLASS);
+}
+
+static gboolean
+show_desktop (WnckScreen *screen)
+{
+  g_return_val_if_fail (WNCK_IS_SCREEN (screen), FALSE);
+  
+  wnck_screen_toggle_showing_desktop (screen, TRUE);
+  return FALSE;
+}
+
+static void
+on_app_undecorate_changed (GSettings          *settings,
+                           gchar              *key,
+                           MaximusApp         *app)
+{
+  MaximusAppPrivate *priv;
+  GList *windows, *w;
+    
+  g_return_if_fail (MAXIMUS_IS_APP (app));
+  priv = app->priv;
+  g_return_if_fail (WNCK_IS_SCREEN (priv->screen));
+
+  priv->undecorate = g_settings_get_boolean (settings, APP_UNDECORATE);
+  g_debug ("%s\n", priv->undecorate ? "Undecorating" : "Decorating");
+  
+  windows = wnck_screen_get_windows (priv->screen);
+  for (w = windows; w; w = w->next)
+  {
+    WnckWindow *window = w->data;
+
+    if (!WNCK_IS_WINDOW (window))
+      continue;
+
+    if (no_maximize || priv->no_maximize)
+    {
+      if (!wnck_window_is_maximized(window))
+        continue;
+    }
+
+    if (!is_excluded (app, window))
+    {
+      GdkDisplay *gdk_display = gdk_display_get_default ();
+
+      gdk_x11_display_error_trap_push (gdk_display);
+      _window_set_decorations (window, priv->undecorate ? 0 : 1);
+      wnck_window_unmaximize (window);
+      wnck_window_maximize (window);
+      gdk_display_flush (gdk_display);
+      gdk_x11_display_error_trap_pop_ignored (gdk_display);
+
+      sleep (1);
+    }
+  }
+  /* We want the user to be left on the launcher/desktop after switching modes*/
+  g_timeout_add_seconds (1, (GSourceFunc)show_desktop, priv->screen);
+}
+
+/* GObject stuff */
+static void
+maximus_app_class_init (MaximusAppClass *klass)
+{
+}
+
+static void
+maximus_app_init (MaximusApp *app)
+{
+  MaximusAppPrivate *priv;
+  WnckScreen *screen;
+	
+  priv = app->priv = maximus_app_get_instance_private (app);
+
+  priv->bind = maximus_bind_get_default ();
+
+  was_decorated = g_quark_from_static_string ("was-decorated");
+
+  priv->settings = g_settings_new (APP_SCHEMA);
+
+  g_signal_connect (priv->settings, "changed::" APP_EXCLUDE_CLASS,
+                    G_CALLBACK (on_exclude_class_changed), app);
+  g_signal_connect (priv->settings, "changed::" APP_UNDECORATE,
+                    G_CALLBACK (on_app_undecorate_changed), app);
+  g_signal_connect (priv->settings, "changed::" APP_NO_MAXIMIZE,
+                    G_CALLBACK (on_app_no_maximize_changed), app);
+
+  priv->exclude_class_list = g_settings_get_strv (priv->settings, APP_EXCLUDE_CLASS); 
+  priv->undecorate = g_settings_get_boolean (priv->settings, APP_UNDECORATE);
+  priv->no_maximize = g_settings_get_boolean (priv->settings, APP_NO_MAXIMIZE);
+  g_print ("no maximize: %s\n", priv->no_maximize ? "true" : "false");
+ 
+  priv->screen = screen = wnck_screen_get_default ();
+  g_signal_connect (screen, "window-opened",
+                    G_CALLBACK (on_window_opened), app);
+}
+
+MaximusApp *
+maximus_app_get_default (void)
+
+{
+  static MaximusApp *app = NULL;
+
+  if (!app)
+    app = g_object_new (MAXIMUS_TYPE_APP, 
+                        NULL);
+
+  return app;
+}
+
+
+
+
+ + + diff --git a/2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/3.html b/2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/3.html new file mode 100644 index 0000000..73ef27e --- /dev/null +++ b/2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/3.html @@ -0,0 +1,1163 @@ + + + + + + Cppcheck - HTML report - mate-netbook + + + + + + +
+ +
+
  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
/*
+ * Copyright (C) 2008 Canonical Ltd
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * 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 warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by Neil Jagdish Patel <neil.patel@canonical.com>
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+
+#include <gdk/gdkkeysyms.h>
+
+#include <gio/gio.h>
+
+#define WNCK_I_KNOW_THIS_IS_UNSTABLE
+#include <libwnck/libwnck.h>
+
+#include <X11/Xlib.h>
+#include <X11/Xresource.h>
+#include <X11/Xutil.h>
+#include <X11/extensions/XTest.h>
+#include <X11/keysymdef.h>
+#include <X11/keysym.h>
+
+#include <fakekey/fakekey.h>
+
+#include "maximus-bind.h"
+
+#include "tomboykeybinder.h"
+#include "eggaccelerators.h"
+
+#define KEY_RELEASE_TIMEOUT 300
+#define STATE_CHANGED_SLEEP 0.5
+
+/* GSettings schemas and keys */
+#define BIND_SCHEMA        "org.mate.maximus"
+#define BIND_EXCLUDE_CLASS "binding"
+
+#define SYSRULESDIR SYSCONFDIR"/maximus"
+
+#ifdef __GNUC__
+#define UNUSED_VARIABLE __attribute__ ((unused))
+#else
+#define UNUSED_VARIABLE
+#endif
+
+struct _MaximusBindPrivate
+{
+  FakeKey *fk;
+  WnckScreen *screen;
+  GSettings *settings;
+
+  gchar *binding;
+
+  GList *rules;
+};
+
+typedef struct
+{
+  gchar *wm_class;
+  gchar *fullscreen;
+  gchar *unfullscreen;
+} MaximusRule;
+
+G_DEFINE_TYPE_WITH_PRIVATE (MaximusBind, maximus_bind, G_TYPE_OBJECT);
+
+static const gchar *
+get_fullscreen_keystroke (GList *rules, WnckWindow *window)
+{
+  WnckClassGroup *group;
+  const gchar *class_name;
+  GList *r;
+
+  group = wnck_window_get_class_group (window);
+  class_name = wnck_class_group_get_name (group);
+
+  g_debug ("Searching rules for %s:\n", wnck_window_get_name (window));
+
+  for (r = rules; r; r = r->next)
+  {
+    MaximusRule *rule = r->data;
+
+    g_debug ("\t%s ?= %s", class_name, rule->wm_class);
+
+    if (class_name && rule->wm_class && strstr (class_name, rule->wm_class))
+    {
+      g_debug ("\tYES!\n");
+      return rule->fullscreen;
+    }
+    g_debug ("\tNO!\n");
+  }
+
+  return NULL;
+}
+
+static const gchar *
+get_unfullscreen_keystroke (GList *rules, WnckWindow *window)
+{
+  WnckClassGroup *group;
+  const gchar *class_name;
+  GList *r;
+
+  group = wnck_window_get_class_group (window);
+  class_name = wnck_class_group_get_name (group);
+
+  for (r = rules; r; r = r->next)
+  {
+    MaximusRule *rule = r->data;
+
+    if (class_name && rule->wm_class && strstr (class_name, rule->wm_class))
+    {
+      return rule->unfullscreen;
+    }
+  }
+
+  return NULL;
+}
+static gboolean
+real_fullscreen (MaximusBind *bind)
+{
+  MaximusBindPrivate *priv;
+  GdkDisplay UNUSED_VARIABLE *display;
+  WnckWindow *active;
+  const gchar *keystroke;
+
+  priv = bind->priv;
+
+  display = gdk_display_get_default ();<--- Variable 'display' is assigned a value that is never used.
+  active = wnck_screen_get_active_window (priv->screen);
+
+  if (!WNCK_IS_WINDOW (active)
+        || wnck_window_get_window_type (active) != WNCK_WINDOW_NORMAL)
+    return FALSE;
+
+  keystroke = get_fullscreen_keystroke (priv->rules, active);
+
+  if (keystroke)
+  {
+    guint keysym = 0;
+    EggVirtualModifierType modifiers = 0;
+
+    if (egg_accelerator_parse_virtual (keystroke, &keysym, &modifiers))
+    {
+      guint mods = 0;
+
+      if (modifiers & EGG_VIRTUAL_SHIFT_MASK)
+        mods |= FAKEKEYMOD_SHIFT;
+      if (modifiers & EGG_VIRTUAL_CONTROL_MASK)
+        mods |= FAKEKEYMOD_CONTROL;
+      if (modifiers & EGG_VIRTUAL_ALT_MASK)
+        mods |= FAKEKEYMOD_ALT;
+      if (modifiers & EGG_VIRTUAL_META_MASK)
+        mods |= FAKEKEYMOD_META;
+
+      g_debug ("Sending fullscreen special event: %s = %d %d",
+               keystroke, keysym, mods);
+      fakekey_press_keysym (priv->fk, keysym, mods);
+      fakekey_release (priv->fk);
+
+      return FALSE;
+     }
+  }
+
+  if (!wnck_window_is_fullscreen (active))
+  {
+    g_debug ("Sending fullscreen F11 event");
+    fakekey_press_keysym (priv->fk, XK_F11, 0);
+    fakekey_release (priv->fk);
+  }
+
+  sleep (STATE_CHANGED_SLEEP);
+
+  if (!wnck_window_is_fullscreen (active))
+  {
+    g_debug ("Forcing fullscreen wnck event");
+    wnck_window_set_fullscreen (active, TRUE);
+  }
+
+  return FALSE;
+}
+
+static void
+fullscreen (MaximusBind *bind, WnckWindow *window)
+{
+  MaximusBindPrivate UNUSED_VARIABLE *priv;
+  
+  priv = bind->priv;<--- Variable 'priv' is assigned a value that is never used.
+
+  g_timeout_add (KEY_RELEASE_TIMEOUT, (GSourceFunc)real_fullscreen, bind);
+}
+
+static gboolean
+real_unfullscreen (MaximusBind *bind)
+{
+  MaximusBindPrivate *priv;
+  GdkDisplay UNUSED_VARIABLE *display;
+  WnckWindow *active;
+  const gchar *keystroke;
+
+  priv = bind->priv;
+
+  display = gdk_display_get_default ();<--- Variable 'display' is assigned a value that is never used.
+  active = wnck_screen_get_active_window (priv->screen);
+
+  if (!WNCK_IS_WINDOW (active)
+        || wnck_window_get_window_type (active) != WNCK_WINDOW_NORMAL)
+    return FALSE;
+
+  keystroke = get_unfullscreen_keystroke (priv->rules, active);
+
+  if (keystroke)
+  {
+    guint keysym = 0;
+    EggVirtualModifierType modifiers = 0;
+
+    if (egg_accelerator_parse_virtual (keystroke, &keysym, &modifiers))
+    {
+      guint mods = 0;
+
+      if (modifiers & EGG_VIRTUAL_SHIFT_MASK)
+        mods |= FAKEKEYMOD_SHIFT;
+      if (modifiers & EGG_VIRTUAL_CONTROL_MASK)
+        mods |= FAKEKEYMOD_CONTROL;
+      if (modifiers & EGG_VIRTUAL_ALT_MASK)
+        mods |= FAKEKEYMOD_ALT;
+      if (modifiers & EGG_VIRTUAL_META_MASK)
+        mods |= FAKEKEYMOD_META;
+
+      g_debug ("Sending fullscreen special event: %s = %d %d",
+               keystroke, keysym, mods);
+      fakekey_press_keysym (priv->fk, keysym, mods);
+      fakekey_release (priv->fk);
+
+      return FALSE;
+     }
+  }
+  if (wnck_window_is_fullscreen (active))
+  {
+    g_debug ("Sending un-fullscreen F11 event");
+    fakekey_press_keysym (priv->fk, XK_F11, 0);
+    fakekey_release (priv->fk);
+  }
+
+  sleep (STATE_CHANGED_SLEEP);
+
+  if (wnck_window_is_fullscreen (active))
+  {
+    g_debug ("Forcing un-fullscreen wnck event");
+    wnck_window_set_fullscreen (active, FALSE);
+  }
+
+  return FALSE;
+}
+
+static void
+unfullscreen (MaximusBind *bind, WnckWindow *window)
+{
+  MaximusBindPrivate UNUSED_VARIABLE *priv;
+  
+  priv = bind->priv;<--- Variable 'priv' is assigned a value that is never used.
+
+  g_timeout_add (KEY_RELEASE_TIMEOUT, (GSourceFunc)real_unfullscreen, bind);
+}
+
+static void
+on_binding_activated (gchar *keystring, MaximusBind *bind)
+{
+  MaximusBindPrivate *priv;
+  WnckWindow *active;
+
+  g_return_if_fail (MAXIMUS_IS_BIND (bind));
+  priv = bind->priv;
+
+  active = wnck_screen_get_active_window (priv->screen);
+
+  if (wnck_window_get_window_type (active) != WNCK_WINDOW_NORMAL)
+    return;
+
+  if (wnck_window_is_fullscreen (active))
+  {
+    unfullscreen (bind, active);
+  }
+  else
+  {
+    fullscreen (bind, active);
+  }
+}
+
+/* Callbacks */
+static gboolean
+binding_is_valid (const gchar *binding)
+{
+  gboolean retval = TRUE;
+
+  if (!binding || strlen (binding) < 1 || strcmp (binding, "disabled") == 0)
+    retval = FALSE;
+
+  return retval;
+}
+
+static void
+on_binding_changed (GSettings      *settings,
+                    gchar          *key,
+                    MaximusBind    *bind)
+{
+  MaximusBindPrivate *priv;
+
+  g_return_if_fail (MAXIMUS_IS_BIND (bind));
+  priv = bind->priv;
+
+  if (binding_is_valid (priv->binding))
+    tomboy_keybinder_unbind (priv->binding,
+                             (TomboyBindkeyHandler)on_binding_changed);
+  g_free (priv->binding);
+
+  priv->binding = g_settings_get_string (settings, BIND_EXCLUDE_CLASS);
+
+  if (binding_is_valid (priv->binding))
+    tomboy_keybinder_bind (priv->binding,
+                           (TomboyBindkeyHandler)on_binding_activated,
+                           bind);
+
+  g_print ("Binding changed: %s\n", priv->binding);
+}
+
+/* GObject stuff */
+static void
+create_rule (MaximusBind *bind, const gchar *filename)
+{
+#define RULE_GROUP "Fullscreening"
+#define RULE_WMCLASS "WMClass"
+#define RULE_FULLSCREEN "Fullscreen"
+#define RULE_UNFULLSCREEN "Unfullscreen"
+  MaximusBindPrivate *priv;
+  GKeyFile *file;
+  GError *error = NULL;
+  MaximusRule *rule;
+
+  priv = bind->priv;
+
+  file = g_key_file_new ();
+  g_key_file_load_from_file (file, filename, 0, &error);
+  if (error)
+  {
+    g_warning ("Unable to load %s: %s\n", filename, error->message);
+    g_error_free (error);
+    g_key_file_free (file);
+    return;
+  }
+
+  rule = g_slice_new0 (MaximusRule);
+
+  rule->wm_class = g_key_file_get_string (file,
+                                          RULE_GROUP, RULE_WMCLASS,
+                                          NULL);
+  rule->fullscreen = g_key_file_get_string (file,
+                                            RULE_GROUP, RULE_FULLSCREEN,
+                                            NULL);
+  rule->unfullscreen = g_key_file_get_string (file,
+                                              RULE_GROUP, RULE_UNFULLSCREEN,
+                                              NULL);
+  if (!rule->wm_class || !rule->fullscreen || !rule->unfullscreen)
+  {
+    g_free (rule->wm_class);
+    g_free (rule->fullscreen);
+    g_free (rule->unfullscreen);
+    g_slice_free (MaximusRule, rule);
+
+    g_warning ("Unable to load %s, missing strings", filename);
+  }
+  else
+    priv->rules = g_list_append (priv->rules, rule);
+
+  g_key_file_free (file);
+}
+
+static void
+load_rules (MaximusBind *bind, const gchar *path)
+{
+  MaximusBindPrivate UNUSED_VARIABLE *priv;
+  GDir *dir;
+  const gchar *name;
+
+  priv = bind->priv;<--- Variable 'priv' is assigned a value that is never used.
+
+  dir = g_dir_open (path, 0, NULL);
+
+  if (!dir)
+    return;
+
+  while ((name = g_dir_read_name (dir)))
+  {
+    gchar *filename;
+
+    filename= g_build_filename (path, name, NULL);
+
+    create_rule (bind, filename);
+
+    g_free (filename);
+  }
+
+  g_dir_close (dir);
+}
+
+static void
+maximus_bind_finalize (GObject *obj)
+{
+  MaximusBind *bind = MAXIMUS_BIND (obj);
+  MaximusBindPrivate *priv;
+  GList *r;
+
+  g_return_if_fail (MAXIMUS_IS_BIND (bind));
+  priv = bind->priv;
+
+  for (r = priv->rules; r; r = r->next)
+  {
+    MaximusRule *rule = r->data;
+
+    g_free (rule->wm_class);
+    g_free (rule->fullscreen);
+    g_free (rule->unfullscreen);
+
+    g_slice_free (MaximusRule, rule);
+  }
+  g_free (priv->binding);
+
+  G_OBJECT_CLASS (maximus_bind_parent_class)->finalize (obj);
+}
+
+static void
+maximus_bind_class_init (MaximusBindClass *klass)
+{
+  GObjectClass        *obj_class = G_OBJECT_CLASS (klass);
+
+  obj_class->finalize = maximus_bind_finalize;
+}
+
+static void
+maximus_bind_init (MaximusBind *bind)
+{
+  MaximusBindPrivate *priv;
+  GdkDisplay *display = gdk_display_get_default ();
+  WnckScreen *screen;
+
+  priv = bind->priv = maximus_bind_get_instance_private (bind);
+
+  priv->fk = fakekey_init (GDK_DISPLAY_XDISPLAY (display));
+  priv->screen = screen = wnck_screen_get_default ();
+  priv->rules = NULL;
+  priv->settings = g_settings_new (BIND_SCHEMA);
+
+  tomboy_keybinder_init ();
+
+  g_signal_connect (priv->settings, "changed::" BIND_EXCLUDE_CLASS,
+                    G_CALLBACK (on_binding_changed), bind);
+
+  priv->binding = g_settings_get_string (priv->settings, BIND_EXCLUDE_CLASS);
+
+  if (binding_is_valid (priv->binding))
+    tomboy_keybinder_bind (priv->binding,
+                           (TomboyBindkeyHandler)on_binding_activated,
+                           bind);
+
+  load_rules (bind, SYSRULESDIR);
+}
+
+MaximusBind *
+maximus_bind_get_default (void)
+
+{
+  static MaximusBind *bind = NULL;
+
+  if (!bind)
+    bind = g_object_new (MAXIMUS_TYPE_BIND,
+                       NULL);
+
+  return bind;
+}
+
+
+
+
+ + + diff --git a/2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/4.html b/2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/4.html new file mode 100644 index 0000000..75deb6d --- /dev/null +++ b/2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/4.html @@ -0,0 +1,853 @@ + + + + + + Cppcheck - HTML report - mate-netbook + + + + + + +
+ +
+
  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
/* tomboykeybinder.c
+ * Copyright (C) 2008 Novell
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * 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,
+	};
+	int 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);
+
+	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, gpointer data)
+{
+	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)
+{
+	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_DISPLAY_XDISPLAY (gdk_display_get_default ()));
+
+	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-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/index.html b/2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/index.html new file mode 100644 index 0000000..bb77dd3 --- /dev/null +++ b/2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/index.html @@ -0,0 +1,132 @@ + + + + + + Cppcheck - HTML report - mate-netbook + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + +
LineIdCWESeverityMessage
missingIncludeSysteminformationCppcheck cannot find all the include files (use --check-config for details)
maximus/eggaccelerators.c
322duplicateExpression398styleSame expression on both sides of '-='.
maximus/main.c
96unreadVariable563styleVariable 'app' is assigned a value that is never used.
maximus/maximus-app.c
124knownConditionTrueFalse571styleCondition 'data' is always true
maximus/maximus-bind.c
144unreadVariable563styleVariable 'display' is assigned a value that is never used.
203unreadVariable563styleVariable 'priv' is assigned a value that is never used.
218unreadVariable563styleVariable 'display' is assigned a value that is never used.
276unreadVariable563styleVariable 'priv' is assigned a value that is never used.
400unreadVariable563styleVariable 'priv' is assigned a value that is never used.
maximus/tomboykeybinder.c
282constParameter398styleParameter 'handler' can be declared with const
+
+
+ + + diff --git a/2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/stats.html b/2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/stats.html new file mode 100644 index 0000000..2528133 --- /dev/null +++ b/2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/stats.html @@ -0,0 +1,109 @@ + + + + + + Cppcheck - HTML report - mate-netbook + + + + + + +
+ +
+

Top 10 files for style severity, total findings: 9
+   5  maximus/maximus-bind.c
+   1  maximus/tomboykeybinder.c
+   1  maximus/maximus-app.c
+   1  maximus/main.c
+   1  maximus/eggaccelerators.c
+

+ +
+
+ + + diff --git a/2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/style.css b/2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_master/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-12-11-150702-1198-cppcheck@d1ffecd40bf5_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; +} -- cgit v1.2.1