diff options
Diffstat (limited to '2021-06-21-213330-4389-cppcheck@e2f7cfd5fc80_master')
7 files changed, 4684 insertions, 0 deletions
diff --git a/2021-06-21-213330-4389-cppcheck@e2f7cfd5fc80_master/0.html b/2021-06-21-213330-4389-cppcheck@e2f7cfd5fc80_master/0.html new file mode 100644 index 0000000..8966cd9 --- /dev/null +++ b/2021-06-21-213330-4389-cppcheck@e2f7cfd5fc80_master/0.html @@ -0,0 +1,1489 @@ + +<!doctype html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>Cppcheck - HTML report - mate-netbook</title> + <link rel="stylesheet" href="style.css"> + <style> +pre { line-height: 125%; } +td.linenos pre { color: #000000; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; } +span.linenos { color: #000000; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; } +td.linenos pre.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +.highlight .hll { background-color: #ffffcc } +.highlight { background: #ffffff; } +.highlight .c { color: #888888 } /* Comment */ +.highlight .err { color: #FF0000; background-color: #FFAAAA } /* Error */ +.highlight .k { color: #008800; font-weight: bold } /* Keyword */ +.highlight .o { color: #333333 } /* Operator */ +.highlight .ch { color: #888888 } /* Comment.Hashbang */ +.highlight .cm { color: #888888 } /* Comment.Multiline */ +.highlight .cp { color: #557799 } /* Comment.Preproc */ +.highlight .cpf { color: #888888 } /* Comment.PreprocFile */ +.highlight .c1 { color: #888888 } /* Comment.Single */ +.highlight .cs { color: #cc0000; font-weight: bold } /* Comment.Special */ +.highlight .gd { color: #A00000 } /* Generic.Deleted */ +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .gr { color: #FF0000 } /* Generic.Error */ +.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.highlight .gi { color: #00A000 } /* Generic.Inserted */ +.highlight .go { color: #888888 } /* Generic.Output */ +.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.highlight .gt { color: #0044DD } /* Generic.Traceback */ +.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ +.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { color: #003388; font-weight: bold } /* Keyword.Pseudo */ +.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #333399; font-weight: bold } /* Keyword.Type */ +.highlight .m { color: #6600EE; font-weight: bold } /* Literal.Number */ +.highlight .s { background-color: #fff0f0 } /* Literal.String */ +.highlight .na { color: #0000CC } /* Name.Attribute */ +.highlight .nb { color: #007020 } /* Name.Builtin */ +.highlight .nc { color: #BB0066; font-weight: bold } /* Name.Class */ +.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ +.highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ +.highlight .ni { color: #880000; font-weight: bold } /* Name.Entity */ +.highlight .ne { color: #FF0000; font-weight: bold } /* Name.Exception */ +.highlight .nf { color: #0066BB; font-weight: bold } /* Name.Function */ +.highlight .nl { color: #997700; font-weight: bold } /* Name.Label */ +.highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ +.highlight .nt { color: #007700 } /* Name.Tag */ +.highlight .nv { color: #996633 } /* Name.Variable */ +.highlight .ow { color: #000000; font-weight: bold } /* Operator.Word */ +.highlight .w { color: #bbbbbb } /* Text.Whitespace */ +.highlight .mb { color: #6600EE; font-weight: bold } /* Literal.Number.Bin */ +.highlight .mf { color: #6600EE; font-weight: bold } /* Literal.Number.Float */ +.highlight .mh { color: #005588; font-weight: bold } /* Literal.Number.Hex */ +.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ +.highlight .mo { color: #4400EE; font-weight: bold } /* Literal.Number.Oct */ +.highlight .sa { background-color: #fff0f0 } /* Literal.String.Affix */ +.highlight .sb { background-color: #fff0f0 } /* Literal.String.Backtick */ +.highlight .sc { color: #0044DD } /* Literal.String.Char */ +.highlight .dl { background-color: #fff0f0 } /* Literal.String.Delimiter */ +.highlight .sd { color: #DD4422 } /* Literal.String.Doc */ +.highlight .s2 { background-color: #fff0f0 } /* Literal.String.Double */ +.highlight .se { color: #666666; font-weight: bold; background-color: #fff0f0 } /* Literal.String.Escape */ +.highlight .sh { background-color: #fff0f0 } /* Literal.String.Heredoc */ +.highlight .si { background-color: #eeeeee } /* Literal.String.Interpol */ +.highlight .sx { color: #DD2200; background-color: #fff0f0 } /* Literal.String.Other */ +.highlight .sr { color: #000000; background-color: #fff0ff } /* Literal.String.Regex */ +.highlight .s1 { background-color: #fff0f0 } /* Literal.String.Single */ +.highlight .ss { color: #AA6600 } /* Literal.String.Symbol */ +.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ +.highlight .fm { color: #0066BB; font-weight: bold } /* Name.Function.Magic */ +.highlight .vc { color: #336699 } /* Name.Variable.Class */ +.highlight .vg { color: #dd7700; font-weight: bold } /* Name.Variable.Global */ +.highlight .vi { color: #3333BB } /* Name.Variable.Instance */ +.highlight .vm { color: #996633 } /* Name.Variable.Magic */ +.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ + </style> + <script> + function getStyle(el, styleProp) { + var y; + + if (el.currentStyle) { + y = el.currentStyle[styleProp]; + } else if (window.getComputedStyle) { + y = document.defaultView.getComputedStyle(el, null).getPropertyValue(styleProp); + } + + return y; + } + + function toggle() { + var el = this.expandable_content; + var mark = this.expandable_marker; + + if (el.style.display === "block") { + el.style.display = "none"; + mark.textContent = "[+]"; + } else { + el.style.display = "block"; + mark.textContent = "[-]"; + } + } + + function initExpandables() { + var elements = document.querySelectorAll(".expandable"); + + for (var i = 0, len = elements.length; i < len; i++) { + var el = elements[i]; + var clickable = el.querySelector("span"); + var marker = clickable.querySelector(".marker"); + var content = el.querySelector(".content"); + var width = clickable.clientWidth - parseInt(getStyle(content, "padding-left")) - parseInt(getStyle(content, "padding-right")); + content.style.width = width + "px"; + clickable.expandable_content = content; + clickable.expandable_marker = marker; + clickable.addEventListener("click", toggle); + } + } + + function toggleDisplay(id) { + var elements = document.querySelectorAll("." + id); + + for (var i = 0, len = elements.length; i < len; i++) { + elements[i].classList.toggle("d-none"); + } + } + + function toggleAll() { + var elements = document.querySelectorAll("input"); + + // starting from 1 since 0 is the "toggle all" input + for (var i = 1, len = elements.length; i < len; i++) { + var el = elements[i]; + + if (el.checked) { + el.checked = false; + } else { + el.checked = true; + } + + toggleDisplay(el.id); + } + } + window.addEventListener("load", initExpandables); + </script> + </head> + <body> + <div id="header" class="header"> + <h1>Cppcheck report - mate-netbook: maximus/eggaccelerators.c</h1> + </div> + <div class="wrapper"> + <div id="menu"> + <p id="filename"><a href="index.html">Defects:</a> eggaccelerators.c</p> +<a href="0.html#line-322"> duplicateExpression 322</a> + </div> + <div id="content"> +<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 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</pre></div></td><td class="code"><div class="highlight"><pre><span></span><a name="line-1"></a><span class="cm">/* eggaccelerators.c</span> +<a name="line-2"></a><span class="cm"> * Copyright (C) 2002 Red Hat, Inc.; Copyright 1998, 2001 Tim Janik</span> +<a name="line-3"></a><span class="cm"> * Copyright (C) 2012-2021 MATE Developers</span> +<a name="line-4"></a><span class="cm"> * Developed by Havoc Pennington, Tim Janik</span> +<a name="line-5"></a><span class="cm"> *</span> +<a name="line-6"></a><span class="cm"> * This library is free software; you can redistribute it and/or</span> +<a name="line-7"></a><span class="cm"> * modify it under the terms of the GNU Library General Public</span> +<a name="line-8"></a><span class="cm"> * License as published by the Free Software Foundation; either</span> +<a name="line-9"></a><span class="cm"> * version 2 of the License, or (at your option) any later version.</span> +<a name="line-10"></a><span class="cm"> *</span> +<a name="line-11"></a><span class="cm"> * This library is distributed in the hope that it will be useful,</span> +<a name="line-12"></a><span class="cm"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span> +<a name="line-13"></a><span class="cm"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> +<a name="line-14"></a><span class="cm"> * Library General Public License for more details.</span> +<a name="line-15"></a><span class="cm"> *</span> +<a name="line-16"></a><span class="cm"> * You should have received a copy of the GNU Library General Public</span> +<a name="line-17"></a><span class="cm"> * License along with this library; if not, write to the</span> +<a name="line-18"></a><span class="cm"> * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA </span> +<a name="line-19"></a><span class="cm"> */</span> +<a name="line-20"></a> +<a name="line-21"></a><span class="cp">#include</span> <span class="cpf">"eggaccelerators.h"</span><span class="cp"></span> +<a name="line-22"></a> +<a name="line-23"></a><span class="cp">#include</span> <span class="cpf"><string.h></span><span class="cp"></span> +<a name="line-24"></a><span class="cp">#include</span> <span class="cpf"><gdk/gdkx.h></span><span class="cp"></span> +<a name="line-25"></a><span class="cp">#include</span> <span class="cpf"><gdk/gdkkeysyms.h></span><span class="cp"></span> +<a name="line-26"></a> +<a name="line-27"></a><span class="k">enum</span> +<a name="line-28"></a><span class="p">{</span> +<a name="line-29"></a> <span class="n">EGG_MODMAP_ENTRY_SHIFT</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> +<a name="line-30"></a> <span class="n">EGG_MODMAP_ENTRY_LOCK</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> +<a name="line-31"></a> <span class="n">EGG_MODMAP_ENTRY_CONTROL</span> <span class="o">=</span> <span class="mi">2</span><span class="p">,</span> +<a name="line-32"></a> <span class="n">EGG_MODMAP_ENTRY_MOD1</span> <span class="o">=</span> <span class="mi">3</span><span class="p">,</span> +<a name="line-33"></a> <span class="n">EGG_MODMAP_ENTRY_MOD2</span> <span class="o">=</span> <span class="mi">4</span><span class="p">,</span> +<a name="line-34"></a> <span class="n">EGG_MODMAP_ENTRY_MOD3</span> <span class="o">=</span> <span class="mi">5</span><span class="p">,</span> +<a name="line-35"></a> <span class="n">EGG_MODMAP_ENTRY_MOD4</span> <span class="o">=</span> <span class="mi">6</span><span class="p">,</span> +<a name="line-36"></a> <span class="n">EGG_MODMAP_ENTRY_MOD5</span> <span class="o">=</span> <span class="mi">7</span><span class="p">,</span> +<a name="line-37"></a> <span class="n">EGG_MODMAP_ENTRY_LAST</span> <span class="o">=</span> <span class="mi">8</span> +<a name="line-38"></a><span class="p">};</span> +<a name="line-39"></a> +<a name="line-40"></a><span class="cp">#define MODMAP_ENTRY_TO_MODIFIER(x) (1 << (x))</span> +<a name="line-41"></a> +<a name="line-42"></a><span class="k">typedef</span> <span class="k">struct</span> +<a name="line-43"></a><span class="p">{</span> +<a name="line-44"></a> <span class="n">EggVirtualModifierType</span> <span class="n">mapping</span><span class="p">[</span><span class="n">EGG_MODMAP_ENTRY_LAST</span><span class="p">];</span> +<a name="line-45"></a> +<a name="line-46"></a><span class="p">}</span> <span class="n">EggModmap</span><span class="p">;</span> +<a name="line-47"></a> +<a name="line-48"></a><span class="k">const</span> <span class="n">EggModmap</span><span class="o">*</span> <span class="n">egg_keymap_get_modmap</span> <span class="p">(</span><span class="n">GdkKeymap</span> <span class="o">*</span><span class="n">keymap</span><span class="p">);</span> +<a name="line-49"></a> +<a name="line-50"></a><span class="k">static</span> <span class="kr">inline</span> <span class="n">gboolean</span> +<a name="line-51"></a><span class="n">is_alt</span> <span class="p">(</span><span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">string</span><span class="p">)</span> +<a name="line-52"></a><span class="p">{</span> +<a name="line-53"></a> <span class="k">return</span> <span class="p">((</span><span class="n">string</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'<'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-54"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'a'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'A'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-55"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'l'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'L'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-56"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'t'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'T'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-57"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'>'</span><span class="p">));</span> +<a name="line-58"></a><span class="p">}</span> +<a name="line-59"></a> +<a name="line-60"></a><span class="k">static</span> <span class="kr">inline</span> <span class="n">gboolean</span> +<a name="line-61"></a><span class="n">is_ctl</span> <span class="p">(</span><span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">string</span><span class="p">)</span> +<a name="line-62"></a><span class="p">{</span> +<a name="line-63"></a> <span class="k">return</span> <span class="p">((</span><span class="n">string</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'<'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-64"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'c'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'C'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-65"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'t'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'T'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-66"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'l'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'L'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-67"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'>'</span><span class="p">));</span> +<a name="line-68"></a><span class="p">}</span> +<a name="line-69"></a> +<a name="line-70"></a><span class="k">static</span> <span class="kr">inline</span> <span class="n">gboolean</span> +<a name="line-71"></a><span class="n">is_modx</span> <span class="p">(</span><span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">string</span><span class="p">)</span> +<a name="line-72"></a><span class="p">{</span> +<a name="line-73"></a> <span class="k">return</span> <span class="p">((</span><span class="n">string</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'<'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-74"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'m'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'M'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-75"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'o'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'O'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-76"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'d'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'D'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-77"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">>=</span> <span class="sc">'1'</span> <span class="o">&&</span> <span class="n">string</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o"><=</span> <span class="sc">'5'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-78"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'>'</span><span class="p">));</span> +<a name="line-79"></a><span class="p">}</span> +<a name="line-80"></a> +<a name="line-81"></a><span class="k">static</span> <span class="kr">inline</span> <span class="n">gboolean</span> +<a name="line-82"></a><span class="n">is_ctrl</span> <span class="p">(</span><span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">string</span><span class="p">)</span> +<a name="line-83"></a><span class="p">{</span> +<a name="line-84"></a> <span class="k">return</span> <span class="p">((</span><span class="n">string</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'<'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-85"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'c'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'C'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-86"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'t'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'T'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-87"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'r'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'R'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-88"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'l'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'L'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-89"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'>'</span><span class="p">));</span> +<a name="line-90"></a><span class="p">}</span> +<a name="line-91"></a> +<a name="line-92"></a><span class="k">static</span> <span class="kr">inline</span> <span class="n">gboolean</span> +<a name="line-93"></a><span class="n">is_shft</span> <span class="p">(</span><span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">string</span><span class="p">)</span> +<a name="line-94"></a><span class="p">{</span> +<a name="line-95"></a> <span class="k">return</span> <span class="p">((</span><span class="n">string</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'<'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-96"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'s'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'S'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-97"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'h'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'H'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-98"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'f'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'F'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-99"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'t'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'T'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-100"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'>'</span><span class="p">));</span> +<a name="line-101"></a><span class="p">}</span> +<a name="line-102"></a> +<a name="line-103"></a><span class="k">static</span> <span class="kr">inline</span> <span class="n">gboolean</span> +<a name="line-104"></a><span class="n">is_shift</span> <span class="p">(</span><span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">string</span><span class="p">)</span> +<a name="line-105"></a><span class="p">{</span> +<a name="line-106"></a> <span class="k">return</span> <span class="p">((</span><span class="n">string</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'<'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-107"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'s'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'S'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-108"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'h'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'H'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-109"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'i'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'I'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-110"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'f'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'F'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-111"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'t'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'T'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-112"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'>'</span><span class="p">));</span> +<a name="line-113"></a><span class="p">}</span> +<a name="line-114"></a> +<a name="line-115"></a><span class="k">static</span> <span class="kr">inline</span> <span class="n">gboolean</span> +<a name="line-116"></a><span class="n">is_control</span> <span class="p">(</span><span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">string</span><span class="p">)</span> +<a name="line-117"></a><span class="p">{</span> +<a name="line-118"></a> <span class="k">return</span> <span class="p">((</span><span class="n">string</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'<'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-119"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'c'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'C'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-120"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'o'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'O'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-121"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'n'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'N'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-122"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'t'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'T'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-123"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'r'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'R'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-124"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'o'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'O'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-125"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">7</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'l'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">7</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'L'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-126"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">8</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'>'</span><span class="p">));</span> +<a name="line-127"></a><span class="p">}</span> +<a name="line-128"></a> +<a name="line-129"></a><span class="k">static</span> <span class="kr">inline</span> <span class="n">gboolean</span> +<a name="line-130"></a><span class="n">is_release</span> <span class="p">(</span><span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">string</span><span class="p">)</span> +<a name="line-131"></a><span class="p">{</span> +<a name="line-132"></a> <span class="k">return</span> <span class="p">((</span><span class="n">string</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'<'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-133"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'r'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'R'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-134"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'e'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'E'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-135"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'l'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'L'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-136"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'e'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'E'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-137"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'a'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'A'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-138"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'s'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'S'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-139"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">7</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'e'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">7</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'E'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-140"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">8</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'>'</span><span class="p">));</span> +<a name="line-141"></a><span class="p">}</span> +<a name="line-142"></a> +<a name="line-143"></a><span class="k">static</span> <span class="kr">inline</span> <span class="n">gboolean</span> +<a name="line-144"></a><span class="n">is_meta</span> <span class="p">(</span><span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">string</span><span class="p">)</span> +<a name="line-145"></a><span class="p">{</span> +<a name="line-146"></a> <span class="k">return</span> <span class="p">((</span><span class="n">string</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'<'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-147"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'m'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'M'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-148"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'e'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'E'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-149"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'t'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'T'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-150"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'a'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'A'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-151"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'>'</span><span class="p">));</span> +<a name="line-152"></a><span class="p">}</span> +<a name="line-153"></a> +<a name="line-154"></a><span class="k">static</span> <span class="kr">inline</span> <span class="n">gboolean</span> +<a name="line-155"></a><span class="n">is_super</span> <span class="p">(</span><span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">string</span><span class="p">)</span> +<a name="line-156"></a><span class="p">{</span> +<a name="line-157"></a> <span class="k">return</span> <span class="p">((</span><span class="n">string</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'<'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-158"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'s'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'S'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-159"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'u'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'U'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-160"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'p'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'P'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-161"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'e'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'E'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-162"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'r'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'R'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-163"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'>'</span><span class="p">));</span> +<a name="line-164"></a><span class="p">}</span> +<a name="line-165"></a> +<a name="line-166"></a><span class="k">static</span> <span class="kr">inline</span> <span class="n">gboolean</span> +<a name="line-167"></a><span class="n">is_hyper</span> <span class="p">(</span><span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">string</span><span class="p">)</span> +<a name="line-168"></a><span class="p">{</span> +<a name="line-169"></a> <span class="k">return</span> <span class="p">((</span><span class="n">string</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'<'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-170"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'h'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'H'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-171"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'y'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'Y'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-172"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'p'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'P'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-173"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'e'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'E'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-174"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'r'</span> <span class="o">||</span> <span class="n">string</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'R'</span><span class="p">)</span> <span class="o">&&</span> +<a name="line-175"></a> <span class="p">(</span><span class="n">string</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span> <span class="o">==</span> <span class="sc">'>'</span><span class="p">));</span> +<a name="line-176"></a><span class="p">}</span> +<a name="line-177"></a> +<a name="line-178"></a><span class="cm">/**</span> +<a name="line-179"></a><span class="cm"> * egg_accelerator_parse_virtual:</span> +<a name="line-180"></a><span class="cm"> * @accelerator: string representing an accelerator</span> +<a name="line-181"></a><span class="cm"> * @accelerator_key: return location for accelerator keyval</span> +<a name="line-182"></a><span class="cm"> * @accelerator_mods: return location for accelerator modifier mask</span> +<a name="line-183"></a><span class="cm"> *</span> +<a name="line-184"></a><span class="cm"> * Parses a string representing a virtual accelerator. The format</span> +<a name="line-185"></a><span class="cm"> * looks like "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1" or</span> +<a name="line-186"></a><span class="cm"> * "&lt;Release&gt;z" (the last one is for key release). The parser</span> +<a name="line-187"></a><span class="cm"> * is fairly liberal and allows lower or upper case, and also</span> +<a name="line-188"></a><span class="cm"> * abbreviations such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;".</span> +<a name="line-189"></a><span class="cm"> *</span> +<a name="line-190"></a><span class="cm"> * If the parse fails, @accelerator_key and @accelerator_mods will</span> +<a name="line-191"></a><span class="cm"> * be set to 0 (zero) and %FALSE will be returned. If the string contains</span> +<a name="line-192"></a><span class="cm"> * only modifiers, @accelerator_key will be set to 0 but %TRUE will be</span> +<a name="line-193"></a><span class="cm"> * returned.</span> +<a name="line-194"></a><span class="cm"> *</span> +<a name="line-195"></a><span class="cm"> * The virtual vs. concrete accelerator distinction is a relic of</span> +<a name="line-196"></a><span class="cm"> * how the X Window System works; there are modifiers Mod2-Mod5 that</span> +<a name="line-197"></a><span class="cm"> * can represent various keyboard keys (numlock, meta, hyper, etc.),</span> +<a name="line-198"></a><span class="cm"> * the virtual modifier represents the keyboard key, the concrete</span> +<a name="line-199"></a><span class="cm"> * modifier the actual Mod2-Mod5 bits in the key press event.</span> +<a name="line-200"></a><span class="cm"> * </span> +<a name="line-201"></a><span class="cm"> * Returns: %TRUE on success.</span> +<a name="line-202"></a><span class="cm"> */</span> +<a name="line-203"></a><span class="n">gboolean</span> +<a name="line-204"></a><span class="n">egg_accelerator_parse_virtual</span> <span class="p">(</span><span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">accelerator</span><span class="p">,</span> +<a name="line-205"></a> <span class="n">guint</span> <span class="o">*</span><span class="n">accelerator_key</span><span class="p">,</span> +<a name="line-206"></a> <span class="n">EggVirtualModifierType</span> <span class="o">*</span><span class="n">accelerator_mods</span><span class="p">)</span> +<a name="line-207"></a><span class="p">{</span> +<a name="line-208"></a> <span class="n">guint</span> <span class="n">keyval</span><span class="p">;</span> +<a name="line-209"></a> <span class="n">GdkModifierType</span> <span class="n">mods</span><span class="p">;</span> +<a name="line-210"></a> <span class="n">gint</span> <span class="n">len</span><span class="p">;</span> +<a name="line-211"></a> <span class="n">gboolean</span> <span class="n">bad_keyval</span><span class="p">;</span> +<a name="line-212"></a> +<a name="line-213"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_key</span><span class="p">)</span> +<a name="line-214"></a> <span class="o">*</span><span class="n">accelerator_key</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-215"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span><span class="p">)</span> +<a name="line-216"></a> <span class="o">*</span><span class="n">accelerator_mods</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-217"></a> +<a name="line-218"></a> <span class="n">g_return_val_if_fail</span> <span class="p">(</span><span class="n">accelerator</span> <span class="o">!=</span> <span class="nb">NULL</span><span class="p">,</span> <span class="n">FALSE</span><span class="p">);</span> +<a name="line-219"></a> +<a name="line-220"></a> <span class="n">bad_keyval</span> <span class="o">=</span> <span class="n">FALSE</span><span class="p">;</span> +<a name="line-221"></a> +<a name="line-222"></a> <span class="n">keyval</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-223"></a> <span class="n">mods</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-224"></a> <span class="n">len</span> <span class="o">=</span> <span class="n">strlen</span> <span class="p">(</span><span class="n">accelerator</span><span class="p">);</span> +<a name="line-225"></a> <span class="k">while</span> <span class="p">(</span><span class="n">len</span><span class="p">)</span> +<a name="line-226"></a> <span class="p">{</span> +<a name="line-227"></a> <span class="k">if</span> <span class="p">(</span><span class="o">*</span><span class="n">accelerator</span> <span class="o">==</span> <span class="sc">'<'</span><span class="p">)</span> +<a name="line-228"></a> <span class="p">{</span> +<a name="line-229"></a> <span class="k">if</span> <span class="p">(</span><span class="n">len</span> <span class="o">>=</span> <span class="mi">9</span> <span class="o">&&</span> <span class="n">is_release</span> <span class="p">(</span><span class="n">accelerator</span><span class="p">))</span> +<a name="line-230"></a> <span class="p">{</span> +<a name="line-231"></a> <span class="n">accelerator</span> <span class="o">+=</span> <span class="mi">9</span><span class="p">;</span> +<a name="line-232"></a> <span class="n">len</span> <span class="o">-=</span> <span class="mi">9</span><span class="p">;</span> +<a name="line-233"></a> <span class="n">mods</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_RELEASE_MASK</span><span class="p">;</span> +<a name="line-234"></a> <span class="p">}</span> +<a name="line-235"></a> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">len</span> <span class="o">>=</span> <span class="mi">9</span> <span class="o">&&</span> <span class="n">is_control</span> <span class="p">(</span><span class="n">accelerator</span><span class="p">))</span> +<a name="line-236"></a> <span class="p">{</span> +<a name="line-237"></a> <span class="n">accelerator</span> <span class="o">+=</span> <span class="mi">9</span><span class="p">;</span> +<a name="line-238"></a> <span class="n">len</span> <span class="o">-=</span> <span class="mi">9</span><span class="p">;</span> +<a name="line-239"></a> <span class="n">mods</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_CONTROL_MASK</span><span class="p">;</span> +<a name="line-240"></a> <span class="p">}</span> +<a name="line-241"></a> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">len</span> <span class="o">>=</span> <span class="mi">7</span> <span class="o">&&</span> <span class="n">is_shift</span> <span class="p">(</span><span class="n">accelerator</span><span class="p">))</span> +<a name="line-242"></a> <span class="p">{</span> +<a name="line-243"></a> <span class="n">accelerator</span> <span class="o">+=</span> <span class="mi">7</span><span class="p">;</span> +<a name="line-244"></a> <span class="n">len</span> <span class="o">-=</span> <span class="mi">7</span><span class="p">;</span> +<a name="line-245"></a> <span class="n">mods</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_SHIFT_MASK</span><span class="p">;</span> +<a name="line-246"></a> <span class="p">}</span> +<a name="line-247"></a> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">len</span> <span class="o">>=</span> <span class="mi">6</span> <span class="o">&&</span> <span class="n">is_shft</span> <span class="p">(</span><span class="n">accelerator</span><span class="p">))</span> +<a name="line-248"></a> <span class="p">{</span> +<a name="line-249"></a> <span class="n">accelerator</span> <span class="o">+=</span> <span class="mi">6</span><span class="p">;</span> +<a name="line-250"></a> <span class="n">len</span> <span class="o">-=</span> <span class="mi">6</span><span class="p">;</span> +<a name="line-251"></a> <span class="n">mods</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_SHIFT_MASK</span><span class="p">;</span> +<a name="line-252"></a> <span class="p">}</span> +<a name="line-253"></a> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">len</span> <span class="o">>=</span> <span class="mi">6</span> <span class="o">&&</span> <span class="n">is_ctrl</span> <span class="p">(</span><span class="n">accelerator</span><span class="p">))</span> +<a name="line-254"></a> <span class="p">{</span> +<a name="line-255"></a> <span class="n">accelerator</span> <span class="o">+=</span> <span class="mi">6</span><span class="p">;</span> +<a name="line-256"></a> <span class="n">len</span> <span class="o">-=</span> <span class="mi">6</span><span class="p">;</span> +<a name="line-257"></a> <span class="n">mods</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_CONTROL_MASK</span><span class="p">;</span> +<a name="line-258"></a> <span class="p">}</span> +<a name="line-259"></a> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">len</span> <span class="o">>=</span> <span class="mi">6</span> <span class="o">&&</span> <span class="n">is_modx</span> <span class="p">(</span><span class="n">accelerator</span><span class="p">))</span> +<a name="line-260"></a> <span class="p">{</span> +<a name="line-261"></a> <span class="k">static</span> <span class="k">const</span> <span class="n">guint</span> <span class="n">mod_vals</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> +<a name="line-262"></a> <span class="n">EGG_VIRTUAL_ALT_MASK</span><span class="p">,</span> <span class="n">EGG_VIRTUAL_MOD2_MASK</span><span class="p">,</span> <span class="n">EGG_VIRTUAL_MOD3_MASK</span><span class="p">,</span> +<a name="line-263"></a> <span class="n">EGG_VIRTUAL_MOD4_MASK</span><span class="p">,</span> <span class="n">EGG_VIRTUAL_MOD5_MASK</span> +<a name="line-264"></a> <span class="p">};</span> +<a name="line-265"></a> +<a name="line-266"></a> <span class="n">len</span> <span class="o">-=</span> <span class="mi">6</span><span class="p">;</span> +<a name="line-267"></a> <span class="n">accelerator</span> <span class="o">+=</span> <span class="mi">4</span><span class="p">;</span> +<a name="line-268"></a> <span class="n">mods</span> <span class="o">|=</span> <span class="n">mod_vals</span><span class="p">[</span><span class="o">*</span><span class="n">accelerator</span> <span class="o">-</span> <span class="sc">'1'</span><span class="p">];</span> +<a name="line-269"></a> <span class="n">accelerator</span> <span class="o">+=</span> <span class="mi">2</span><span class="p">;</span> +<a name="line-270"></a> <span class="p">}</span> +<a name="line-271"></a> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">len</span> <span class="o">>=</span> <span class="mi">5</span> <span class="o">&&</span> <span class="n">is_ctl</span> <span class="p">(</span><span class="n">accelerator</span><span class="p">))</span> +<a name="line-272"></a> <span class="p">{</span> +<a name="line-273"></a> <span class="n">accelerator</span> <span class="o">+=</span> <span class="mi">5</span><span class="p">;</span> +<a name="line-274"></a> <span class="n">len</span> <span class="o">-=</span> <span class="mi">5</span><span class="p">;</span> +<a name="line-275"></a> <span class="n">mods</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_CONTROL_MASK</span><span class="p">;</span> +<a name="line-276"></a> <span class="p">}</span> +<a name="line-277"></a> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">len</span> <span class="o">>=</span> <span class="mi">5</span> <span class="o">&&</span> <span class="n">is_alt</span> <span class="p">(</span><span class="n">accelerator</span><span class="p">))</span> +<a name="line-278"></a> <span class="p">{</span> +<a name="line-279"></a> <span class="n">accelerator</span> <span class="o">+=</span> <span class="mi">5</span><span class="p">;</span> +<a name="line-280"></a> <span class="n">len</span> <span class="o">-=</span> <span class="mi">5</span><span class="p">;</span> +<a name="line-281"></a> <span class="n">mods</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_ALT_MASK</span><span class="p">;</span> +<a name="line-282"></a> <span class="p">}</span> +<a name="line-283"></a> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">len</span> <span class="o">>=</span> <span class="mi">6</span> <span class="o">&&</span> <span class="n">is_meta</span> <span class="p">(</span><span class="n">accelerator</span><span class="p">))</span> +<a name="line-284"></a> <span class="p">{</span> +<a name="line-285"></a> <span class="n">accelerator</span> <span class="o">+=</span> <span class="mi">6</span><span class="p">;</span> +<a name="line-286"></a> <span class="n">len</span> <span class="o">-=</span> <span class="mi">6</span><span class="p">;</span> +<a name="line-287"></a> <span class="n">mods</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_META_MASK</span><span class="p">;</span> +<a name="line-288"></a> <span class="p">}</span> +<a name="line-289"></a> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">len</span> <span class="o">>=</span> <span class="mi">7</span> <span class="o">&&</span> <span class="n">is_hyper</span> <span class="p">(</span><span class="n">accelerator</span><span class="p">))</span> +<a name="line-290"></a> <span class="p">{</span> +<a name="line-291"></a> <span class="n">accelerator</span> <span class="o">+=</span> <span class="mi">7</span><span class="p">;</span> +<a name="line-292"></a> <span class="n">len</span> <span class="o">-=</span> <span class="mi">7</span><span class="p">;</span> +<a name="line-293"></a> <span class="n">mods</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_HYPER_MASK</span><span class="p">;</span> +<a name="line-294"></a> <span class="p">}</span> +<a name="line-295"></a> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">len</span> <span class="o">>=</span> <span class="mi">7</span> <span class="o">&&</span> <span class="n">is_super</span> <span class="p">(</span><span class="n">accelerator</span><span class="p">))</span> +<a name="line-296"></a> <span class="p">{</span> +<a name="line-297"></a> <span class="n">accelerator</span> <span class="o">+=</span> <span class="mi">7</span><span class="p">;</span> +<a name="line-298"></a> <span class="n">len</span> <span class="o">-=</span> <span class="mi">7</span><span class="p">;</span> +<a name="line-299"></a> <span class="n">mods</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_SUPER_MASK</span><span class="p">;</span> +<a name="line-300"></a> <span class="p">}</span> +<a name="line-301"></a> <span class="k">else</span> +<a name="line-302"></a> <span class="p">{</span> +<a name="line-303"></a> <span class="n">gchar</span> <span class="n">last_ch</span><span class="p">;</span> +<a name="line-304"></a> +<a name="line-305"></a> <span class="n">last_ch</span> <span class="o">=</span> <span class="o">*</span><span class="n">accelerator</span><span class="p">;</span> +<a name="line-306"></a> <span class="k">while</span> <span class="p">(</span><span class="n">last_ch</span> <span class="o">&&</span> <span class="n">last_ch</span> <span class="o">!=</span> <span class="sc">'>'</span><span class="p">)</span> +<a name="line-307"></a> <span class="p">{</span> +<a name="line-308"></a> <span class="n">last_ch</span> <span class="o">=</span> <span class="o">*</span><span class="n">accelerator</span><span class="p">;</span> +<a name="line-309"></a> <span class="n">accelerator</span> <span class="o">+=</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-310"></a> <span class="n">len</span> <span class="o">-=</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-311"></a> <span class="p">}</span> +<a name="line-312"></a> <span class="p">}</span> +<a name="line-313"></a> <span class="p">}</span> +<a name="line-314"></a> <span class="k">else</span> +<a name="line-315"></a> <span class="p">{</span> +<a name="line-316"></a> <span class="n">keyval</span> <span class="o">=</span> <span class="n">gdk_keyval_from_name</span> <span class="p">(</span><span class="n">accelerator</span><span class="p">);</span> +<a name="line-317"></a> +<a name="line-318"></a> <span class="k">if</span> <span class="p">(</span><span class="n">keyval</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> +<a name="line-319"></a> <span class="n">bad_keyval</span> <span class="o">=</span> <span class="n">TRUE</span><span class="p">;</span> +<a name="line-320"></a> +<a name="line-321"></a> <span class="n">accelerator</span> <span class="o">+=</span> <span class="n">len</span><span class="p">;</span> +<a name="line-322"></a><span class="hll"> <span class="n">len</span> <span class="o">-=</span> <span class="n">len</span><span class="p">;</span> <div class="verbose expandable"><span class="error2"><--- Same expression on both sides of '-='. <span class="marker">[+]</span></span><div class="content">Finding the same expression on both sides of an operator is suspicious and might indicate a cut and paste or logic error. Please examine this code carefully to determine if it is correct.</div></div> +</span><a name="line-323"></a> <span class="p">}</span> +<a name="line-324"></a> <span class="p">}</span> +<a name="line-325"></a> +<a name="line-326"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_key</span><span class="p">)</span> +<a name="line-327"></a> <span class="o">*</span><span class="n">accelerator_key</span> <span class="o">=</span> <span class="n">gdk_keyval_to_lower</span> <span class="p">(</span><span class="n">keyval</span><span class="p">);</span> +<a name="line-328"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span><span class="p">)</span> +<a name="line-329"></a> <span class="o">*</span><span class="n">accelerator_mods</span> <span class="o">=</span> <span class="n">mods</span><span class="p">;</span> +<a name="line-330"></a> +<a name="line-331"></a> <span class="k">return</span> <span class="o">!</span><span class="n">bad_keyval</span><span class="p">;</span> +<a name="line-332"></a><span class="p">}</span> +<a name="line-333"></a> +<a name="line-334"></a> +<a name="line-335"></a><span class="cm">/**</span> +<a name="line-336"></a><span class="cm"> * egg_virtual_accelerator_name:</span> +<a name="line-337"></a><span class="cm"> * @accelerator_key: accelerator keyval</span> +<a name="line-338"></a><span class="cm"> * @accelerator_mods: accelerator modifier mask</span> +<a name="line-339"></a><span class="cm"> * @returns: a newly-allocated accelerator name</span> +<a name="line-340"></a><span class="cm"> * </span> +<a name="line-341"></a><span class="cm"> * Converts an accelerator keyval and modifier mask</span> +<a name="line-342"></a><span class="cm"> * into a string parseable by egg_accelerator_parse_virtual().</span> +<a name="line-343"></a><span class="cm"> * For example, if you pass in #GDK_q and #EGG_VIRTUAL_CONTROL_MASK,</span> +<a name="line-344"></a><span class="cm"> * this function returns "&lt;Control&gt;q".</span> +<a name="line-345"></a><span class="cm"> *</span> +<a name="line-346"></a><span class="cm"> * The caller of this function must free the returned string.</span> +<a name="line-347"></a><span class="cm"> */</span> +<a name="line-348"></a><span class="n">gchar</span><span class="o">*</span> +<a name="line-349"></a><span class="n">egg_virtual_accelerator_name</span> <span class="p">(</span><span class="n">guint</span> <span class="n">accelerator_key</span><span class="p">,</span> +<a name="line-350"></a> <span class="n">EggVirtualModifierType</span> <span class="n">accelerator_mods</span><span class="p">)</span> +<a name="line-351"></a><span class="p">{</span> +<a name="line-352"></a> <span class="k">static</span> <span class="k">const</span> <span class="n">gchar</span> <span class="n">text_release</span><span class="p">[]</span> <span class="o">=</span> <span class="s">"<Release>"</span><span class="p">;</span> +<a name="line-353"></a> <span class="k">static</span> <span class="k">const</span> <span class="n">gchar</span> <span class="n">text_shift</span><span class="p">[]</span> <span class="o">=</span> <span class="s">"<Shift>"</span><span class="p">;</span> +<a name="line-354"></a> <span class="k">static</span> <span class="k">const</span> <span class="n">gchar</span> <span class="n">text_control</span><span class="p">[]</span> <span class="o">=</span> <span class="s">"<Control>"</span><span class="p">;</span> +<a name="line-355"></a> <span class="k">static</span> <span class="k">const</span> <span class="n">gchar</span> <span class="n">text_mod1</span><span class="p">[]</span> <span class="o">=</span> <span class="s">"<Alt>"</span><span class="p">;</span> +<a name="line-356"></a> <span class="k">static</span> <span class="k">const</span> <span class="n">gchar</span> <span class="n">text_mod2</span><span class="p">[]</span> <span class="o">=</span> <span class="s">"<Mod2>"</span><span class="p">;</span> +<a name="line-357"></a> <span class="k">static</span> <span class="k">const</span> <span class="n">gchar</span> <span class="n">text_mod3</span><span class="p">[]</span> <span class="o">=</span> <span class="s">"<Mod3>"</span><span class="p">;</span> +<a name="line-358"></a> <span class="k">static</span> <span class="k">const</span> <span class="n">gchar</span> <span class="n">text_mod4</span><span class="p">[]</span> <span class="o">=</span> <span class="s">"<Mod4>"</span><span class="p">;</span> +<a name="line-359"></a> <span class="k">static</span> <span class="k">const</span> <span class="n">gchar</span> <span class="n">text_mod5</span><span class="p">[]</span> <span class="o">=</span> <span class="s">"<Mod5>"</span><span class="p">;</span> +<a name="line-360"></a> <span class="k">static</span> <span class="k">const</span> <span class="n">gchar</span> <span class="n">text_meta</span><span class="p">[]</span> <span class="o">=</span> <span class="s">"<Meta>"</span><span class="p">;</span> +<a name="line-361"></a> <span class="k">static</span> <span class="k">const</span> <span class="n">gchar</span> <span class="n">text_super</span><span class="p">[]</span> <span class="o">=</span> <span class="s">"<Super>"</span><span class="p">;</span> +<a name="line-362"></a> <span class="k">static</span> <span class="k">const</span> <span class="n">gchar</span> <span class="n">text_hyper</span><span class="p">[]</span> <span class="o">=</span> <span class="s">"<Hyper>"</span><span class="p">;</span> +<a name="line-363"></a> <span class="n">guint</span> <span class="n">l</span><span class="p">;</span> +<a name="line-364"></a> <span class="n">gchar</span> <span class="o">*</span><span class="n">keyval_name</span><span class="p">;</span> +<a name="line-365"></a> <span class="n">gchar</span> <span class="o">*</span><span class="n">accelerator</span><span class="p">;</span> +<a name="line-366"></a> +<a name="line-367"></a> <span class="n">accelerator_mods</span> <span class="o">&=</span> <span class="n">EGG_VIRTUAL_MODIFIER_MASK</span><span class="p">;</span> +<a name="line-368"></a> +<a name="line-369"></a> <span class="n">keyval_name</span> <span class="o">=</span> <span class="n">gdk_keyval_name</span> <span class="p">(</span><span class="n">gdk_keyval_to_lower</span> <span class="p">(</span><span class="n">accelerator_key</span><span class="p">));</span> +<a name="line-370"></a> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">keyval_name</span><span class="p">)</span> +<a name="line-371"></a> <span class="n">keyval_name</span> <span class="o">=</span> <span class="s">""</span><span class="p">;</span> +<a name="line-372"></a> +<a name="line-373"></a> <span class="n">l</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-374"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_RELEASE_MASK</span><span class="p">)</span> +<a name="line-375"></a> <span class="n">l</span> <span class="o">+=</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">text_release</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-376"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_SHIFT_MASK</span><span class="p">)</span> +<a name="line-377"></a> <span class="n">l</span> <span class="o">+=</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">text_shift</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-378"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_CONTROL_MASK</span><span class="p">)</span> +<a name="line-379"></a> <span class="n">l</span> <span class="o">+=</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">text_control</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-380"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_ALT_MASK</span><span class="p">)</span> +<a name="line-381"></a> <span class="n">l</span> <span class="o">+=</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">text_mod1</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-382"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_MOD2_MASK</span><span class="p">)</span> +<a name="line-383"></a> <span class="n">l</span> <span class="o">+=</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">text_mod2</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-384"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_MOD3_MASK</span><span class="p">)</span> +<a name="line-385"></a> <span class="n">l</span> <span class="o">+=</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">text_mod3</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-386"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_MOD4_MASK</span><span class="p">)</span> +<a name="line-387"></a> <span class="n">l</span> <span class="o">+=</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">text_mod4</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-388"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_MOD5_MASK</span><span class="p">)</span> +<a name="line-389"></a> <span class="n">l</span> <span class="o">+=</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">text_mod5</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-390"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_META_MASK</span><span class="p">)</span> +<a name="line-391"></a> <span class="n">l</span> <span class="o">+=</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">text_meta</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-392"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_HYPER_MASK</span><span class="p">)</span> +<a name="line-393"></a> <span class="n">l</span> <span class="o">+=</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">text_hyper</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-394"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_SUPER_MASK</span><span class="p">)</span> +<a name="line-395"></a> <span class="n">l</span> <span class="o">+=</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">text_super</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-396"></a> <span class="n">l</span> <span class="o">+=</span> <span class="n">strlen</span> <span class="p">(</span><span class="n">keyval_name</span><span class="p">);</span> +<a name="line-397"></a> +<a name="line-398"></a> <span class="n">accelerator</span> <span class="o">=</span> <span class="n">g_new</span> <span class="p">(</span><span class="n">gchar</span><span class="p">,</span> <span class="n">l</span> <span class="o">+</span> <span class="mi">1</span><span class="p">);</span> +<a name="line-399"></a> +<a name="line-400"></a> <span class="n">l</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-401"></a> <span class="n">accelerator</span><span class="p">[</span><span class="n">l</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-402"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_RELEASE_MASK</span><span class="p">)</span> +<a name="line-403"></a> <span class="p">{</span> +<a name="line-404"></a> <span class="n">strcpy</span> <span class="p">(</span><span class="n">accelerator</span> <span class="o">+</span> <span class="n">l</span><span class="p">,</span> <span class="n">text_release</span><span class="p">);</span> +<a name="line-405"></a> <span class="n">l</span> <span class="o">+=</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">text_release</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-406"></a> <span class="p">}</span> +<a name="line-407"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_SHIFT_MASK</span><span class="p">)</span> +<a name="line-408"></a> <span class="p">{</span> +<a name="line-409"></a> <span class="n">strcpy</span> <span class="p">(</span><span class="n">accelerator</span> <span class="o">+</span> <span class="n">l</span><span class="p">,</span> <span class="n">text_shift</span><span class="p">);</span> +<a name="line-410"></a> <span class="n">l</span> <span class="o">+=</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">text_shift</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-411"></a> <span class="p">}</span> +<a name="line-412"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_CONTROL_MASK</span><span class="p">)</span> +<a name="line-413"></a> <span class="p">{</span> +<a name="line-414"></a> <span class="n">strcpy</span> <span class="p">(</span><span class="n">accelerator</span> <span class="o">+</span> <span class="n">l</span><span class="p">,</span> <span class="n">text_control</span><span class="p">);</span> +<a name="line-415"></a> <span class="n">l</span> <span class="o">+=</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">text_control</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-416"></a> <span class="p">}</span> +<a name="line-417"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_ALT_MASK</span><span class="p">)</span> +<a name="line-418"></a> <span class="p">{</span> +<a name="line-419"></a> <span class="n">strcpy</span> <span class="p">(</span><span class="n">accelerator</span> <span class="o">+</span> <span class="n">l</span><span class="p">,</span> <span class="n">text_mod1</span><span class="p">);</span> +<a name="line-420"></a> <span class="n">l</span> <span class="o">+=</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">text_mod1</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-421"></a> <span class="p">}</span> +<a name="line-422"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_MOD2_MASK</span><span class="p">)</span> +<a name="line-423"></a> <span class="p">{</span> +<a name="line-424"></a> <span class="n">strcpy</span> <span class="p">(</span><span class="n">accelerator</span> <span class="o">+</span> <span class="n">l</span><span class="p">,</span> <span class="n">text_mod2</span><span class="p">);</span> +<a name="line-425"></a> <span class="n">l</span> <span class="o">+=</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">text_mod2</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-426"></a> <span class="p">}</span> +<a name="line-427"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_MOD3_MASK</span><span class="p">)</span> +<a name="line-428"></a> <span class="p">{</span> +<a name="line-429"></a> <span class="n">strcpy</span> <span class="p">(</span><span class="n">accelerator</span> <span class="o">+</span> <span class="n">l</span><span class="p">,</span> <span class="n">text_mod3</span><span class="p">);</span> +<a name="line-430"></a> <span class="n">l</span> <span class="o">+=</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">text_mod3</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-431"></a> <span class="p">}</span> +<a name="line-432"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_MOD4_MASK</span><span class="p">)</span> +<a name="line-433"></a> <span class="p">{</span> +<a name="line-434"></a> <span class="n">strcpy</span> <span class="p">(</span><span class="n">accelerator</span> <span class="o">+</span> <span class="n">l</span><span class="p">,</span> <span class="n">text_mod4</span><span class="p">);</span> +<a name="line-435"></a> <span class="n">l</span> <span class="o">+=</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">text_mod4</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-436"></a> <span class="p">}</span> +<a name="line-437"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_MOD5_MASK</span><span class="p">)</span> +<a name="line-438"></a> <span class="p">{</span> +<a name="line-439"></a> <span class="n">strcpy</span> <span class="p">(</span><span class="n">accelerator</span> <span class="o">+</span> <span class="n">l</span><span class="p">,</span> <span class="n">text_mod5</span><span class="p">);</span> +<a name="line-440"></a> <span class="n">l</span> <span class="o">+=</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">text_mod5</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-441"></a> <span class="p">}</span> +<a name="line-442"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_META_MASK</span><span class="p">)</span> +<a name="line-443"></a> <span class="p">{</span> +<a name="line-444"></a> <span class="n">strcpy</span> <span class="p">(</span><span class="n">accelerator</span> <span class="o">+</span> <span class="n">l</span><span class="p">,</span> <span class="n">text_meta</span><span class="p">);</span> +<a name="line-445"></a> <span class="n">l</span> <span class="o">+=</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">text_meta</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-446"></a> <span class="p">}</span> +<a name="line-447"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_HYPER_MASK</span><span class="p">)</span> +<a name="line-448"></a> <span class="p">{</span> +<a name="line-449"></a> <span class="n">strcpy</span> <span class="p">(</span><span class="n">accelerator</span> <span class="o">+</span> <span class="n">l</span><span class="p">,</span> <span class="n">text_hyper</span><span class="p">);</span> +<a name="line-450"></a> <span class="n">l</span> <span class="o">+=</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">text_hyper</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-451"></a> <span class="p">}</span> +<a name="line-452"></a> <span class="k">if</span> <span class="p">(</span><span class="n">accelerator_mods</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_SUPER_MASK</span><span class="p">)</span> +<a name="line-453"></a> <span class="p">{</span> +<a name="line-454"></a> <span class="n">strcpy</span> <span class="p">(</span><span class="n">accelerator</span> <span class="o">+</span> <span class="n">l</span><span class="p">,</span> <span class="n">text_super</span><span class="p">);</span> +<a name="line-455"></a> <span class="n">l</span> <span class="o">+=</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">text_super</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-456"></a> <span class="p">}</span> +<a name="line-457"></a> +<a name="line-458"></a> <span class="n">strcpy</span> <span class="p">(</span><span class="n">accelerator</span> <span class="o">+</span> <span class="n">l</span><span class="p">,</span> <span class="n">keyval_name</span><span class="p">);</span> +<a name="line-459"></a> +<a name="line-460"></a> <span class="k">return</span> <span class="n">accelerator</span><span class="p">;</span> +<a name="line-461"></a><span class="p">}</span> +<a name="line-462"></a> +<a name="line-463"></a><span class="kt">void</span> +<a name="line-464"></a><span class="n">egg_keymap_resolve_virtual_modifiers</span> <span class="p">(</span><span class="n">GdkKeymap</span> <span class="o">*</span><span class="n">keymap</span><span class="p">,</span> +<a name="line-465"></a> <span class="n">EggVirtualModifierType</span> <span class="n">virtual_mods</span><span class="p">,</span> +<a name="line-466"></a> <span class="n">GdkModifierType</span> <span class="o">*</span><span class="n">concrete_mods</span><span class="p">)</span> +<a name="line-467"></a><span class="p">{</span> +<a name="line-468"></a> <span class="n">GdkModifierType</span> <span class="n">concrete</span><span class="p">;</span> +<a name="line-469"></a> <span class="kt">int</span> <span class="n">i</span><span class="p">;</span> +<a name="line-470"></a> <span class="k">const</span> <span class="n">EggModmap</span> <span class="o">*</span><span class="n">modmap</span><span class="p">;</span> +<a name="line-471"></a> +<a name="line-472"></a> <span class="n">g_return_if_fail</span> <span class="p">(</span><span class="n">GDK_IS_KEYMAP</span> <span class="p">(</span><span class="n">keymap</span><span class="p">));</span> +<a name="line-473"></a> <span class="n">g_return_if_fail</span> <span class="p">(</span><span class="n">concrete_mods</span> <span class="o">!=</span> <span class="nb">NULL</span><span class="p">);</span> +<a name="line-474"></a> +<a name="line-475"></a> <span class="n">modmap</span> <span class="o">=</span> <span class="n">egg_keymap_get_modmap</span> <span class="p">(</span><span class="n">keymap</span><span class="p">);</span> +<a name="line-476"></a> +<a name="line-477"></a> <span class="cm">/* Not so sure about this algorithm. */</span> +<a name="line-478"></a> +<a name="line-479"></a> <span class="n">concrete</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-480"></a> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-481"></a> <span class="k">while</span> <span class="p">(</span><span class="n">i</span> <span class="o"><</span> <span class="n">EGG_MODMAP_ENTRY_LAST</span><span class="p">)</span> +<a name="line-482"></a> <span class="p">{</span> +<a name="line-483"></a> <span class="k">if</span> <span class="p">(</span><span class="n">modmap</span><span class="o">-></span><span class="n">mapping</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">&</span> <span class="n">virtual_mods</span><span class="p">)</span> +<a name="line-484"></a> <span class="n">concrete</span> <span class="o">|=</span> <span class="p">(</span><span class="mi">1</span> <span class="o"><<</span> <span class="n">i</span><span class="p">);</span> +<a name="line-485"></a> +<a name="line-486"></a> <span class="o">++</span><span class="n">i</span><span class="p">;</span> +<a name="line-487"></a> <span class="p">}</span> +<a name="line-488"></a> +<a name="line-489"></a> <span class="o">*</span><span class="n">concrete_mods</span> <span class="o">=</span> <span class="n">concrete</span><span class="p">;</span> +<a name="line-490"></a><span class="p">}</span> +<a name="line-491"></a> +<a name="line-492"></a><span class="kt">void</span> +<a name="line-493"></a><span class="n">egg_keymap_virtualize_modifiers</span> <span class="p">(</span><span class="n">GdkKeymap</span> <span class="o">*</span><span class="n">keymap</span><span class="p">,</span> +<a name="line-494"></a> <span class="n">GdkModifierType</span> <span class="n">concrete_mods</span><span class="p">,</span> +<a name="line-495"></a> <span class="n">EggVirtualModifierType</span> <span class="o">*</span><span class="n">virtual_mods</span><span class="p">)</span> +<a name="line-496"></a><span class="p">{</span> +<a name="line-497"></a> <span class="n">GdkModifierType</span> <span class="n">virtual</span><span class="p">;</span> +<a name="line-498"></a> <span class="kt">int</span> <span class="n">i</span><span class="p">;</span> +<a name="line-499"></a> <span class="k">const</span> <span class="n">EggModmap</span> <span class="o">*</span><span class="n">modmap</span><span class="p">;</span> +<a name="line-500"></a> +<a name="line-501"></a> <span class="n">g_return_if_fail</span> <span class="p">(</span><span class="n">GDK_IS_KEYMAP</span> <span class="p">(</span><span class="n">keymap</span><span class="p">));</span> +<a name="line-502"></a> <span class="n">g_return_if_fail</span> <span class="p">(</span><span class="n">virtual_mods</span> <span class="o">!=</span> <span class="nb">NULL</span><span class="p">);</span> +<a name="line-503"></a> +<a name="line-504"></a> <span class="n">modmap</span> <span class="o">=</span> <span class="n">egg_keymap_get_modmap</span> <span class="p">(</span><span class="n">keymap</span><span class="p">);</span> +<a name="line-505"></a> +<a name="line-506"></a> <span class="cm">/* Not so sure about this algorithm. */</span> +<a name="line-507"></a> +<a name="line-508"></a> <span class="n">virtual</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-509"></a> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-510"></a> <span class="k">while</span> <span class="p">(</span><span class="n">i</span> <span class="o"><</span> <span class="n">EGG_MODMAP_ENTRY_LAST</span><span class="p">)</span> +<a name="line-511"></a> <span class="p">{</span> +<a name="line-512"></a> <span class="k">if</span> <span class="p">((</span><span class="mi">1</span> <span class="o"><<</span> <span class="n">i</span><span class="p">)</span> <span class="o">&</span> <span class="n">concrete_mods</span><span class="p">)</span> +<a name="line-513"></a> <span class="p">{</span> +<a name="line-514"></a> <span class="n">EggVirtualModifierType</span> <span class="n">cleaned</span><span class="p">;</span> +<a name="line-515"></a> +<a name="line-516"></a> <span class="n">cleaned</span> <span class="o">=</span> <span class="n">modmap</span><span class="o">-></span><span class="n">mapping</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">&</span> <span class="o">~</span><span class="p">(</span><span class="n">EGG_VIRTUAL_MOD2_MASK</span> <span class="o">|</span> +<a name="line-517"></a> <span class="n">EGG_VIRTUAL_MOD3_MASK</span> <span class="o">|</span> +<a name="line-518"></a> <span class="n">EGG_VIRTUAL_MOD4_MASK</span> <span class="o">|</span> +<a name="line-519"></a> <span class="n">EGG_VIRTUAL_MOD5_MASK</span><span class="p">);</span> +<a name="line-520"></a> +<a name="line-521"></a> <span class="k">if</span> <span class="p">(</span><span class="n">cleaned</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">)</span> +<a name="line-522"></a> <span class="p">{</span> +<a name="line-523"></a> <span class="n">virtual</span> <span class="o">|=</span> <span class="n">cleaned</span><span class="p">;</span> +<a name="line-524"></a> <span class="p">}</span> +<a name="line-525"></a> <span class="k">else</span> +<a name="line-526"></a> <span class="p">{</span> +<a name="line-527"></a> <span class="cm">/* Rather than dropping mod2->mod5 if not bound,</span> +<a name="line-528"></a><span class="cm"> * go ahead and use the concrete names</span> +<a name="line-529"></a><span class="cm"> */</span> +<a name="line-530"></a> <span class="n">virtual</span> <span class="o">|=</span> <span class="n">modmap</span><span class="o">-></span><span class="n">mapping</span><span class="p">[</span><span class="n">i</span><span class="p">];</span> +<a name="line-531"></a> <span class="p">}</span> +<a name="line-532"></a> <span class="p">}</span> +<a name="line-533"></a> +<a name="line-534"></a> <span class="o">++</span><span class="n">i</span><span class="p">;</span> +<a name="line-535"></a> <span class="p">}</span> +<a name="line-536"></a> +<a name="line-537"></a> <span class="o">*</span><span class="n">virtual_mods</span> <span class="o">=</span> <span class="n">virtual</span><span class="p">;</span> +<a name="line-538"></a><span class="p">}</span> +<a name="line-539"></a> +<a name="line-540"></a><span class="k">static</span> <span class="kt">void</span> +<a name="line-541"></a><span class="n">reload_modmap</span> <span class="p">(</span><span class="n">GdkKeymap</span> <span class="o">*</span><span class="n">keymap</span><span class="p">,</span> +<a name="line-542"></a> <span class="n">EggModmap</span> <span class="o">*</span><span class="n">modmap</span><span class="p">)</span> +<a name="line-543"></a><span class="p">{</span> +<a name="line-544"></a> <span class="n">XModifierKeymap</span> <span class="o">*</span><span class="n">xmodmap</span><span class="p">;</span> +<a name="line-545"></a> <span class="kt">int</span> <span class="n">map_size</span><span class="p">;</span> +<a name="line-546"></a> <span class="kt">int</span> <span class="n">i</span><span class="p">;</span> +<a name="line-547"></a> +<a name="line-548"></a> <span class="cm">/* FIXME multihead */</span> +<a name="line-549"></a> <span class="n">xmodmap</span> <span class="o">=</span> <span class="n">XGetModifierMapping</span> <span class="p">(</span><span class="n">gdk_x11_get_default_xdisplay</span> <span class="p">());</span> +<a name="line-550"></a> +<a name="line-551"></a> <span class="n">memset</span> <span class="p">(</span><span class="n">modmap</span><span class="o">-></span><span class="n">mapping</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">modmap</span><span class="o">-></span><span class="n">mapping</span><span class="p">));</span> +<a name="line-552"></a> +<a name="line-553"></a> <span class="cm">/* there are 8 modifiers, and the first 3 are shift, shift lock,</span> +<a name="line-554"></a><span class="cm"> * and control</span> +<a name="line-555"></a><span class="cm"> */</span> +<a name="line-556"></a> <span class="n">map_size</span> <span class="o">=</span> <span class="mi">8</span> <span class="o">*</span> <span class="n">xmodmap</span><span class="o">-></span><span class="n">max_keypermod</span><span class="p">;</span> +<a name="line-557"></a> <span class="n">i</span> <span class="o">=</span> <span class="mi">3</span> <span class="o">*</span> <span class="n">xmodmap</span><span class="o">-></span><span class="n">max_keypermod</span><span class="p">;</span> +<a name="line-558"></a> <span class="k">while</span> <span class="p">(</span><span class="n">i</span> <span class="o"><</span> <span class="n">map_size</span><span class="p">)</span> +<a name="line-559"></a> <span class="p">{</span> +<a name="line-560"></a> <span class="cm">/* get the key code at this point in the map,</span> +<a name="line-561"></a><span class="cm"> * see if its keysym is one we're interested in</span> +<a name="line-562"></a><span class="cm"> */</span> +<a name="line-563"></a> <span class="kt">int</span> <span class="n">keycode</span> <span class="o">=</span> <span class="n">xmodmap</span><span class="o">-></span><span class="n">modifiermap</span><span class="p">[</span><span class="n">i</span><span class="p">];</span> +<a name="line-564"></a> <span class="n">GdkKeymapKey</span> <span class="o">*</span><span class="n">keys</span><span class="p">;</span> +<a name="line-565"></a> <span class="n">guint</span> <span class="o">*</span><span class="n">keyvals</span><span class="p">;</span> +<a name="line-566"></a> <span class="kt">int</span> <span class="n">n_entries</span><span class="p">;</span> +<a name="line-567"></a> <span class="kt">int</span> <span class="n">j</span><span class="p">;</span> +<a name="line-568"></a> <span class="n">EggVirtualModifierType</span> <span class="n">mask</span><span class="p">;</span> +<a name="line-569"></a> +<a name="line-570"></a> <span class="n">keys</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span> +<a name="line-571"></a> <span class="n">keyvals</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span> +<a name="line-572"></a> <span class="n">n_entries</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-573"></a> +<a name="line-574"></a> <span class="n">gdk_keymap_get_entries_for_keycode</span> <span class="p">(</span><span class="n">keymap</span><span class="p">,</span> +<a name="line-575"></a> <span class="n">keycode</span><span class="p">,</span> +<a name="line-576"></a> <span class="o">&</span><span class="n">keys</span><span class="p">,</span> <span class="o">&</span><span class="n">keyvals</span><span class="p">,</span> <span class="o">&</span><span class="n">n_entries</span><span class="p">);</span> +<a name="line-577"></a> +<a name="line-578"></a> <span class="n">mask</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-579"></a> <span class="n">j</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-580"></a> <span class="k">while</span> <span class="p">(</span><span class="n">j</span> <span class="o"><</span> <span class="n">n_entries</span><span class="p">)</span> +<a name="line-581"></a> <span class="p">{</span> +<a name="line-582"></a> <span class="k">if</span> <span class="p">(</span><span class="n">keyvals</span><span class="p">[</span><span class="n">j</span><span class="p">]</span> <span class="o">==</span> <span class="n">GDK_KEY_Num_Lock</span><span class="p">)</span> +<a name="line-583"></a> <span class="n">mask</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_NUM_LOCK_MASK</span><span class="p">;</span> +<a name="line-584"></a> <span class="k">else</span> <span class="nf">if</span> <span class="p">(</span><span class="n">keyvals</span><span class="p">[</span><span class="n">j</span><span class="p">]</span> <span class="o">==</span> <span class="n">GDK_KEY_Scroll_Lock</span><span class="p">)</span> +<a name="line-585"></a> <span class="n">mask</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_SCROLL_LOCK_MASK</span><span class="p">;</span> +<a name="line-586"></a> <span class="k">else</span> <span class="nf">if</span> <span class="p">(</span><span class="n">keyvals</span><span class="p">[</span><span class="n">j</span><span class="p">]</span> <span class="o">==</span> <span class="n">GDK_KEY_Meta_L</span> <span class="o">||</span> +<a name="line-587"></a> <span class="n">keyvals</span><span class="p">[</span><span class="n">j</span><span class="p">]</span> <span class="o">==</span> <span class="n">GDK_KEY_Meta_R</span><span class="p">)</span> +<a name="line-588"></a> <span class="n">mask</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_META_MASK</span><span class="p">;</span> +<a name="line-589"></a> <span class="k">else</span> <span class="nf">if</span> <span class="p">(</span><span class="n">keyvals</span><span class="p">[</span><span class="n">j</span><span class="p">]</span> <span class="o">==</span> <span class="n">GDK_KEY_Hyper_L</span> <span class="o">||</span> +<a name="line-590"></a> <span class="n">keyvals</span><span class="p">[</span><span class="n">j</span><span class="p">]</span> <span class="o">==</span> <span class="n">GDK_KEY_Hyper_R</span><span class="p">)</span> +<a name="line-591"></a> <span class="n">mask</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_HYPER_MASK</span><span class="p">;</span> +<a name="line-592"></a> <span class="k">else</span> <span class="nf">if</span> <span class="p">(</span><span class="n">keyvals</span><span class="p">[</span><span class="n">j</span><span class="p">]</span> <span class="o">==</span> <span class="n">GDK_KEY_Super_L</span> <span class="o">||</span> +<a name="line-593"></a> <span class="n">keyvals</span><span class="p">[</span><span class="n">j</span><span class="p">]</span> <span class="o">==</span> <span class="n">GDK_KEY_Super_R</span><span class="p">)</span> +<a name="line-594"></a> <span class="n">mask</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_SUPER_MASK</span><span class="p">;</span> +<a name="line-595"></a> <span class="k">else</span> <span class="nf">if</span> <span class="p">(</span><span class="n">keyvals</span><span class="p">[</span><span class="n">j</span><span class="p">]</span> <span class="o">==</span> <span class="n">GDK_KEY_Mode_switch</span><span class="p">)</span> +<a name="line-596"></a> <span class="n">mask</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_MODE_SWITCH_MASK</span><span class="p">;</span> +<a name="line-597"></a> +<a name="line-598"></a> <span class="o">++</span><span class="n">j</span><span class="p">;</span> +<a name="line-599"></a> <span class="p">}</span> +<a name="line-600"></a> +<a name="line-601"></a> <span class="cm">/* Mod1Mask is 1 << 3 for example, i.e. the</span> +<a name="line-602"></a><span class="cm"> * fourth modifier, i / keyspermod is the modifier</span> +<a name="line-603"></a><span class="cm"> * index</span> +<a name="line-604"></a><span class="cm"> */</span> +<a name="line-605"></a> <span class="n">modmap</span><span class="o">-></span><span class="n">mapping</span><span class="p">[</span><span class="n">i</span><span class="o">/</span><span class="n">xmodmap</span><span class="o">-></span><span class="n">max_keypermod</span><span class="p">]</span> <span class="o">|=</span> <span class="n">mask</span><span class="p">;</span> +<a name="line-606"></a> +<a name="line-607"></a> <span class="n">g_free</span> <span class="p">(</span><span class="n">keyvals</span><span class="p">);</span> +<a name="line-608"></a> <span class="n">g_free</span> <span class="p">(</span><span class="n">keys</span><span class="p">);</span> +<a name="line-609"></a> +<a name="line-610"></a> <span class="o">++</span><span class="n">i</span><span class="p">;</span> +<a name="line-611"></a> <span class="p">}</span> +<a name="line-612"></a> +<a name="line-613"></a> <span class="cm">/* Add in the not-really-virtual fixed entries */</span> +<a name="line-614"></a> <span class="n">modmap</span><span class="o">-></span><span class="n">mapping</span><span class="p">[</span><span class="n">EGG_MODMAP_ENTRY_SHIFT</span><span class="p">]</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_SHIFT_MASK</span><span class="p">;</span> +<a name="line-615"></a> <span class="n">modmap</span><span class="o">-></span><span class="n">mapping</span><span class="p">[</span><span class="n">EGG_MODMAP_ENTRY_CONTROL</span><span class="p">]</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_CONTROL_MASK</span><span class="p">;</span> +<a name="line-616"></a> <span class="n">modmap</span><span class="o">-></span><span class="n">mapping</span><span class="p">[</span><span class="n">EGG_MODMAP_ENTRY_LOCK</span><span class="p">]</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_LOCK_MASK</span><span class="p">;</span> +<a name="line-617"></a> <span class="n">modmap</span><span class="o">-></span><span class="n">mapping</span><span class="p">[</span><span class="n">EGG_MODMAP_ENTRY_MOD1</span><span class="p">]</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_ALT_MASK</span><span class="p">;</span> +<a name="line-618"></a> <span class="n">modmap</span><span class="o">-></span><span class="n">mapping</span><span class="p">[</span><span class="n">EGG_MODMAP_ENTRY_MOD2</span><span class="p">]</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_MOD2_MASK</span><span class="p">;</span> +<a name="line-619"></a> <span class="n">modmap</span><span class="o">-></span><span class="n">mapping</span><span class="p">[</span><span class="n">EGG_MODMAP_ENTRY_MOD3</span><span class="p">]</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_MOD3_MASK</span><span class="p">;</span> +<a name="line-620"></a> <span class="n">modmap</span><span class="o">-></span><span class="n">mapping</span><span class="p">[</span><span class="n">EGG_MODMAP_ENTRY_MOD4</span><span class="p">]</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_MOD4_MASK</span><span class="p">;</span> +<a name="line-621"></a> <span class="n">modmap</span><span class="o">-></span><span class="n">mapping</span><span class="p">[</span><span class="n">EGG_MODMAP_ENTRY_MOD5</span><span class="p">]</span> <span class="o">|=</span> <span class="n">EGG_VIRTUAL_MOD5_MASK</span><span class="p">;</span> +<a name="line-622"></a> +<a name="line-623"></a> <span class="n">XFreeModifiermap</span> <span class="p">(</span><span class="n">xmodmap</span><span class="p">);</span> +<a name="line-624"></a><span class="p">}</span> +<a name="line-625"></a> +<a name="line-626"></a><span class="k">const</span> <span class="n">EggModmap</span><span class="o">*</span> +<a name="line-627"></a><span class="n">egg_keymap_get_modmap</span> <span class="p">(</span><span class="n">GdkKeymap</span> <span class="o">*</span><span class="n">keymap</span><span class="p">)</span> +<a name="line-628"></a><span class="p">{</span> +<a name="line-629"></a> <span class="n">EggModmap</span> <span class="o">*</span><span class="n">modmap</span><span class="p">;</span> +<a name="line-630"></a> +<a name="line-631"></a> <span class="cm">/* This is all a hack, much simpler when we can just</span> +<a name="line-632"></a><span class="cm"> * modify GDK directly.</span> +<a name="line-633"></a><span class="cm"> */</span> +<a name="line-634"></a> +<a name="line-635"></a> <span class="n">modmap</span> <span class="o">=</span> <span class="n">g_object_get_data</span> <span class="p">(</span><span class="n">G_OBJECT</span> <span class="p">(</span><span class="n">keymap</span><span class="p">),</span> +<a name="line-636"></a> <span class="s">"egg-modmap"</span><span class="p">);</span> +<a name="line-637"></a> +<a name="line-638"></a> <span class="k">if</span> <span class="p">(</span><span class="n">modmap</span> <span class="o">==</span> <span class="nb">NULL</span><span class="p">)</span> +<a name="line-639"></a> <span class="p">{</span> +<a name="line-640"></a> <span class="n">modmap</span> <span class="o">=</span> <span class="n">g_new0</span> <span class="p">(</span><span class="n">EggModmap</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span> +<a name="line-641"></a> +<a name="line-642"></a> <span class="cm">/* FIXME modify keymap change events with an event filter</span> +<a name="line-643"></a><span class="cm"> * and force a reload if we get one</span> +<a name="line-644"></a><span class="cm"> */</span> +<a name="line-645"></a> +<a name="line-646"></a> <span class="n">reload_modmap</span> <span class="p">(</span><span class="n">keymap</span><span class="p">,</span> <span class="n">modmap</span><span class="p">);</span> +<a name="line-647"></a> +<a name="line-648"></a> <span class="n">g_object_set_data_full</span> <span class="p">(</span><span class="n">G_OBJECT</span> <span class="p">(</span><span class="n">keymap</span><span class="p">),</span> +<a name="line-649"></a> <span class="s">"egg-modmap"</span><span class="p">,</span> +<a name="line-650"></a> <span class="n">modmap</span><span class="p">,</span> +<a name="line-651"></a> <span class="n">g_free</span><span class="p">);</span> +<a name="line-652"></a> <span class="p">}</span> +<a name="line-653"></a> +<a name="line-654"></a> <span class="n">g_assert</span> <span class="p">(</span><span class="n">modmap</span> <span class="o">!=</span> <span class="nb">NULL</span><span class="p">);</span> +<a name="line-655"></a> +<a name="line-656"></a> <span class="k">return</span> <span class="n">modmap</span><span class="p">;</span> +<a name="line-657"></a><span class="p">}</span> +</pre></div> +</td></tr></table> + </div> <!-- /.wrapper --> + </div> + <div id="footer" class="footer"> + <p> + Cppcheck 2.3 - a tool for static C/C++ code analysis<br> + <br> + Internet: <a href="http://cppcheck.net">http://cppcheck.net</a><br> + IRC: <a href="irc://irc.freenode.net/cppcheck">irc://irc.freenode.net/cppcheck</a><br> + </p> + </div> + </body> +</html> diff --git a/2021-06-21-213330-4389-cppcheck@e2f7cfd5fc80_master/1.html b/2021-06-21-213330-4389-cppcheck@e2f7cfd5fc80_master/1.html new file mode 100644 index 0000000..854a5f6 --- /dev/null +++ b/2021-06-21-213330-4389-cppcheck@e2f7cfd5fc80_master/1.html @@ -0,0 +1,379 @@ + +<!doctype html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>Cppcheck - HTML report - mate-netbook</title> + <link rel="stylesheet" href="style.css"> + <style> +pre { line-height: 125%; } +td.linenos pre { color: #000000; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; } +span.linenos { color: #000000; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; } +td.linenos pre.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +.highlight .hll { background-color: #ffffcc } +.highlight { background: #ffffff; } +.highlight .c { color: #888888 } /* Comment */ +.highlight .err { color: #FF0000; background-color: #FFAAAA } /* Error */ +.highlight .k { color: #008800; font-weight: bold } /* Keyword */ +.highlight .o { color: #333333 } /* Operator */ +.highlight .ch { color: #888888 } /* Comment.Hashbang */ +.highlight .cm { color: #888888 } /* Comment.Multiline */ +.highlight .cp { color: #557799 } /* Comment.Preproc */ +.highlight .cpf { color: #888888 } /* Comment.PreprocFile */ +.highlight .c1 { color: #888888 } /* Comment.Single */ +.highlight .cs { color: #cc0000; font-weight: bold } /* Comment.Special */ +.highlight .gd { color: #A00000 } /* Generic.Deleted */ +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .gr { color: #FF0000 } /* Generic.Error */ +.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.highlight .gi { color: #00A000 } /* Generic.Inserted */ +.highlight .go { color: #888888 } /* Generic.Output */ +.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.highlight .gt { color: #0044DD } /* Generic.Traceback */ +.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ +.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { color: #003388; font-weight: bold } /* Keyword.Pseudo */ +.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #333399; font-weight: bold } /* Keyword.Type */ +.highlight .m { color: #6600EE; font-weight: bold } /* Literal.Number */ +.highlight .s { background-color: #fff0f0 } /* Literal.String */ +.highlight .na { color: #0000CC } /* Name.Attribute */ +.highlight .nb { color: #007020 } /* Name.Builtin */ +.highlight .nc { color: #BB0066; font-weight: bold } /* Name.Class */ +.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ +.highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ +.highlight .ni { color: #880000; font-weight: bold } /* Name.Entity */ +.highlight .ne { color: #FF0000; font-weight: bold } /* Name.Exception */ +.highlight .nf { color: #0066BB; font-weight: bold } /* Name.Function */ +.highlight .nl { color: #997700; font-weight: bold } /* Name.Label */ +.highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ +.highlight .nt { color: #007700 } /* Name.Tag */ +.highlight .nv { color: #996633 } /* Name.Variable */ +.highlight .ow { color: #000000; font-weight: bold } /* Operator.Word */ +.highlight .w { color: #bbbbbb } /* Text.Whitespace */ +.highlight .mb { color: #6600EE; font-weight: bold } /* Literal.Number.Bin */ +.highlight .mf { color: #6600EE; font-weight: bold } /* Literal.Number.Float */ +.highlight .mh { color: #005588; font-weight: bold } /* Literal.Number.Hex */ +.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ +.highlight .mo { color: #4400EE; font-weight: bold } /* Literal.Number.Oct */ +.highlight .sa { background-color: #fff0f0 } /* Literal.String.Affix */ +.highlight .sb { background-color: #fff0f0 } /* Literal.String.Backtick */ +.highlight .sc { color: #0044DD } /* Literal.String.Char */ +.highlight .dl { background-color: #fff0f0 } /* Literal.String.Delimiter */ +.highlight .sd { color: #DD4422 } /* Literal.String.Doc */ +.highlight .s2 { background-color: #fff0f0 } /* Literal.String.Double */ +.highlight .se { color: #666666; font-weight: bold; background-color: #fff0f0 } /* Literal.String.Escape */ +.highlight .sh { background-color: #fff0f0 } /* Literal.String.Heredoc */ +.highlight .si { background-color: #eeeeee } /* Literal.String.Interpol */ +.highlight .sx { color: #DD2200; background-color: #fff0f0 } /* Literal.String.Other */ +.highlight .sr { color: #000000; background-color: #fff0ff } /* Literal.String.Regex */ +.highlight .s1 { background-color: #fff0f0 } /* Literal.String.Single */ +.highlight .ss { color: #AA6600 } /* Literal.String.Symbol */ +.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ +.highlight .fm { color: #0066BB; font-weight: bold } /* Name.Function.Magic */ +.highlight .vc { color: #336699 } /* Name.Variable.Class */ +.highlight .vg { color: #dd7700; font-weight: bold } /* Name.Variable.Global */ +.highlight .vi { color: #3333BB } /* Name.Variable.Instance */ +.highlight .vm { color: #996633 } /* Name.Variable.Magic */ +.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ + </style> + <script> + function getStyle(el, styleProp) { + var y; + + if (el.currentStyle) { + y = el.currentStyle[styleProp]; + } else if (window.getComputedStyle) { + y = document.defaultView.getComputedStyle(el, null).getPropertyValue(styleProp); + } + + return y; + } + + function toggle() { + var el = this.expandable_content; + var mark = this.expandable_marker; + + if (el.style.display === "block") { + el.style.display = "none"; + mark.textContent = "[+]"; + } else { + el.style.display = "block"; + mark.textContent = "[-]"; + } + } + + function initExpandables() { + var elements = document.querySelectorAll(".expandable"); + + for (var i = 0, len = elements.length; i < len; i++) { + var el = elements[i]; + var clickable = el.querySelector("span"); + var marker = clickable.querySelector(".marker"); + var content = el.querySelector(".content"); + var width = clickable.clientWidth - parseInt(getStyle(content, "padding-left")) - parseInt(getStyle(content, "padding-right")); + content.style.width = width + "px"; + clickable.expandable_content = content; + clickable.expandable_marker = marker; + clickable.addEventListener("click", toggle); + } + } + + function toggleDisplay(id) { + var elements = document.querySelectorAll("." + id); + + for (var i = 0, len = elements.length; i < len; i++) { + elements[i].classList.toggle("d-none"); + } + } + + function toggleAll() { + var elements = document.querySelectorAll("input"); + + // starting from 1 since 0 is the "toggle all" input + for (var i = 1, len = elements.length; i < len; i++) { + var el = elements[i]; + + if (el.checked) { + el.checked = false; + } else { + el.checked = true; + } + + toggleDisplay(el.id); + } + } + window.addEventListener("load", initExpandables); + </script> + </head> + <body> + <div id="header" class="header"> + <h1>Cppcheck report - mate-netbook: maximus/main.c</h1> + </div> + <div class="wrapper"> + <div id="menu"> + <p id="filename"><a href="index.html">Defects:</a> main.c</p> +<a href="1.html#line-96"> unreadVariable 96</a> + </div> + <div id="content"> +<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 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</pre></div></td><td class="code"><div class="highlight"><pre><span></span><a name="line-1"></a><span class="cm">/*</span> +<a name="line-2"></a><span class="cm"> * Copyright (C) 2008 Canonical Ltd</span> +<a name="line-3"></a><span class="cm"> * Copyright (C) 2012-2021 MATE Developers</span> +<a name="line-4"></a><span class="cm"> *</span> +<a name="line-5"></a><span class="cm"> * This program is free software: you can redistribute it and/or modify</span> +<a name="line-6"></a><span class="cm"> * it under the terms of the GNU General Public License version 3 as</span> +<a name="line-7"></a><span class="cm"> * published by the Free Software Foundation.</span> +<a name="line-8"></a><span class="cm"> *</span> +<a name="line-9"></a><span class="cm"> * This program is distributed in the hope that it will be useful,</span> +<a name="line-10"></a><span class="cm"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span> +<a name="line-11"></a><span class="cm"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span> +<a name="line-12"></a><span class="cm"> * GNU General Public License for more details.</span> +<a name="line-13"></a><span class="cm"> *</span> +<a name="line-14"></a><span class="cm"> * You should have received a copy of the GNU General Public License</span> +<a name="line-15"></a><span class="cm"> * along with this program. If not, see <http://www.gnu.org/licenses/>.</span> +<a name="line-16"></a><span class="cm"> *</span> +<a name="line-17"></a><span class="cm"> * Authored by Neil Jagdish Patel <[email protected]></span> +<a name="line-18"></a><span class="cm"> *</span> +<a name="line-19"></a><span class="cm"> */</span> +<a name="line-20"></a> +<a name="line-21"></a><span class="cp">#include</span> <span class="cpf"><glib.h></span><span class="cp"></span> +<a name="line-22"></a> +<a name="line-23"></a><span class="cp">#include</span> <span class="cpf"><stdio.h></span><span class="cp"></span> +<a name="line-24"></a><span class="cp">#include</span> <span class="cpf"><string.h></span><span class="cp"></span> +<a name="line-25"></a><span class="cp">#include</span> <span class="cpf"><stdlib.h></span><span class="cp"></span> +<a name="line-26"></a> +<a name="line-27"></a><span class="cp">#include</span> <span class="cpf"><gtk/gtk.h></span><span class="cp"></span> +<a name="line-28"></a><span class="cp">#include</span> <span class="cpf"><gdk/gdkx.h></span><span class="cp"></span> +<a name="line-29"></a> +<a name="line-30"></a><span class="cp">#include</span> <span class="cpf"><gio/gio.h></span><span class="cp"></span> +<a name="line-31"></a> +<a name="line-32"></a><span class="cp">#include</span> <span class="cpf">"maximus-app.h"</span><span class="cp"></span> +<a name="line-33"></a> +<a name="line-34"></a><span class="cp">#ifdef __GNUC__</span> +<a name="line-35"></a><span class="cp">#define UNUSED_VARIABLE __attribute__ ((unused))</span> +<a name="line-36"></a><span class="cp">#else</span> +<a name="line-37"></a><span class="cp">#define UNUSED_VARIABLE</span> +<a name="line-38"></a><span class="cp">#endif</span> +<a name="line-39"></a> +<a name="line-40"></a><span class="k">static</span> <span class="n">gboolean</span> <span class="n">version</span> <span class="o">=</span> <span class="n">FALSE</span><span class="p">;</span> +<a name="line-41"></a><span class="n">gboolean</span> <span class="n">no_maximize</span> <span class="o">=</span> <span class="n">FALSE</span><span class="p">;</span> +<a name="line-42"></a> +<a name="line-43"></a><span class="n">GOptionEntry</span> <span class="n">entries</span><span class="p">[]</span> <span class="o">=</span> +<a name="line-44"></a><span class="p">{</span> +<a name="line-45"></a> <span class="p">{</span> +<a name="line-46"></a> <span class="s">"version"</span><span class="p">,</span> <span class="sc">'v'</span><span class="p">,</span> +<a name="line-47"></a> <span class="mi">0</span><span class="p">,</span> <span class="n">G_OPTION_ARG_NONE</span><span class="p">,</span> +<a name="line-48"></a> <span class="o">&</span><span class="n">version</span><span class="p">,</span> +<a name="line-49"></a> <span class="s">"Prints the version number"</span><span class="p">,</span> <span class="nb">NULL</span> +<a name="line-50"></a> <span class="p">},</span> +<a name="line-51"></a> <span class="p">{</span> +<a name="line-52"></a> <span class="s">"no-maximize"</span><span class="p">,</span> <span class="sc">'m'</span><span class="p">,</span> +<a name="line-53"></a> <span class="mi">0</span><span class="p">,</span> <span class="n">G_OPTION_ARG_NONE</span><span class="p">,</span> +<a name="line-54"></a> <span class="o">&</span><span class="n">no_maximize</span><span class="p">,</span> +<a name="line-55"></a> <span class="s">"Do not automatically maximize every window"</span><span class="p">,</span> <span class="nb">NULL</span> +<a name="line-56"></a> <span class="p">},</span> +<a name="line-57"></a> <span class="p">{</span> +<a name="line-58"></a> <span class="nb">NULL</span> +<a name="line-59"></a> <span class="p">}</span> +<a name="line-60"></a><span class="p">};</span> +<a name="line-61"></a> +<a name="line-62"></a><span class="n">gint</span> <span class="nf">main</span> <span class="p">(</span><span class="n">gint</span> <span class="n">argc</span><span class="p">,</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">argv</span><span class="p">[])</span> +<a name="line-63"></a><span class="p">{</span> +<a name="line-64"></a> <span class="n">GApplication</span> <span class="o">*</span><span class="n">application</span><span class="p">;</span> +<a name="line-65"></a> <span class="n">MaximusApp</span> <span class="n">UNUSED_VARIABLE</span> <span class="o">*</span><span class="n">app</span><span class="p">;</span> +<a name="line-66"></a> <span class="n">GOptionContext</span> <span class="o">*</span><span class="n">context</span><span class="p">;</span> +<a name="line-67"></a> <span class="n">GError</span> <span class="o">*</span><span class="n">error</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span> +<a name="line-68"></a> <span class="n">GdkDisplay</span> <span class="o">*</span><span class="n">gdk_display</span><span class="p">;</span> +<a name="line-69"></a> +<a name="line-70"></a> <span class="n">g_set_application_name</span> <span class="p">(</span><span class="s">"Maximus"</span><span class="p">);</span> +<a name="line-71"></a> +<a name="line-72"></a> <span class="n">gtk_init</span> <span class="p">(</span><span class="o">&</span><span class="n">argc</span><span class="p">,</span> <span class="o">&</span><span class="n">argv</span><span class="p">);</span> +<a name="line-73"></a> +<a name="line-74"></a> <span class="n">application</span> <span class="o">=</span> <span class="n">g_application_new</span> <span class="p">(</span><span class="s">"com.canonical.Maximus"</span><span class="p">,</span> <span class="n">G_APPLICATION_FLAGS_NONE</span><span class="p">);</span> +<a name="line-75"></a> +<a name="line-76"></a> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">g_application_register</span> <span class="p">(</span><span class="n">application</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">,</span> <span class="o">&</span><span class="n">error</span><span class="p">))</span> +<a name="line-77"></a> <span class="p">{</span> +<a name="line-78"></a> <span class="n">g_warning</span> <span class="p">(</span><span class="s">"%s"</span><span class="p">,</span> <span class="n">error</span><span class="o">-></span><span class="n">message</span><span class="p">);</span> +<a name="line-79"></a> <span class="n">g_error_free</span> <span class="p">(</span><span class="n">error</span><span class="p">);</span> +<a name="line-80"></a> <span class="k">return</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-81"></a> <span class="p">}</span> +<a name="line-82"></a> +<a name="line-83"></a> <span class="k">if</span> <span class="p">(</span><span class="n">g_application_get_is_remote</span><span class="p">(</span><span class="n">application</span><span class="p">))</span> +<a name="line-84"></a> <span class="p">{</span> +<a name="line-85"></a> <span class="k">return</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-86"></a> <span class="p">}</span> +<a name="line-87"></a> +<a name="line-88"></a> <span class="n">context</span> <span class="o">=</span> <span class="n">g_option_context_new</span> <span class="p">(</span><span class="s">"- Maximus"</span><span class="p">);</span> +<a name="line-89"></a> <span class="n">g_option_context_add_main_entries</span> <span class="p">(</span><span class="n">context</span><span class="p">,</span> <span class="n">entries</span><span class="p">,</span> <span class="s">"maximus"</span><span class="p">);</span> +<a name="line-90"></a> <span class="n">g_option_context_add_group</span> <span class="p">(</span><span class="n">context</span><span class="p">,</span> <span class="n">gtk_get_option_group</span> <span class="p">(</span><span class="n">TRUE</span><span class="p">));</span> +<a name="line-91"></a> <span class="n">g_option_context_parse</span> <span class="p">(</span><span class="n">context</span><span class="p">,</span> <span class="o">&</span><span class="n">argc</span><span class="p">,</span> <span class="o">&</span><span class="n">argv</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span> +<a name="line-92"></a> <span class="n">g_option_context_free</span><span class="p">(</span><span class="n">context</span><span class="p">);</span> +<a name="line-93"></a> +<a name="line-94"></a> <span class="n">gdk_display</span> <span class="o">=</span> <span class="n">gdk_display_get_default</span> <span class="p">();</span> +<a name="line-95"></a> <span class="n">gdk_x11_display_error_trap_push</span> <span class="p">(</span><span class="n">gdk_display</span><span class="p">);</span> +<a name="line-96"></a><span class="hll"> <span class="n">app</span> <span class="o">=</span> <span class="n">maximus_app_get_default</span> <span class="p">();</span><span class="error2"><--- Variable 'app' is assigned a value that is never used.</span> +</span><a name="line-97"></a> <span class="n">gdk_x11_display_error_trap_pop_ignored</span> <span class="p">(</span><span class="n">gdk_display</span><span class="p">);</span> +<a name="line-98"></a> +<a name="line-99"></a> <span class="n">gtk_main</span> <span class="p">();</span> +<a name="line-100"></a> +<a name="line-101"></a> <span class="k">return</span> <span class="n">EXIT_SUCCESS</span><span class="p">;</span> +<a name="line-102"></a><span class="p">}</span> +</pre></div> +</td></tr></table> + </div> <!-- /.wrapper --> + </div> + <div id="footer" class="footer"> + <p> + Cppcheck 2.3 - a tool for static C/C++ code analysis<br> + <br> + Internet: <a href="http://cppcheck.net">http://cppcheck.net</a><br> + IRC: <a href="irc://irc.freenode.net/cppcheck">irc://irc.freenode.net/cppcheck</a><br> + </p> + </div> + </body> +</html> diff --git a/2021-06-21-213330-4389-cppcheck@e2f7cfd5fc80_master/2.html b/2021-06-21-213330-4389-cppcheck@e2f7cfd5fc80_master/2.html new file mode 100644 index 0000000..3945a93 --- /dev/null +++ b/2021-06-21-213330-4389-cppcheck@e2f7cfd5fc80_master/2.html @@ -0,0 +1,1273 @@ + +<!doctype html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>Cppcheck - HTML report - mate-netbook</title> + <link rel="stylesheet" href="style.css"> + <style> +pre { line-height: 125%; } +td.linenos pre { color: #000000; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; } +span.linenos { color: #000000; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; } +td.linenos pre.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +.highlight .hll { background-color: #ffffcc } +.highlight { background: #ffffff; } +.highlight .c { color: #888888 } /* Comment */ +.highlight .err { color: #FF0000; background-color: #FFAAAA } /* Error */ +.highlight .k { color: #008800; font-weight: bold } /* Keyword */ +.highlight .o { color: #333333 } /* Operator */ +.highlight .ch { color: #888888 } /* Comment.Hashbang */ +.highlight .cm { color: #888888 } /* Comment.Multiline */ +.highlight .cp { color: #557799 } /* Comment.Preproc */ +.highlight .cpf { color: #888888 } /* Comment.PreprocFile */ +.highlight .c1 { color: #888888 } /* Comment.Single */ +.highlight .cs { color: #cc0000; font-weight: bold } /* Comment.Special */ +.highlight .gd { color: #A00000 } /* Generic.Deleted */ +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .gr { color: #FF0000 } /* Generic.Error */ +.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.highlight .gi { color: #00A000 } /* Generic.Inserted */ +.highlight .go { color: #888888 } /* Generic.Output */ +.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.highlight .gt { color: #0044DD } /* Generic.Traceback */ +.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ +.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { color: #003388; font-weight: bold } /* Keyword.Pseudo */ +.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #333399; font-weight: bold } /* Keyword.Type */ +.highlight .m { color: #6600EE; font-weight: bold } /* Literal.Number */ +.highlight .s { background-color: #fff0f0 } /* Literal.String */ +.highlight .na { color: #0000CC } /* Name.Attribute */ +.highlight .nb { color: #007020 } /* Name.Builtin */ +.highlight .nc { color: #BB0066; font-weight: bold } /* Name.Class */ +.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ +.highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ +.highlight .ni { color: #880000; font-weight: bold } /* Name.Entity */ +.highlight .ne { color: #FF0000; font-weight: bold } /* Name.Exception */ +.highlight .nf { color: #0066BB; font-weight: bold } /* Name.Function */ +.highlight .nl { color: #997700; font-weight: bold } /* Name.Label */ +.highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ +.highlight .nt { color: #007700 } /* Name.Tag */ +.highlight .nv { color: #996633 } /* Name.Variable */ +.highlight .ow { color: #000000; font-weight: bold } /* Operator.Word */ +.highlight .w { color: #bbbbbb } /* Text.Whitespace */ +.highlight .mb { color: #6600EE; font-weight: bold } /* Literal.Number.Bin */ +.highlight .mf { color: #6600EE; font-weight: bold } /* Literal.Number.Float */ +.highlight .mh { color: #005588; font-weight: bold } /* Literal.Number.Hex */ +.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ +.highlight .mo { color: #4400EE; font-weight: bold } /* Literal.Number.Oct */ +.highlight .sa { background-color: #fff0f0 } /* Literal.String.Affix */ +.highlight .sb { background-color: #fff0f0 } /* Literal.String.Backtick */ +.highlight .sc { color: #0044DD } /* Literal.String.Char */ +.highlight .dl { background-color: #fff0f0 } /* Literal.String.Delimiter */ +.highlight .sd { color: #DD4422 } /* Literal.String.Doc */ +.highlight .s2 { background-color: #fff0f0 } /* Literal.String.Double */ +.highlight .se { color: #666666; font-weight: bold; background-color: #fff0f0 } /* Literal.String.Escape */ +.highlight .sh { background-color: #fff0f0 } /* Literal.String.Heredoc */ +.highlight .si { background-color: #eeeeee } /* Literal.String.Interpol */ +.highlight .sx { color: #DD2200; background-color: #fff0f0 } /* Literal.String.Other */ +.highlight .sr { color: #000000; background-color: #fff0ff } /* Literal.String.Regex */ +.highlight .s1 { background-color: #fff0f0 } /* Literal.String.Single */ +.highlight .ss { color: #AA6600 } /* Literal.String.Symbol */ +.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ +.highlight .fm { color: #0066BB; font-weight: bold } /* Name.Function.Magic */ +.highlight .vc { color: #336699 } /* Name.Variable.Class */ +.highlight .vg { color: #dd7700; font-weight: bold } /* Name.Variable.Global */ +.highlight .vi { color: #3333BB } /* Name.Variable.Instance */ +.highlight .vm { color: #996633 } /* Name.Variable.Magic */ +.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ + </style> + <script> + function getStyle(el, styleProp) { + var y; + + if (el.currentStyle) { + y = el.currentStyle[styleProp]; + } else if (window.getComputedStyle) { + y = document.defaultView.getComputedStyle(el, null).getPropertyValue(styleProp); + } + + return y; + } + + function toggle() { + var el = this.expandable_content; + var mark = this.expandable_marker; + + if (el.style.display === "block") { + el.style.display = "none"; + mark.textContent = "[+]"; + } else { + el.style.display = "block"; + mark.textContent = "[-]"; + } + } + + function initExpandables() { + var elements = document.querySelectorAll(".expandable"); + + for (var i = 0, len = elements.length; i < len; i++) { + var el = elements[i]; + var clickable = el.querySelector("span"); + var marker = clickable.querySelector(".marker"); + var content = el.querySelector(".content"); + var width = clickable.clientWidth - parseInt(getStyle(content, "padding-left")) - parseInt(getStyle(content, "padding-right")); + content.style.width = width + "px"; + clickable.expandable_content = content; + clickable.expandable_marker = marker; + clickable.addEventListener("click", toggle); + } + } + + function toggleDisplay(id) { + var elements = document.querySelectorAll("." + id); + + for (var i = 0, len = elements.length; i < len; i++) { + elements[i].classList.toggle("d-none"); + } + } + + function toggleAll() { + var elements = document.querySelectorAll("input"); + + // starting from 1 since 0 is the "toggle all" input + for (var i = 1, len = elements.length; i < len; i++) { + var el = elements[i]; + + if (el.checked) { + el.checked = false; + } else { + el.checked = true; + } + + toggleDisplay(el.id); + } + } + window.addEventListener("load", initExpandables); + </script> + </head> + <body> + <div id="header" class="header"> + <h1>Cppcheck report - mate-netbook: maximus/maximus-app.c</h1> + </div> + <div class="wrapper"> + <div id="menu"> + <p id="filename"><a href="index.html">Defects:</a> maximus-app.c</p> +<a href="2.html#line-118"> knownConditionTrueFalse 118</a><a href="2.html#line-124"> knownConditionTrueFalse 124</a> + </div> + <div id="content"> +<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 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</pre></div></td><td class="code"><div class="highlight"><pre><span></span><a name="line-1"></a><span class="cm">/*</span> +<a name="line-2"></a><span class="cm"> * Copyright (C) 2008 Canonical Ltd</span> +<a name="line-3"></a><span class="cm"> * Copyright (C) 2012-2021 MATE Developers</span> +<a name="line-4"></a><span class="cm"> *</span> +<a name="line-5"></a><span class="cm"> * This program is free software: you can redistribute it and/or modify</span> +<a name="line-6"></a><span class="cm"> * it under the terms of the GNU General Public License version 3 as </span> +<a name="line-7"></a><span class="cm"> * published by the Free Software Foundation.</span> +<a name="line-8"></a><span class="cm"> *</span> +<a name="line-9"></a><span class="cm"> * This program is distributed in the hope that it will be useful,</span> +<a name="line-10"></a><span class="cm"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span> +<a name="line-11"></a><span class="cm"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span> +<a name="line-12"></a><span class="cm"> * GNU General Public License for more details.</span> +<a name="line-13"></a><span class="cm"> *</span> +<a name="line-14"></a><span class="cm"> * You should have received a copy of the GNU General Public License</span> +<a name="line-15"></a><span class="cm"> * along with this program. If not, see <http://www.gnu.org/licenses/>.</span> +<a name="line-16"></a><span class="cm"> *</span> +<a name="line-17"></a><span class="cm"> * Authored by Neil Jagdish Patel <[email protected]></span> +<a name="line-18"></a><span class="cm"> *</span> +<a name="line-19"></a><span class="cm"> */</span> +<a name="line-20"></a> +<a name="line-21"></a><span class="cp">#include</span> <span class="cpf"><stdio.h></span><span class="cp"></span> +<a name="line-22"></a><span class="cp">#include</span> <span class="cpf"><string.h></span><span class="cp"></span> +<a name="line-23"></a><span class="cp">#include</span> <span class="cpf"><unistd.h></span><span class="cp"></span> +<a name="line-24"></a> +<a name="line-25"></a><span class="cp">#include</span> <span class="cpf"><gtk/gtk.h></span><span class="cp"></span> +<a name="line-26"></a><span class="cp">#include</span> <span class="cpf"><gdk/gdkx.h></span><span class="cp"></span> +<a name="line-27"></a><span class="cp">#include</span> <span class="cpf"><gio/gio.h></span><span class="cp"></span> +<a name="line-28"></a> +<a name="line-29"></a><span class="cp">#include</span> <span class="cpf">"maximus-app.h"</span><span class="cp"></span> +<a name="line-30"></a><span class="cp">#include</span> <span class="cpf">"maximus-bind.h"</span><span class="cp"></span> +<a name="line-31"></a><span class="cp">#include</span> <span class="cpf">"xutils.h"</span><span class="cp"></span> +<a name="line-32"></a> +<a name="line-33"></a><span class="cm">/* GSettings schemas and keys */</span> +<a name="line-34"></a><span class="cp">#define APP_SCHEMA "org.mate.maximus"</span> +<a name="line-35"></a><span class="cp">#define APP_EXCLUDE_CLASS "exclude-class"</span> +<a name="line-36"></a><span class="cp">#define APP_UNDECORATE "undecorate"</span> +<a name="line-37"></a><span class="cp">#define APP_NO_MAXIMIZE "no-maximize"</span> +<a name="line-38"></a> +<a name="line-39"></a><span class="cm">/* A set of default exceptions */</span> +<a name="line-40"></a><span class="k">static</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">default_exclude_classes</span><span class="p">[]</span> <span class="o">=</span> +<a name="line-41"></a><span class="p">{</span> +<a name="line-42"></a> <span class="s">"Apport-gtk"</span><span class="p">,</span> +<a name="line-43"></a> <span class="s">"Bluetooth-properties"</span><span class="p">,</span> +<a name="line-44"></a> <span class="s">"Bluetooth-wizard"</span><span class="p">,</span> +<a name="line-45"></a> <span class="s">"Download"</span><span class="p">,</span> <span class="cm">/* Firefox Download Window */</span> +<a name="line-46"></a> <span class="s">"Ekiga"</span><span class="p">,</span> +<a name="line-47"></a> <span class="s">"Extension"</span><span class="p">,</span> <span class="cm">/* Firefox Add-Ons/Extension Window */</span> +<a name="line-48"></a> <span class="s">"Gcalctool"</span><span class="p">,</span> +<a name="line-49"></a> <span class="s">"Gimp"</span><span class="p">,</span> +<a name="line-50"></a> <span class="s">"Global"</span><span class="p">,</span> <span class="cm">/* Firefox Error Console Window */</span> +<a name="line-51"></a> <span class="s">"Mate-dictionary"</span><span class="p">,</span> +<a name="line-52"></a> <span class="s">"Mate-language-selector"</span><span class="p">,</span> +<a name="line-53"></a> <span class="s">"Mate-nettool"</span><span class="p">,</span> +<a name="line-54"></a> <span class="s">"Mate-volume-control"</span><span class="p">,</span> +<a name="line-55"></a> <span class="s">"Kiten"</span><span class="p">,</span> +<a name="line-56"></a> <span class="s">"Kmplot"</span><span class="p">,</span> +<a name="line-57"></a> <span class="s">"Nm-editor"</span><span class="p">,</span> +<a name="line-58"></a> <span class="s">"Pidgin"</span><span class="p">,</span> +<a name="line-59"></a> <span class="s">"Polkit-mate-authorization"</span><span class="p">,</span> +<a name="line-60"></a> <span class="s">"Update-manager"</span><span class="p">,</span> +<a name="line-61"></a> <span class="s">"Skype"</span><span class="p">,</span> +<a name="line-62"></a> <span class="s">"Toplevel"</span><span class="p">,</span> <span class="cm">/* Firefox "Clear Private Data" Window */</span> +<a name="line-63"></a> <span class="s">"Transmission"</span> +<a name="line-64"></a><span class="p">};</span> +<a name="line-65"></a> +<a name="line-66"></a><span class="k">struct</span> <span class="nc">_MaximusAppPrivate</span> +<a name="line-67"></a><span class="p">{</span> +<a name="line-68"></a> <span class="n">MaximusBind</span> <span class="o">*</span><span class="n">bind</span><span class="p">;</span> +<a name="line-69"></a> <span class="n">WnckScreen</span> <span class="o">*</span><span class="n">screen</span><span class="p">;</span> +<a name="line-70"></a> <span class="n">GSettings</span> <span class="o">*</span><span class="n">settings</span><span class="p">;</span> +<a name="line-71"></a> +<a name="line-72"></a> <span class="n">gchar</span> <span class="o">**</span><span class="n">exclude_class_list</span><span class="p">;</span> +<a name="line-73"></a> <span class="n">gboolean</span> <span class="n">undecorate</span><span class="p">;</span> +<a name="line-74"></a> <span class="n">gboolean</span> <span class="n">no_maximize</span><span class="p">;</span> +<a name="line-75"></a><span class="p">};</span> +<a name="line-76"></a> +<a name="line-77"></a><span class="k">static</span> <span class="n">GQuark</span> <span class="n">was_decorated</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-78"></a> +<a name="line-79"></a><span class="cm">/* <TAKEN FROM GDK> */</span> +<a name="line-80"></a><span class="k">typedef</span> <span class="k">struct</span> <span class="p">{</span> +<a name="line-81"></a> <span class="kt">unsigned</span> <span class="kt">long</span> <span class="n">flags</span><span class="p">;</span> +<a name="line-82"></a> <span class="kt">unsigned</span> <span class="kt">long</span> <span class="n">functions</span><span class="p">;</span> +<a name="line-83"></a> <span class="kt">unsigned</span> <span class="kt">long</span> <span class="n">decorations</span><span class="p">;</span> +<a name="line-84"></a> <span class="kt">long</span> <span class="n">input_mode</span><span class="p">;</span> +<a name="line-85"></a> <span class="kt">unsigned</span> <span class="kt">long</span> <span class="n">status</span><span class="p">;</span> +<a name="line-86"></a><span class="p">}</span> <span class="n">MotifWmHints</span><span class="p">,</span> <span class="n">MwmHints</span><span class="p">;</span> +<a name="line-87"></a> +<a name="line-88"></a><span class="cp">#define MWM_HINTS_FUNCTIONS (1L << 0)</span> +<a name="line-89"></a><span class="cp">#define MWM_HINTS_DECORATIONS (1L << 1)</span> +<a name="line-90"></a><span class="cp">#define _XA_MOTIF_WM_HINTS "_MOTIF_WM_HINTS"</span> +<a name="line-91"></a> +<a name="line-92"></a><span class="n">G_DEFINE_TYPE_WITH_PRIVATE</span> <span class="p">(</span><span class="n">MaximusApp</span><span class="p">,</span> <span class="n">maximus_app</span><span class="p">,</span> <span class="n">G_TYPE_OBJECT</span><span class="p">);</span> +<a name="line-93"></a> +<a name="line-94"></a><span class="k">static</span> <span class="n">gboolean</span> +<a name="line-95"></a><span class="n">wnck_window_is_decorated</span> <span class="p">(</span><span class="n">WnckWindow</span> <span class="o">*</span><span class="n">window</span><span class="p">)</span> +<a name="line-96"></a><span class="p">{</span> +<a name="line-97"></a> <span class="n">GdkDisplay</span> <span class="o">*</span><span class="n">display</span> <span class="o">=</span> <span class="n">gdk_display_get_default</span><span class="p">();</span> +<a name="line-98"></a> <span class="n">Atom</span> <span class="n">hints_atom</span> <span class="o">=</span> <span class="n">None</span><span class="p">;</span> +<a name="line-99"></a> <span class="n">guchar</span> <span class="o">*</span><span class="n">data</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span> +<a name="line-100"></a> <span class="n">MotifWmHints</span> <span class="o">*</span><span class="n">hints</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span> +<a name="line-101"></a> <span class="n">Atom</span> <span class="n">type</span> <span class="o">=</span> <span class="n">None</span><span class="p">;</span> +<a name="line-102"></a> <span class="n">gint</span> <span class="n">format</span><span class="p">;</span> +<a name="line-103"></a> <span class="n">gulong</span> <span class="n">nitems</span><span class="p">;</span> +<a name="line-104"></a> <span class="n">gulong</span> <span class="n">bytes_after</span><span class="p">;</span> +<a name="line-105"></a> <span class="n">gboolean</span> <span class="n">retval</span><span class="p">;</span> +<a name="line-106"></a> +<a name="line-107"></a> <span class="n">g_return_val_if_fail</span> <span class="p">(</span><span class="n">WNCK_IS_WINDOW</span> <span class="p">(</span><span class="n">window</span><span class="p">),</span> <span class="n">FALSE</span><span class="p">);</span> +<a name="line-108"></a> +<a name="line-109"></a> <span class="n">hints_atom</span> <span class="o">=</span> <span class="n">gdk_x11_get_xatom_by_name_for_display</span> <span class="p">(</span><span class="n">display</span><span class="p">,</span> +<a name="line-110"></a> <span class="n">_XA_MOTIF_WM_HINTS</span><span class="p">);</span> +<a name="line-111"></a> +<a name="line-112"></a> <span class="n">XGetWindowProperty</span> <span class="p">(</span><span class="n">GDK_DISPLAY_XDISPLAY</span> <span class="p">(</span><span class="n">display</span><span class="p">),</span> +<a name="line-113"></a> <span class="n">wnck_window_get_xid</span> <span class="p">(</span><span class="n">window</span><span class="p">),</span> +<a name="line-114"></a> <span class="n">hints_atom</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">MotifWmHints</span><span class="p">)</span><span class="o">/</span><span class="k">sizeof</span> <span class="p">(</span><span class="kt">long</span><span class="p">),</span> +<a name="line-115"></a> <span class="n">False</span><span class="p">,</span> <span class="n">AnyPropertyType</span><span class="p">,</span> <span class="o">&</span><span class="n">type</span><span class="p">,</span> <span class="o">&</span><span class="n">format</span><span class="p">,</span> <span class="o">&</span><span class="n">nitems</span><span class="p">,</span> +<a name="line-116"></a> <span class="o">&</span><span class="n">bytes_after</span><span class="p">,</span> <span class="o">&</span><span class="n">data</span><span class="p">);</span> +<a name="line-117"></a> +<a name="line-118"></a><span class="hll"> <span class="k">if</span> <span class="p">(</span><span class="n">type</span> <span class="o">==</span> <span class="n">None</span> <span class="o">||</span> <span class="o">!</span><span class="n">data</span><span class="p">)</span> <span class="k">return</span> <span class="n">TRUE</span><span class="p">;</span><span class="error2"><--- Assuming that condition '!data' is not redundant</span> +</span><a name="line-119"></a> +<a name="line-120"></a> <span class="n">hints</span> <span class="o">=</span> <span class="p">(</span><span class="n">MotifWmHints</span> <span class="o">*</span><span class="p">)</span><span class="n">data</span><span class="p">;</span> +<a name="line-121"></a> +<a name="line-122"></a> <span class="n">retval</span> <span class="o">=</span> <span class="n">hints</span><span class="o">-></span><span class="n">decorations</span><span class="p">;</span> +<a name="line-123"></a> +<a name="line-124"></a><span class="hll"> <span class="k">if</span> <span class="p">(</span><span class="n">data</span><span class="p">)</span><span class="error2"><--- Condition 'data' is always true</span> +</span><a name="line-125"></a> <span class="n">XFree</span> <span class="p">(</span><span class="n">data</span><span class="p">);</span> +<a name="line-126"></a> +<a name="line-127"></a> <span class="k">return</span> <span class="n">retval</span><span class="p">;</span> +<a name="line-128"></a><span class="p">}</span> +<a name="line-129"></a> +<a name="line-130"></a><span class="k">static</span> <span class="kt">void</span> +<a name="line-131"></a><span class="n">gdk_window_set_mwm_hints</span> <span class="p">(</span><span class="n">WnckWindow</span> <span class="o">*</span><span class="n">window</span><span class="p">,</span> +<a name="line-132"></a> <span class="n">MotifWmHints</span> <span class="o">*</span><span class="n">new_hints</span><span class="p">)</span> +<a name="line-133"></a><span class="p">{</span> +<a name="line-134"></a> <span class="n">GdkDisplay</span> <span class="o">*</span><span class="n">display</span> <span class="o">=</span> <span class="n">gdk_display_get_default</span><span class="p">();</span> +<a name="line-135"></a> <span class="n">Atom</span> <span class="n">hints_atom</span> <span class="o">=</span> <span class="n">None</span><span class="p">;</span> +<a name="line-136"></a> <span class="n">guchar</span> <span class="o">*</span><span class="n">data</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span> +<a name="line-137"></a> <span class="n">MotifWmHints</span> <span class="o">*</span><span class="n">hints</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span> +<a name="line-138"></a> <span class="n">Atom</span> <span class="n">type</span> <span class="o">=</span> <span class="n">None</span><span class="p">;</span> +<a name="line-139"></a> <span class="n">gint</span> <span class="n">format</span><span class="p">;</span> +<a name="line-140"></a> <span class="n">gulong</span> <span class="n">nitems</span><span class="p">;</span> +<a name="line-141"></a> <span class="n">gulong</span> <span class="n">bytes_after</span><span class="p">;</span> +<a name="line-142"></a> +<a name="line-143"></a> <span class="n">g_return_if_fail</span> <span class="p">(</span><span class="n">WNCK_IS_WINDOW</span> <span class="p">(</span><span class="n">window</span><span class="p">));</span> +<a name="line-144"></a> <span class="n">g_return_if_fail</span> <span class="p">(</span><span class="n">GDK_IS_DISPLAY</span> <span class="p">(</span><span class="n">display</span><span class="p">));</span> +<a name="line-145"></a> +<a name="line-146"></a> <span class="n">hints_atom</span> <span class="o">=</span> <span class="n">gdk_x11_get_xatom_by_name_for_display</span> <span class="p">(</span><span class="n">display</span><span class="p">,</span> +<a name="line-147"></a> <span class="n">_XA_MOTIF_WM_HINTS</span><span class="p">);</span> +<a name="line-148"></a> +<a name="line-149"></a> <span class="n">gdk_x11_display_error_trap_push</span> <span class="p">(</span><span class="n">display</span><span class="p">);</span> +<a name="line-150"></a> <span class="n">XGetWindowProperty</span> <span class="p">(</span><span class="n">GDK_DISPLAY_XDISPLAY</span> <span class="p">(</span><span class="n">display</span><span class="p">),</span> +<a name="line-151"></a> <span class="n">wnck_window_get_xid</span> <span class="p">(</span><span class="n">window</span><span class="p">),</span> +<a name="line-152"></a> <span class="n">hints_atom</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">MotifWmHints</span><span class="p">)</span><span class="o">/</span><span class="k">sizeof</span> <span class="p">(</span><span class="kt">long</span><span class="p">),</span> +<a name="line-153"></a> <span class="n">False</span><span class="p">,</span> <span class="n">AnyPropertyType</span><span class="p">,</span> <span class="o">&</span><span class="n">type</span><span class="p">,</span> <span class="o">&</span><span class="n">format</span><span class="p">,</span> <span class="o">&</span><span class="n">nitems</span><span class="p">,</span> +<a name="line-154"></a> <span class="o">&</span><span class="n">bytes_after</span><span class="p">,</span> <span class="o">&</span><span class="n">data</span><span class="p">);</span> +<a name="line-155"></a> <span class="k">if</span> <span class="p">(</span><span class="n">gdk_x11_display_error_trap_pop</span> <span class="p">(</span><span class="n">display</span><span class="p">))</span> +<a name="line-156"></a> <span class="k">return</span><span class="p">;</span> +<a name="line-157"></a> +<a name="line-158"></a> <span class="k">if</span> <span class="p">(</span><span class="n">type</span> <span class="o">!=</span> <span class="n">hints_atom</span> <span class="o">||</span> <span class="o">!</span><span class="n">data</span><span class="p">)</span> +<a name="line-159"></a> <span class="n">hints</span> <span class="o">=</span> <span class="n">new_hints</span><span class="p">;</span> +<a name="line-160"></a> <span class="k">else</span> +<a name="line-161"></a> <span class="p">{</span> +<a name="line-162"></a> <span class="n">hints</span> <span class="o">=</span> <span class="p">(</span><span class="n">MotifWmHints</span> <span class="o">*</span><span class="p">)</span><span class="n">data</span><span class="p">;</span> +<a name="line-163"></a> +<a name="line-164"></a> <span class="k">if</span> <span class="p">(</span><span class="n">new_hints</span><span class="o">-></span><span class="n">flags</span> <span class="o">&</span> <span class="n">MWM_HINTS_FUNCTIONS</span><span class="p">)</span> +<a name="line-165"></a> <span class="p">{</span> +<a name="line-166"></a> <span class="n">hints</span><span class="o">-></span><span class="n">flags</span> <span class="o">|=</span> <span class="n">MWM_HINTS_FUNCTIONS</span><span class="p">;</span> +<a name="line-167"></a> <span class="n">hints</span><span class="o">-></span><span class="n">functions</span> <span class="o">=</span> <span class="n">new_hints</span><span class="o">-></span><span class="n">functions</span><span class="p">;</span> +<a name="line-168"></a> <span class="p">}</span> +<a name="line-169"></a> <span class="k">if</span> <span class="p">(</span><span class="n">new_hints</span><span class="o">-></span><span class="n">flags</span> <span class="o">&</span> <span class="n">MWM_HINTS_DECORATIONS</span><span class="p">)</span> +<a name="line-170"></a> <span class="p">{</span> +<a name="line-171"></a> <span class="n">hints</span><span class="o">-></span><span class="n">flags</span> <span class="o">|=</span> <span class="n">MWM_HINTS_DECORATIONS</span><span class="p">;</span> +<a name="line-172"></a> <span class="n">hints</span><span class="o">-></span><span class="n">decorations</span> <span class="o">=</span> <span class="n">new_hints</span><span class="o">-></span><span class="n">decorations</span><span class="p">;</span> +<a name="line-173"></a> <span class="p">}</span> +<a name="line-174"></a> <span class="p">}</span> +<a name="line-175"></a> +<a name="line-176"></a> <span class="n">_wnck_error_trap_push</span> <span class="p">();</span> +<a name="line-177"></a> <span class="n">XChangeProperty</span> <span class="p">(</span><span class="n">GDK_DISPLAY_XDISPLAY</span> <span class="p">(</span><span class="n">display</span><span class="p">),</span> +<a name="line-178"></a> <span class="n">wnck_window_get_xid</span> <span class="p">(</span><span class="n">window</span><span class="p">),</span> +<a name="line-179"></a> <span class="n">hints_atom</span><span class="p">,</span> <span class="n">hints_atom</span><span class="p">,</span> <span class="mi">32</span><span class="p">,</span> <span class="n">PropModeReplace</span><span class="p">,</span> +<a name="line-180"></a> <span class="p">(</span><span class="n">guchar</span> <span class="o">*</span><span class="p">)</span><span class="n">hints</span><span class="p">,</span> <span class="k">sizeof</span> <span class="p">(</span><span class="n">MotifWmHints</span><span class="p">)</span><span class="o">/</span><span class="k">sizeof</span> <span class="p">(</span><span class="kt">long</span><span class="p">));</span> +<a name="line-181"></a> <span class="n">gdk_display_flush</span> <span class="p">(</span><span class="n">display</span><span class="p">);</span> +<a name="line-182"></a> <span class="n">_wnck_error_trap_pop</span> <span class="p">();</span> +<a name="line-183"></a> +<a name="line-184"></a> <span class="k">if</span> <span class="p">(</span><span class="n">data</span><span class="p">)</span> +<a name="line-185"></a> <span class="n">XFree</span> <span class="p">(</span><span class="n">data</span><span class="p">);</span> +<a name="line-186"></a><span class="p">}</span> +<a name="line-187"></a> +<a name="line-188"></a><span class="k">static</span> <span class="kt">void</span> +<a name="line-189"></a><span class="n">_window_set_decorations</span> <span class="p">(</span><span class="n">WnckWindow</span> <span class="o">*</span><span class="n">window</span><span class="p">,</span> +<a name="line-190"></a> <span class="n">GdkWMDecoration</span> <span class="n">decorations</span><span class="p">)</span> +<a name="line-191"></a><span class="p">{</span> +<a name="line-192"></a> <span class="n">MotifWmHints</span> <span class="o">*</span><span class="n">hints</span><span class="p">;</span> +<a name="line-193"></a> +<a name="line-194"></a> <span class="n">g_return_if_fail</span> <span class="p">(</span><span class="n">WNCK_IS_WINDOW</span> <span class="p">(</span><span class="n">window</span><span class="p">));</span> +<a name="line-195"></a> +<a name="line-196"></a> <span class="cm">/* initialize to zero to avoid writing uninitialized data to socket */</span> +<a name="line-197"></a> <span class="n">hints</span> <span class="o">=</span> <span class="n">g_slice_new0</span> <span class="p">(</span><span class="n">MotifWmHints</span><span class="p">);</span> +<a name="line-198"></a> <span class="n">hints</span><span class="o">-></span><span class="n">flags</span> <span class="o">=</span> <span class="n">MWM_HINTS_DECORATIONS</span><span class="p">;</span> +<a name="line-199"></a> <span class="n">hints</span><span class="o">-></span><span class="n">decorations</span> <span class="o">=</span> <span class="n">decorations</span><span class="p">;</span> +<a name="line-200"></a> +<a name="line-201"></a> <span class="n">gdk_window_set_mwm_hints</span> <span class="p">(</span><span class="n">window</span><span class="p">,</span> <span class="n">hints</span><span class="p">);</span> +<a name="line-202"></a> +<a name="line-203"></a> <span class="n">g_slice_free</span> <span class="p">(</span><span class="n">MotifWmHints</span><span class="p">,</span> <span class="n">hints</span><span class="p">);</span> +<a name="line-204"></a><span class="p">}</span> +<a name="line-205"></a> +<a name="line-206"></a><span class="cm">/* </TAKEN FROM GDK> */</span> +<a name="line-207"></a> +<a name="line-208"></a><span class="n">gboolean</span> +<a name="line-209"></a><span class="n">window_is_too_large_for_screen</span> <span class="p">(</span><span class="n">WnckWindow</span> <span class="o">*</span><span class="n">window</span><span class="p">)</span> +<a name="line-210"></a><span class="p">{</span> +<a name="line-211"></a> <span class="k">static</span> <span class="n">GdkScreen</span> <span class="o">*</span><span class="n">screen</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span> +<a name="line-212"></a> <span class="n">gint</span> <span class="n">x</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">w</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">h</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span> +<a name="line-213"></a> +<a name="line-214"></a> <span class="n">g_return_val_if_fail</span> <span class="p">(</span><span class="n">WNCK_IS_WINDOW</span> <span class="p">(</span><span class="n">window</span><span class="p">),</span> <span class="n">FALSE</span><span class="p">);</span> +<a name="line-215"></a> +<a name="line-216"></a> <span class="k">if</span> <span class="p">(</span><span class="n">screen</span> <span class="o">==</span> <span class="nb">NULL</span><span class="p">)</span> +<a name="line-217"></a> <span class="n">screen</span> <span class="o">=</span> <span class="n">gdk_screen_get_default</span> <span class="p">();</span> +<a name="line-218"></a> +<a name="line-219"></a> <span class="n">wnck_window_get_geometry</span> <span class="p">(</span><span class="n">window</span><span class="p">,</span> <span class="o">&</span><span class="n">x</span><span class="p">,</span> <span class="o">&</span><span class="n">y</span><span class="p">,</span> <span class="o">&</span><span class="n">w</span><span class="p">,</span> <span class="o">&</span><span class="n">h</span><span class="p">);</span> +<a name="line-220"></a> +<a name="line-221"></a> <span class="cm">/* some wiggle room */</span> +<a name="line-222"></a> <span class="k">return</span> <span class="p">(</span><span class="n">screen</span> <span class="o">&&</span> +<a name="line-223"></a> <span class="p">(</span><span class="n">w</span> <span class="o">></span> <span class="p">(</span><span class="n">WidthOfScreen</span> <span class="p">(</span><span class="n">gdk_x11_screen_get_xscreen</span> <span class="p">(</span><span class="n">screen</span><span class="p">))</span> <span class="o">+</span> <span class="mi">20</span><span class="p">)</span> <span class="o">||</span> +<a name="line-224"></a> <span class="n">h</span> <span class="o">></span> <span class="p">(</span><span class="n">HeightOfScreen</span> <span class="p">(</span><span class="n">gdk_x11_screen_get_xscreen</span> <span class="p">(</span><span class="n">screen</span><span class="p">))</span> <span class="o">+</span> <span class="mi">20</span><span class="p">)));</span> +<a name="line-225"></a><span class="p">}</span> +<a name="line-226"></a> +<a name="line-227"></a><span class="k">static</span> <span class="n">gboolean</span> +<a name="line-228"></a><span class="n">on_window_maximised_changed</span> <span class="p">(</span><span class="n">WnckWindow</span> <span class="o">*</span><span class="n">window</span><span class="p">)</span> +<a name="line-229"></a><span class="p">{</span> +<a name="line-230"></a> <span class="n">g_return_val_if_fail</span> <span class="p">(</span><span class="n">WNCK_IS_WINDOW</span> <span class="p">(</span><span class="n">window</span><span class="p">),</span> <span class="n">FALSE</span><span class="p">);</span> +<a name="line-231"></a> +<a name="line-232"></a> <span class="k">if</span> <span class="p">(</span><span class="n">window_is_too_large_for_screen</span> <span class="p">(</span><span class="n">window</span><span class="p">))</span> +<a name="line-233"></a> <span class="p">{</span> +<a name="line-234"></a> <span class="n">_window_set_decorations</span> <span class="p">(</span><span class="n">window</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span> +<a name="line-235"></a> <span class="n">wnck_window_unmaximize</span> <span class="p">(</span><span class="n">window</span><span class="p">);</span> +<a name="line-236"></a> <span class="p">}</span> +<a name="line-237"></a> <span class="k">else</span> +<a name="line-238"></a> <span class="p">{</span> +<a name="line-239"></a> <span class="n">_window_set_decorations</span> <span class="p">(</span><span class="n">window</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span> +<a name="line-240"></a> <span class="p">}</span> +<a name="line-241"></a> <span class="k">return</span> <span class="n">FALSE</span><span class="p">;</span> +<a name="line-242"></a><span class="p">}</span> +<a name="line-243"></a> +<a name="line-244"></a><span class="k">static</span> <span class="n">gboolean</span> +<a name="line-245"></a><span class="n">enable_window_decorations</span> <span class="p">(</span><span class="n">WnckWindow</span> <span class="o">*</span><span class="n">window</span><span class="p">)</span> +<a name="line-246"></a><span class="p">{</span> +<a name="line-247"></a> <span class="n">g_return_val_if_fail</span> <span class="p">(</span><span class="n">WNCK_IS_WINDOW</span> <span class="p">(</span><span class="n">window</span><span class="p">),</span> <span class="n">FALSE</span><span class="p">);</span> +<a name="line-248"></a> +<a name="line-249"></a> <span class="n">_window_set_decorations</span> <span class="p">(</span><span class="n">window</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span> +<a name="line-250"></a> <span class="k">return</span> <span class="n">FALSE</span><span class="p">;</span> +<a name="line-251"></a><span class="p">}</span> +<a name="line-252"></a> +<a name="line-253"></a><span class="k">static</span> <span class="kt">void</span> +<a name="line-254"></a><span class="n">on_window_state_changed</span> <span class="p">(</span><span class="n">WnckWindow</span> <span class="o">*</span><span class="n">window</span><span class="p">,</span> +<a name="line-255"></a> <span class="n">WnckWindowState</span> <span class="n">change_mask</span><span class="p">,</span> +<a name="line-256"></a> <span class="n">WnckWindowState</span> <span class="n">new_state</span><span class="p">,</span> +<a name="line-257"></a> <span class="n">MaximusApp</span> <span class="o">*</span><span class="n">app</span><span class="p">)</span> +<a name="line-258"></a><span class="p">{</span> +<a name="line-259"></a> <span class="n">g_return_if_fail</span> <span class="p">(</span><span class="n">WNCK_IS_WINDOW</span> <span class="p">(</span><span class="n">window</span><span class="p">));</span> +<a name="line-260"></a> +<a name="line-261"></a> <span class="k">if</span> <span class="p">(</span><span class="n">GPOINTER_TO_INT</span> <span class="p">(</span><span class="n">g_object_get_data</span> <span class="p">(</span><span class="n">G_OBJECT</span> <span class="p">(</span><span class="n">window</span><span class="p">),</span> <span class="s">"exclude"</span><span class="p">))</span><span class="o">==</span><span class="mi">1</span><span class="p">)</span> +<a name="line-262"></a> <span class="k">return</span><span class="p">;</span> +<a name="line-263"></a> +<a name="line-264"></a> <span class="k">if</span> <span class="p">(</span><span class="n">change_mask</span> <span class="o">&</span> <span class="n">WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY</span> +<a name="line-265"></a> <span class="o">||</span> <span class="n">change_mask</span> <span class="o">&</span> <span class="n">WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY</span><span class="p">)</span> +<a name="line-266"></a> <span class="p">{</span> +<a name="line-267"></a> <span class="k">if</span> <span class="p">(</span><span class="n">wnck_window_is_maximized</span> <span class="p">(</span><span class="n">window</span><span class="p">)</span> <span class="o">&&</span> <span class="n">app</span><span class="o">-></span><span class="n">priv</span><span class="o">-></span><span class="n">undecorate</span><span class="p">)</span> +<a name="line-268"></a> <span class="p">{</span> +<a name="line-269"></a> <span class="n">g_idle_add</span> <span class="p">((</span><span class="n">GSourceFunc</span><span class="p">)</span><span class="n">on_window_maximised_changed</span><span class="p">,</span> <span class="n">window</span><span class="p">);</span> +<a name="line-270"></a> <span class="p">}</span> +<a name="line-271"></a> <span class="k">else</span> +<a name="line-272"></a> <span class="p">{</span> +<a name="line-273"></a> <span class="n">g_idle_add</span> <span class="p">((</span><span class="n">GSourceFunc</span><span class="p">)</span><span class="n">enable_window_decorations</span><span class="p">,</span> <span class="n">window</span><span class="p">);</span> +<a name="line-274"></a> <span class="p">}</span> +<a name="line-275"></a> <span class="p">}</span> +<a name="line-276"></a><span class="p">}</span> +<a name="line-277"></a> +<a name="line-278"></a><span class="k">static</span> <span class="n">gboolean</span> +<a name="line-279"></a><span class="n">is_excluded</span> <span class="p">(</span><span class="n">MaximusApp</span> <span class="o">*</span><span class="n">app</span><span class="p">,</span> <span class="n">WnckWindow</span> <span class="o">*</span><span class="n">window</span><span class="p">)</span> +<a name="line-280"></a><span class="p">{</span> +<a name="line-281"></a> <span class="n">MaximusAppPrivate</span> <span class="o">*</span><span class="n">priv</span><span class="p">;</span> +<a name="line-282"></a> <span class="n">WnckWindowType</span> <span class="n">type</span><span class="p">;</span> +<a name="line-283"></a> <span class="n">WnckWindowActions</span> <span class="n">actions</span><span class="p">;</span> +<a name="line-284"></a> <span class="n">gchar</span> <span class="o">*</span><span class="n">res_name</span><span class="p">;</span> +<a name="line-285"></a> <span class="n">gchar</span> <span class="o">*</span><span class="n">class_name</span><span class="p">;</span> +<a name="line-286"></a> <span class="n">gint</span> <span class="n">i</span><span class="p">;</span> +<a name="line-287"></a> +<a name="line-288"></a> <span class="n">g_return_val_if_fail</span> <span class="p">(</span><span class="n">MAXIMUS_IS_APP</span> <span class="p">(</span><span class="n">app</span><span class="p">),</span> <span class="n">TRUE</span><span class="p">);</span> +<a name="line-289"></a> <span class="n">g_return_val_if_fail</span> <span class="p">(</span><span class="n">WNCK_IS_WINDOW</span> <span class="p">(</span><span class="n">window</span><span class="p">),</span> <span class="n">TRUE</span><span class="p">);</span> +<a name="line-290"></a> <span class="n">priv</span> <span class="o">=</span> <span class="n">app</span><span class="o">-></span><span class="n">priv</span><span class="p">;</span> +<a name="line-291"></a> +<a name="line-292"></a> <span class="n">type</span> <span class="o">=</span> <span class="n">wnck_window_get_window_type</span> <span class="p">(</span><span class="n">window</span><span class="p">);</span> +<a name="line-293"></a> <span class="k">if</span> <span class="p">(</span><span class="n">type</span> <span class="o">!=</span> <span class="n">WNCK_WINDOW_NORMAL</span><span class="p">)</span> +<a name="line-294"></a> <span class="k">return</span> <span class="n">TRUE</span><span class="p">;</span> +<a name="line-295"></a> +<a name="line-296"></a> <span class="k">if</span> <span class="p">(</span><span class="n">GPOINTER_TO_INT</span> <span class="p">(</span><span class="n">g_object_get_data</span> <span class="p">(</span><span class="n">G_OBJECT</span> <span class="p">(</span><span class="n">window</span><span class="p">),</span> <span class="s">"exclude"</span><span class="p">))</span><span class="o">==</span><span class="mi">1</span><span class="p">)</span> +<a name="line-297"></a> <span class="k">return</span> <span class="n">TRUE</span><span class="p">;</span> +<a name="line-298"></a> +<a name="line-299"></a> <span class="cm">/* Ignore if the window is already fullscreen */</span> +<a name="line-300"></a> <span class="k">if</span> <span class="p">(</span><span class="n">wnck_window_is_fullscreen</span> <span class="p">(</span><span class="n">window</span><span class="p">))</span> +<a name="line-301"></a> <span class="p">{</span> +<a name="line-302"></a> <span class="n">g_debug</span> <span class="p">(</span><span class="s">"Excluding (is fullscreen): %s</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span><span class="n">wnck_window_get_name</span> <span class="p">(</span><span class="n">window</span><span class="p">));</span> +<a name="line-303"></a> <span class="k">return</span> <span class="n">TRUE</span><span class="p">;</span> +<a name="line-304"></a> <span class="p">}</span> +<a name="line-305"></a> +<a name="line-306"></a> <span class="cm">/* Make sure the window supports maximising */</span> +<a name="line-307"></a> <span class="n">actions</span> <span class="o">=</span> <span class="n">wnck_window_get_actions</span> <span class="p">(</span><span class="n">window</span><span class="p">);</span> +<a name="line-308"></a> <span class="k">if</span> <span class="p">(</span><span class="n">actions</span> <span class="o">&</span> <span class="n">WNCK_WINDOW_ACTION_RESIZE</span> +<a name="line-309"></a> <span class="o">&&</span> <span class="n">actions</span> <span class="o">&</span> <span class="n">WNCK_WINDOW_ACTION_MAXIMIZE_HORIZONTALLY</span> +<a name="line-310"></a> <span class="o">&&</span> <span class="n">actions</span> <span class="o">&</span> <span class="n">WNCK_WINDOW_ACTION_MAXIMIZE_VERTICALLY</span> +<a name="line-311"></a> <span class="o">&&</span> <span class="n">actions</span> <span class="o">&</span> <span class="n">WNCK_WINDOW_ACTION_MAXIMIZE</span><span class="p">)</span> +<a name="line-312"></a> <span class="p">;</span> <span class="cm">/* Is good to maximise */</span> +<a name="line-313"></a> <span class="k">else</span> +<a name="line-314"></a> <span class="k">return</span> <span class="n">TRUE</span><span class="p">;</span> +<a name="line-315"></a> +<a name="line-316"></a> <span class="n">_wnck_get_wmclass</span> <span class="p">(</span><span class="n">wnck_window_get_xid</span> <span class="p">(</span><span class="n">window</span><span class="p">),</span> <span class="o">&</span><span class="n">res_name</span><span class="p">,</span> <span class="o">&</span><span class="n">class_name</span><span class="p">);</span> +<a name="line-317"></a> +<a name="line-318"></a> <span class="n">g_debug</span> <span class="p">(</span><span class="s">"Window opened: res_name=%s -- class_name=%s"</span><span class="p">,</span> <span class="n">res_name</span><span class="p">,</span> <span class="n">class_name</span><span class="p">);</span> +<a name="line-319"></a> +<a name="line-320"></a> <span class="cm">/* Check internal list of class_ids */</span> +<a name="line-321"></a> <span class="k">for</span> <span class="p">(</span><span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">G_N_ELEMENTS</span> <span class="p">(</span><span class="n">default_exclude_classes</span><span class="p">);</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> +<a name="line-322"></a> <span class="p">{</span> +<a name="line-323"></a> <span class="k">if</span> <span class="p">((</span><span class="n">class_name</span> <span class="o">&&</span> <span class="n">default_exclude_classes</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> +<a name="line-324"></a> <span class="o">&&</span> <span class="n">strstr</span> <span class="p">(</span><span class="n">class_name</span><span class="p">,</span> <span class="n">default_exclude_classes</span><span class="p">[</span><span class="n">i</span><span class="p">]))</span> +<a name="line-325"></a> <span class="o">||</span> <span class="p">(</span><span class="n">res_name</span> <span class="o">&&</span> <span class="n">default_exclude_classes</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">&&</span> <span class="n">strstr</span> <span class="p">(</span><span class="n">res_name</span><span class="p">,</span> +<a name="line-326"></a> <span class="n">default_exclude_classes</span><span class="p">[</span><span class="n">i</span><span class="p">])))</span> +<a name="line-327"></a> <span class="p">{</span> +<a name="line-328"></a> <span class="n">g_debug</span> <span class="p">(</span><span class="s">"Excluding: %s</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">wnck_window_get_name</span> <span class="p">(</span><span class="n">window</span><span class="p">));</span> +<a name="line-329"></a> <span class="k">return</span> <span class="n">TRUE</span><span class="p">;</span> +<a name="line-330"></a> <span class="p">}</span> +<a name="line-331"></a> <span class="p">}</span> +<a name="line-332"></a> +<a name="line-333"></a> <span class="cm">/* Check user list */</span> +<a name="line-334"></a> <span class="k">for</span> <span class="p">(</span><span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">priv</span><span class="o">-></span><span class="n">exclude_class_list</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">!=</span> <span class="nb">NULL</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> +<a name="line-335"></a> <span class="p">{</span> +<a name="line-336"></a> <span class="k">if</span> <span class="p">((</span><span class="n">class_name</span> <span class="o">&&</span> <span class="n">strstr</span> <span class="p">(</span><span class="n">class_name</span><span class="p">,</span> <span class="n">priv</span><span class="o">-></span><span class="n">exclude_class_list</span><span class="p">[</span><span class="n">i</span><span class="p">]))</span> +<a name="line-337"></a> <span class="o">||</span> <span class="p">(</span><span class="n">res_name</span> <span class="o">&&</span> <span class="n">strstr</span> <span class="p">(</span><span class="n">res_name</span><span class="p">,</span> <span class="n">priv</span><span class="o">-></span><span class="n">exclude_class_list</span><span class="p">[</span><span class="n">i</span><span class="p">])</span> <span class="p">))</span> +<a name="line-338"></a> <span class="p">{</span> +<a name="line-339"></a> <span class="n">g_debug</span> <span class="p">(</span><span class="s">"Excluding: %s</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">wnck_window_get_name</span> <span class="p">(</span><span class="n">window</span><span class="p">));</span> +<a name="line-340"></a> <span class="k">return</span> <span class="n">TRUE</span><span class="p">;</span> +<a name="line-341"></a> <span class="p">}</span> +<a name="line-342"></a> <span class="p">}</span> +<a name="line-343"></a> +<a name="line-344"></a> <span class="n">g_free</span> <span class="p">(</span><span class="n">res_name</span><span class="p">);</span> +<a name="line-345"></a> <span class="n">g_free</span> <span class="p">(</span><span class="n">class_name</span><span class="p">);</span> +<a name="line-346"></a> <span class="k">return</span> <span class="n">FALSE</span><span class="p">;</span> +<a name="line-347"></a><span class="p">}</span> +<a name="line-348"></a> +<a name="line-349"></a><span class="k">extern</span> <span class="n">gboolean</span> <span class="n">no_maximize</span><span class="p">;</span> +<a name="line-350"></a> +<a name="line-351"></a><span class="k">static</span> <span class="kt">void</span> +<a name="line-352"></a><span class="n">on_window_opened</span> <span class="p">(</span><span class="n">WnckScreen</span> <span class="o">*</span><span class="n">screen</span><span class="p">,</span> +<a name="line-353"></a> <span class="n">WnckWindow</span> <span class="o">*</span><span class="n">window</span><span class="p">,</span> +<a name="line-354"></a> <span class="n">MaximusApp</span> <span class="o">*</span><span class="n">app</span><span class="p">)</span> +<a name="line-355"></a><span class="p">{</span> +<a name="line-356"></a> <span class="n">MaximusAppPrivate</span> <span class="o">*</span><span class="n">priv</span><span class="p">;</span> +<a name="line-357"></a> <span class="n">WnckWindowType</span> <span class="n">type</span><span class="p">;</span> +<a name="line-358"></a> <span class="n">gint</span> <span class="n">exclude</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-359"></a> <span class="n">GdkDisplay</span> <span class="o">*</span><span class="n">gdk_display</span> <span class="o">=</span> <span class="n">gdk_display_get_default</span> <span class="p">();</span> +<a name="line-360"></a> +<a name="line-361"></a> <span class="n">g_return_if_fail</span> <span class="p">(</span><span class="n">MAXIMUS_IS_APP</span> <span class="p">(</span><span class="n">app</span><span class="p">));</span> +<a name="line-362"></a> <span class="n">g_return_if_fail</span> <span class="p">(</span><span class="n">WNCK_IS_WINDOW</span> <span class="p">(</span><span class="n">window</span><span class="p">));</span> +<a name="line-363"></a> <span class="n">priv</span> <span class="o">=</span> <span class="n">app</span><span class="o">-></span><span class="n">priv</span><span class="p">;</span> +<a name="line-364"></a> +<a name="line-365"></a> <span class="n">type</span> <span class="o">=</span> <span class="n">wnck_window_get_window_type</span> <span class="p">(</span><span class="n">window</span><span class="p">);</span> +<a name="line-366"></a> <span class="k">if</span> <span class="p">(</span><span class="n">type</span> <span class="o">!=</span> <span class="n">WNCK_WINDOW_NORMAL</span><span class="p">)</span> +<a name="line-367"></a> <span class="k">return</span><span class="p">;</span> +<a name="line-368"></a> +<a name="line-369"></a> <span class="cm">/* Ignore undecorated windows */</span> +<a name="line-370"></a> <span class="n">gdk_x11_display_error_trap_push</span> <span class="p">(</span><span class="n">gdk_display</span><span class="p">);</span> +<a name="line-371"></a> <span class="n">exclude</span> <span class="o">=</span> <span class="n">wnck_window_is_decorated</span> <span class="p">(</span><span class="n">window</span><span class="p">)</span> <span class="o">?</span> <span class="mi">0</span> <span class="o">:</span> <span class="mi">1</span><span class="p">;</span> +<a name="line-372"></a> <span class="k">if</span> <span class="p">(</span><span class="n">gdk_x11_display_error_trap_pop</span> <span class="p">(</span><span class="n">gdk_display</span><span class="p">))</span> +<a name="line-373"></a> <span class="k">return</span><span class="p">;</span> +<a name="line-374"></a> +<a name="line-375"></a> <span class="k">if</span> <span class="p">(</span><span class="n">wnck_window_is_maximized</span> <span class="p">(</span><span class="n">window</span><span class="p">))</span> +<a name="line-376"></a> <span class="n">exclude</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-377"></a> <span class="n">g_object_set_data</span> <span class="p">(</span><span class="n">G_OBJECT</span> <span class="p">(</span><span class="n">window</span><span class="p">),</span> <span class="s">"exclude"</span><span class="p">,</span> <span class="n">GINT_TO_POINTER</span> <span class="p">(</span><span class="n">exclude</span><span class="p">));</span> +<a name="line-378"></a> +<a name="line-379"></a> <span class="k">if</span> <span class="p">(</span><span class="n">is_excluded</span> <span class="p">(</span><span class="n">app</span><span class="p">,</span> <span class="n">window</span><span class="p">))</span> +<a name="line-380"></a> <span class="p">{</span> +<a name="line-381"></a> <span class="n">g_signal_connect</span> <span class="p">(</span><span class="n">window</span><span class="p">,</span> <span class="s">"state-changed"</span><span class="p">,</span> +<a name="line-382"></a> <span class="n">G_CALLBACK</span> <span class="p">(</span><span class="n">on_window_state_changed</span><span class="p">),</span> <span class="n">app</span><span class="p">);</span> +<a name="line-383"></a> <span class="k">return</span><span class="p">;</span> +<a name="line-384"></a> <span class="p">}</span> +<a name="line-385"></a> +<a name="line-386"></a> <span class="k">if</span> <span class="p">(</span><span class="n">no_maximize</span> <span class="o">||</span> <span class="n">priv</span><span class="o">-></span><span class="n">no_maximize</span><span class="p">)</span> +<a name="line-387"></a> <span class="p">{</span> +<a name="line-388"></a> <span class="k">if</span> <span class="p">(</span><span class="n">wnck_window_is_maximized</span><span class="p">(</span><span class="n">window</span><span class="p">)</span> <span class="o">&&</span> <span class="n">priv</span><span class="o">-></span><span class="n">undecorate</span><span class="p">)</span> +<a name="line-389"></a> <span class="p">{</span> +<a name="line-390"></a> <span class="n">_window_set_decorations</span> <span class="p">(</span><span class="n">window</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span> +<a name="line-391"></a> <span class="n">gdk_display_flush</span> <span class="p">(</span><span class="n">gdk_display</span><span class="p">);</span> +<a name="line-392"></a> <span class="p">}</span> +<a name="line-393"></a> <span class="n">g_signal_connect</span> <span class="p">(</span><span class="n">window</span><span class="p">,</span> <span class="s">"state-changed"</span><span class="p">,</span> +<a name="line-394"></a> <span class="n">G_CALLBACK</span> <span class="p">(</span><span class="n">on_window_state_changed</span><span class="p">),</span> <span class="n">app</span><span class="p">);</span> +<a name="line-395"></a> <span class="k">return</span><span class="p">;</span> +<a name="line-396"></a> <span class="p">}</span> +<a name="line-397"></a> +<a name="line-398"></a> <span class="k">if</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">undecorate</span><span class="p">)</span> +<a name="line-399"></a> <span class="p">{</span> +<a name="line-400"></a> <span class="cm">/* Only undecorate right now if the window is smaller than the screen */</span> +<a name="line-401"></a> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">window_is_too_large_for_screen</span> <span class="p">(</span><span class="n">window</span><span class="p">))</span> +<a name="line-402"></a> <span class="p">{</span> +<a name="line-403"></a> <span class="n">_window_set_decorations</span> <span class="p">(</span><span class="n">window</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span> +<a name="line-404"></a> <span class="n">gdk_display_flush</span> <span class="p">(</span><span class="n">gdk_display</span><span class="p">);</span> +<a name="line-405"></a> <span class="p">}</span> +<a name="line-406"></a> <span class="p">}</span> +<a name="line-407"></a> +<a name="line-408"></a> <span class="n">wnck_window_maximize</span> <span class="p">(</span><span class="n">window</span><span class="p">);</span> +<a name="line-409"></a> +<a name="line-410"></a> <span class="n">g_signal_connect</span> <span class="p">(</span><span class="n">window</span><span class="p">,</span> <span class="s">"state-changed"</span><span class="p">,</span> +<a name="line-411"></a> <span class="n">G_CALLBACK</span> <span class="p">(</span><span class="n">on_window_state_changed</span><span class="p">),</span> <span class="n">app</span><span class="p">);</span> +<a name="line-412"></a><span class="p">}</span> +<a name="line-413"></a> +<a name="line-414"></a><span class="cm">/* GSettings Callbacks */</span> +<a name="line-415"></a><span class="k">static</span> <span class="kt">void</span> +<a name="line-416"></a><span class="n">on_app_no_maximize_changed</span> <span class="p">(</span><span class="n">GSettings</span> <span class="o">*</span><span class="n">settings</span><span class="p">,</span> +<a name="line-417"></a> <span class="n">gchar</span> <span class="o">*</span><span class="n">key</span><span class="p">,</span> +<a name="line-418"></a> <span class="n">MaximusApp</span> <span class="o">*</span><span class="n">app</span><span class="p">)</span> +<a name="line-419"></a><span class="p">{</span> +<a name="line-420"></a> <span class="n">MaximusAppPrivate</span> <span class="o">*</span><span class="n">priv</span><span class="p">;</span> +<a name="line-421"></a> +<a name="line-422"></a> <span class="n">g_return_if_fail</span> <span class="p">(</span><span class="n">MAXIMUS_IS_APP</span> <span class="p">(</span><span class="n">app</span><span class="p">));</span> +<a name="line-423"></a> <span class="n">priv</span> <span class="o">=</span> <span class="n">app</span><span class="o">-></span><span class="n">priv</span><span class="p">;</span> +<a name="line-424"></a> <span class="n">priv</span><span class="o">-></span><span class="n">no_maximize</span> <span class="o">=</span> <span class="n">g_settings_get_boolean</span> <span class="p">(</span><span class="n">settings</span><span class="p">,</span> <span class="n">key</span><span class="p">);</span> +<a name="line-425"></a><span class="p">}</span> +<a name="line-426"></a> +<a name="line-427"></a><span class="k">static</span> <span class="kt">void</span> +<a name="line-428"></a><span class="n">on_exclude_class_changed</span> <span class="p">(</span><span class="n">GSettings</span> <span class="o">*</span><span class="n">settings</span><span class="p">,</span> +<a name="line-429"></a> <span class="n">gchar</span> <span class="o">*</span><span class="n">key</span><span class="p">,</span> +<a name="line-430"></a> <span class="n">MaximusApp</span> <span class="o">*</span><span class="n">app</span><span class="p">)</span> +<a name="line-431"></a><span class="p">{</span> +<a name="line-432"></a> <span class="n">MaximusAppPrivate</span> <span class="o">*</span><span class="n">priv</span><span class="p">;</span> +<a name="line-433"></a> +<a name="line-434"></a> <span class="n">g_return_if_fail</span> <span class="p">(</span><span class="n">MAXIMUS_IS_APP</span> <span class="p">(</span><span class="n">app</span><span class="p">));</span> +<a name="line-435"></a> <span class="n">priv</span> <span class="o">=</span> <span class="n">app</span><span class="o">-></span><span class="n">priv</span><span class="p">;</span> +<a name="line-436"></a> +<a name="line-437"></a> <span class="k">if</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">exclude_class_list</span><span class="p">)</span> +<a name="line-438"></a> <span class="n">g_strfreev</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">exclude_class_list</span><span class="p">);</span> +<a name="line-439"></a> +<a name="line-440"></a> <span class="n">priv</span><span class="o">-></span><span class="n">exclude_class_list</span><span class="o">=</span> <span class="n">g_settings_get_strv</span> <span class="p">(</span><span class="n">settings</span><span class="p">,</span> +<a name="line-441"></a> <span class="n">APP_EXCLUDE_CLASS</span><span class="p">);</span> +<a name="line-442"></a><span class="p">}</span> +<a name="line-443"></a> +<a name="line-444"></a><span class="k">static</span> <span class="n">gboolean</span> +<a name="line-445"></a><span class="n">show_desktop</span> <span class="p">(</span><span class="n">WnckScreen</span> <span class="o">*</span><span class="n">screen</span><span class="p">)</span> +<a name="line-446"></a><span class="p">{</span> +<a name="line-447"></a> <span class="n">g_return_val_if_fail</span> <span class="p">(</span><span class="n">WNCK_IS_SCREEN</span> <span class="p">(</span><span class="n">screen</span><span class="p">),</span> <span class="n">FALSE</span><span class="p">);</span> +<a name="line-448"></a> +<a name="line-449"></a> <span class="n">wnck_screen_toggle_showing_desktop</span> <span class="p">(</span><span class="n">screen</span><span class="p">,</span> <span class="n">TRUE</span><span class="p">);</span> +<a name="line-450"></a> <span class="k">return</span> <span class="n">FALSE</span><span class="p">;</span> +<a name="line-451"></a><span class="p">}</span> +<a name="line-452"></a> +<a name="line-453"></a><span class="k">static</span> <span class="kt">void</span> +<a name="line-454"></a><span class="n">on_app_undecorate_changed</span> <span class="p">(</span><span class="n">GSettings</span> <span class="o">*</span><span class="n">settings</span><span class="p">,</span> +<a name="line-455"></a> <span class="n">gchar</span> <span class="o">*</span><span class="n">key</span><span class="p">,</span> +<a name="line-456"></a> <span class="n">MaximusApp</span> <span class="o">*</span><span class="n">app</span><span class="p">)</span> +<a name="line-457"></a><span class="p">{</span> +<a name="line-458"></a> <span class="n">MaximusAppPrivate</span> <span class="o">*</span><span class="n">priv</span><span class="p">;</span> +<a name="line-459"></a> <span class="n">GList</span> <span class="o">*</span><span class="n">windows</span><span class="p">,</span> <span class="o">*</span><span class="n">w</span><span class="p">;</span> +<a name="line-460"></a> +<a name="line-461"></a> <span class="n">g_return_if_fail</span> <span class="p">(</span><span class="n">MAXIMUS_IS_APP</span> <span class="p">(</span><span class="n">app</span><span class="p">));</span> +<a name="line-462"></a> <span class="n">priv</span> <span class="o">=</span> <span class="n">app</span><span class="o">-></span><span class="n">priv</span><span class="p">;</span> +<a name="line-463"></a> <span class="n">g_return_if_fail</span> <span class="p">(</span><span class="n">WNCK_IS_SCREEN</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">screen</span><span class="p">));</span> +<a name="line-464"></a> +<a name="line-465"></a> <span class="n">priv</span><span class="o">-></span><span class="n">undecorate</span> <span class="o">=</span> <span class="n">g_settings_get_boolean</span> <span class="p">(</span><span class="n">settings</span><span class="p">,</span> <span class="n">APP_UNDECORATE</span><span class="p">);</span> +<a name="line-466"></a> <span class="n">g_debug</span> <span class="p">(</span><span class="s">"%s</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">priv</span><span class="o">-></span><span class="n">undecorate</span> <span class="o">?</span> <span class="s">"Undecorating"</span> <span class="o">:</span> <span class="s">"Decorating"</span><span class="p">);</span> +<a name="line-467"></a> +<a name="line-468"></a> <span class="n">windows</span> <span class="o">=</span> <span class="n">wnck_screen_get_windows</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">screen</span><span class="p">);</span> +<a name="line-469"></a> <span class="k">for</span> <span class="p">(</span><span class="n">w</span> <span class="o">=</span> <span class="n">windows</span><span class="p">;</span> <span class="n">w</span><span class="p">;</span> <span class="n">w</span> <span class="o">=</span> <span class="n">w</span><span class="o">-></span><span class="n">next</span><span class="p">)</span> +<a name="line-470"></a> <span class="p">{</span> +<a name="line-471"></a> <span class="n">WnckWindow</span> <span class="o">*</span><span class="n">window</span> <span class="o">=</span> <span class="n">w</span><span class="o">-></span><span class="n">data</span><span class="p">;</span> +<a name="line-472"></a> +<a name="line-473"></a> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">WNCK_IS_WINDOW</span> <span class="p">(</span><span class="n">window</span><span class="p">))</span> +<a name="line-474"></a> <span class="k">continue</span><span class="p">;</span> +<a name="line-475"></a> +<a name="line-476"></a> <span class="k">if</span> <span class="p">(</span><span class="n">no_maximize</span> <span class="o">||</span> <span class="n">priv</span><span class="o">-></span><span class="n">no_maximize</span><span class="p">)</span> +<a name="line-477"></a> <span class="p">{</span> +<a name="line-478"></a> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">wnck_window_is_maximized</span><span class="p">(</span><span class="n">window</span><span class="p">))</span> +<a name="line-479"></a> <span class="k">continue</span><span class="p">;</span> +<a name="line-480"></a> <span class="p">}</span> +<a name="line-481"></a> +<a name="line-482"></a> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">is_excluded</span> <span class="p">(</span><span class="n">app</span><span class="p">,</span> <span class="n">window</span><span class="p">))</span> +<a name="line-483"></a> <span class="p">{</span> +<a name="line-484"></a> <span class="n">GdkDisplay</span> <span class="o">*</span><span class="n">gdk_display</span> <span class="o">=</span> <span class="n">gdk_display_get_default</span> <span class="p">();</span> +<a name="line-485"></a> +<a name="line-486"></a> <span class="n">gdk_x11_display_error_trap_push</span> <span class="p">(</span><span class="n">gdk_display</span><span class="p">);</span> +<a name="line-487"></a> <span class="n">_window_set_decorations</span> <span class="p">(</span><span class="n">window</span><span class="p">,</span> <span class="n">priv</span><span class="o">-></span><span class="n">undecorate</span> <span class="o">?</span> <span class="mi">0</span> <span class="o">:</span> <span class="mi">1</span><span class="p">);</span> +<a name="line-488"></a> <span class="n">wnck_window_unmaximize</span> <span class="p">(</span><span class="n">window</span><span class="p">);</span> +<a name="line-489"></a> <span class="n">wnck_window_maximize</span> <span class="p">(</span><span class="n">window</span><span class="p">);</span> +<a name="line-490"></a> <span class="n">gdk_display_flush</span> <span class="p">(</span><span class="n">gdk_display</span><span class="p">);</span> +<a name="line-491"></a> <span class="n">gdk_x11_display_error_trap_pop_ignored</span> <span class="p">(</span><span class="n">gdk_display</span><span class="p">);</span> +<a name="line-492"></a> +<a name="line-493"></a> <span class="n">sleep</span> <span class="p">(</span><span class="mi">1</span><span class="p">);</span> +<a name="line-494"></a> <span class="p">}</span> +<a name="line-495"></a> <span class="p">}</span> +<a name="line-496"></a> <span class="cm">/* We want the user to be left on the launcher/desktop after switching modes*/</span> +<a name="line-497"></a> <span class="n">g_timeout_add_seconds</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="p">(</span><span class="n">GSourceFunc</span><span class="p">)</span><span class="n">show_desktop</span><span class="p">,</span> <span class="n">priv</span><span class="o">-></span><span class="n">screen</span><span class="p">);</span> +<a name="line-498"></a><span class="p">}</span> +<a name="line-499"></a> +<a name="line-500"></a> +<a name="line-501"></a><span class="cm">/* GObject stuff */</span> +<a name="line-502"></a><span class="k">static</span> <span class="kt">void</span> +<a name="line-503"></a><span class="n">maximus_app_class_init</span> <span class="p">(</span><span class="n">MaximusAppClass</span> <span class="o">*</span><span class="n">klass</span><span class="p">)</span> +<a name="line-504"></a><span class="p">{</span> +<a name="line-505"></a><span class="p">}</span> +<a name="line-506"></a> +<a name="line-507"></a><span class="k">static</span> <span class="kt">void</span> +<a name="line-508"></a><span class="n">maximus_app_init</span> <span class="p">(</span><span class="n">MaximusApp</span> <span class="o">*</span><span class="n">app</span><span class="p">)</span> +<a name="line-509"></a><span class="p">{</span> +<a name="line-510"></a> <span class="n">MaximusAppPrivate</span> <span class="o">*</span><span class="n">priv</span><span class="p">;</span> +<a name="line-511"></a> <span class="n">WnckScreen</span> <span class="o">*</span><span class="n">screen</span><span class="p">;</span> +<a name="line-512"></a> +<a name="line-513"></a> <span class="n">priv</span> <span class="o">=</span> <span class="n">app</span><span class="o">-></span><span class="n">priv</span> <span class="o">=</span> <span class="n">maximus_app_get_instance_private</span> <span class="p">(</span><span class="n">app</span><span class="p">);</span> +<a name="line-514"></a> +<a name="line-515"></a> <span class="n">priv</span><span class="o">-></span><span class="n">bind</span> <span class="o">=</span> <span class="n">maximus_bind_get_default</span> <span class="p">();</span> +<a name="line-516"></a> +<a name="line-517"></a> <span class="n">was_decorated</span> <span class="o">=</span> <span class="n">g_quark_from_static_string</span> <span class="p">(</span><span class="s">"was-decorated"</span><span class="p">);</span> +<a name="line-518"></a> +<a name="line-519"></a> <span class="n">priv</span><span class="o">-></span><span class="n">settings</span> <span class="o">=</span> <span class="n">g_settings_new</span> <span class="p">(</span><span class="n">APP_SCHEMA</span><span class="p">);</span> +<a name="line-520"></a> +<a name="line-521"></a> <span class="n">g_signal_connect</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">settings</span><span class="p">,</span> <span class="s">"changed::"</span> <span class="n">APP_EXCLUDE_CLASS</span><span class="p">,</span> +<a name="line-522"></a> <span class="n">G_CALLBACK</span> <span class="p">(</span><span class="n">on_exclude_class_changed</span><span class="p">),</span> <span class="n">app</span><span class="p">);</span> +<a name="line-523"></a> <span class="n">g_signal_connect</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">settings</span><span class="p">,</span> <span class="s">"changed::"</span> <span class="n">APP_UNDECORATE</span><span class="p">,</span> +<a name="line-524"></a> <span class="n">G_CALLBACK</span> <span class="p">(</span><span class="n">on_app_undecorate_changed</span><span class="p">),</span> <span class="n">app</span><span class="p">);</span> +<a name="line-525"></a> <span class="n">g_signal_connect</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">settings</span><span class="p">,</span> <span class="s">"changed::"</span> <span class="n">APP_NO_MAXIMIZE</span><span class="p">,</span> +<a name="line-526"></a> <span class="n">G_CALLBACK</span> <span class="p">(</span><span class="n">on_app_no_maximize_changed</span><span class="p">),</span> <span class="n">app</span><span class="p">);</span> +<a name="line-527"></a> +<a name="line-528"></a> <span class="n">priv</span><span class="o">-></span><span class="n">exclude_class_list</span> <span class="o">=</span> <span class="n">g_settings_get_strv</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">settings</span><span class="p">,</span> <span class="n">APP_EXCLUDE_CLASS</span><span class="p">);</span> +<a name="line-529"></a> <span class="n">priv</span><span class="o">-></span><span class="n">undecorate</span> <span class="o">=</span> <span class="n">g_settings_get_boolean</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">settings</span><span class="p">,</span> <span class="n">APP_UNDECORATE</span><span class="p">);</span> +<a name="line-530"></a> <span class="n">priv</span><span class="o">-></span><span class="n">no_maximize</span> <span class="o">=</span> <span class="n">g_settings_get_boolean</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">settings</span><span class="p">,</span> <span class="n">APP_NO_MAXIMIZE</span><span class="p">);</span> +<a name="line-531"></a> <span class="n">g_print</span> <span class="p">(</span><span class="s">"no maximize: %s</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">priv</span><span class="o">-></span><span class="n">no_maximize</span> <span class="o">?</span> <span class="s">"true"</span> <span class="o">:</span> <span class="s">"false"</span><span class="p">);</span> +<a name="line-532"></a> +<a name="line-533"></a> <span class="n">priv</span><span class="o">-></span><span class="n">screen</span> <span class="o">=</span> <span class="n">screen</span> <span class="o">=</span> <span class="n">wnck_screen_get_default</span> <span class="p">();</span> +<a name="line-534"></a> <span class="n">g_signal_connect</span> <span class="p">(</span><span class="n">screen</span><span class="p">,</span> <span class="s">"window-opened"</span><span class="p">,</span> +<a name="line-535"></a> <span class="n">G_CALLBACK</span> <span class="p">(</span><span class="n">on_window_opened</span><span class="p">),</span> <span class="n">app</span><span class="p">);</span> +<a name="line-536"></a><span class="p">}</span> +<a name="line-537"></a> +<a name="line-538"></a><span class="n">MaximusApp</span> <span class="o">*</span> +<a name="line-539"></a><span class="n">maximus_app_get_default</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span> +<a name="line-540"></a> +<a name="line-541"></a><span class="p">{</span> +<a name="line-542"></a> <span class="k">static</span> <span class="n">MaximusApp</span> <span class="o">*</span><span class="n">app</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span> +<a name="line-543"></a> +<a name="line-544"></a> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">app</span><span class="p">)</span> +<a name="line-545"></a> <span class="n">app</span> <span class="o">=</span> <span class="n">g_object_new</span> <span class="p">(</span><span class="n">MAXIMUS_TYPE_APP</span><span class="p">,</span> +<a name="line-546"></a> <span class="nb">NULL</span><span class="p">);</span> +<a name="line-547"></a> +<a name="line-548"></a> <span class="k">return</span> <span class="n">app</span><span class="p">;</span> +<a name="line-549"></a><span class="p">}</span> +</pre></div> +</td></tr></table> + </div> <!-- /.wrapper --> + </div> + <div id="footer" class="footer"> + <p> + Cppcheck 2.3 - a tool for static C/C++ code analysis<br> + <br> + Internet: <a href="http://cppcheck.net">http://cppcheck.net</a><br> + IRC: <a href="irc://irc.freenode.net/cppcheck">irc://irc.freenode.net/cppcheck</a><br> + </p> + </div> + </body> +</html> diff --git a/2021-06-21-213330-4389-cppcheck@e2f7cfd5fc80_master/3.html b/2021-06-21-213330-4389-cppcheck@e2f7cfd5fc80_master/3.html new file mode 100644 index 0000000..8cf3f42 --- /dev/null +++ b/2021-06-21-213330-4389-cppcheck@e2f7cfd5fc80_master/3.html @@ -0,0 +1,1169 @@ + +<!doctype html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>Cppcheck - HTML report - mate-netbook</title> + <link rel="stylesheet" href="style.css"> + <style> +pre { line-height: 125%; } +td.linenos pre { color: #000000; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; } +span.linenos { color: #000000; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; } +td.linenos pre.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +.highlight .hll { background-color: #ffffcc } +.highlight { background: #ffffff; } +.highlight .c { color: #888888 } /* Comment */ +.highlight .err { color: #FF0000; background-color: #FFAAAA } /* Error */ +.highlight .k { color: #008800; font-weight: bold } /* Keyword */ +.highlight .o { color: #333333 } /* Operator */ +.highlight .ch { color: #888888 } /* Comment.Hashbang */ +.highlight .cm { color: #888888 } /* Comment.Multiline */ +.highlight .cp { color: #557799 } /* Comment.Preproc */ +.highlight .cpf { color: #888888 } /* Comment.PreprocFile */ +.highlight .c1 { color: #888888 } /* Comment.Single */ +.highlight .cs { color: #cc0000; font-weight: bold } /* Comment.Special */ +.highlight .gd { color: #A00000 } /* Generic.Deleted */ +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .gr { color: #FF0000 } /* Generic.Error */ +.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.highlight .gi { color: #00A000 } /* Generic.Inserted */ +.highlight .go { color: #888888 } /* Generic.Output */ +.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.highlight .gt { color: #0044DD } /* Generic.Traceback */ +.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ +.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { color: #003388; font-weight: bold } /* Keyword.Pseudo */ +.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #333399; font-weight: bold } /* Keyword.Type */ +.highlight .m { color: #6600EE; font-weight: bold } /* Literal.Number */ +.highlight .s { background-color: #fff0f0 } /* Literal.String */ +.highlight .na { color: #0000CC } /* Name.Attribute */ +.highlight .nb { color: #007020 } /* Name.Builtin */ +.highlight .nc { color: #BB0066; font-weight: bold } /* Name.Class */ +.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ +.highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ +.highlight .ni { color: #880000; font-weight: bold } /* Name.Entity */ +.highlight .ne { color: #FF0000; font-weight: bold } /* Name.Exception */ +.highlight .nf { color: #0066BB; font-weight: bold } /* Name.Function */ +.highlight .nl { color: #997700; font-weight: bold } /* Name.Label */ +.highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ +.highlight .nt { color: #007700 } /* Name.Tag */ +.highlight .nv { color: #996633 } /* Name.Variable */ +.highlight .ow { color: #000000; font-weight: bold } /* Operator.Word */ +.highlight .w { color: #bbbbbb } /* Text.Whitespace */ +.highlight .mb { color: #6600EE; font-weight: bold } /* Literal.Number.Bin */ +.highlight .mf { color: #6600EE; font-weight: bold } /* Literal.Number.Float */ +.highlight .mh { color: #005588; font-weight: bold } /* Literal.Number.Hex */ +.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ +.highlight .mo { color: #4400EE; font-weight: bold } /* Literal.Number.Oct */ +.highlight .sa { background-color: #fff0f0 } /* Literal.String.Affix */ +.highlight .sb { background-color: #fff0f0 } /* Literal.String.Backtick */ +.highlight .sc { color: #0044DD } /* Literal.String.Char */ +.highlight .dl { background-color: #fff0f0 } /* Literal.String.Delimiter */ +.highlight .sd { color: #DD4422 } /* Literal.String.Doc */ +.highlight .s2 { background-color: #fff0f0 } /* Literal.String.Double */ +.highlight .se { color: #666666; font-weight: bold; background-color: #fff0f0 } /* Literal.String.Escape */ +.highlight .sh { background-color: #fff0f0 } /* Literal.String.Heredoc */ +.highlight .si { background-color: #eeeeee } /* Literal.String.Interpol */ +.highlight .sx { color: #DD2200; background-color: #fff0f0 } /* Literal.String.Other */ +.highlight .sr { color: #000000; background-color: #fff0ff } /* Literal.String.Regex */ +.highlight .s1 { background-color: #fff0f0 } /* Literal.String.Single */ +.highlight .ss { color: #AA6600 } /* Literal.String.Symbol */ +.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ +.highlight .fm { color: #0066BB; font-weight: bold } /* Name.Function.Magic */ +.highlight .vc { color: #336699 } /* Name.Variable.Class */ +.highlight .vg { color: #dd7700; font-weight: bold } /* Name.Variable.Global */ +.highlight .vi { color: #3333BB } /* Name.Variable.Instance */ +.highlight .vm { color: #996633 } /* Name.Variable.Magic */ +.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ + </style> + <script> + function getStyle(el, styleProp) { + var y; + + if (el.currentStyle) { + y = el.currentStyle[styleProp]; + } else if (window.getComputedStyle) { + y = document.defaultView.getComputedStyle(el, null).getPropertyValue(styleProp); + } + + return y; + } + + function toggle() { + var el = this.expandable_content; + var mark = this.expandable_marker; + + if (el.style.display === "block") { + el.style.display = "none"; + mark.textContent = "[+]"; + } else { + el.style.display = "block"; + mark.textContent = "[-]"; + } + } + + function initExpandables() { + var elements = document.querySelectorAll(".expandable"); + + for (var i = 0, len = elements.length; i < len; i++) { + var el = elements[i]; + var clickable = el.querySelector("span"); + var marker = clickable.querySelector(".marker"); + var content = el.querySelector(".content"); + var width = clickable.clientWidth - parseInt(getStyle(content, "padding-left")) - parseInt(getStyle(content, "padding-right")); + content.style.width = width + "px"; + clickable.expandable_content = content; + clickable.expandable_marker = marker; + clickable.addEventListener("click", toggle); + } + } + + function toggleDisplay(id) { + var elements = document.querySelectorAll("." + id); + + for (var i = 0, len = elements.length; i < len; i++) { + elements[i].classList.toggle("d-none"); + } + } + + function toggleAll() { + var elements = document.querySelectorAll("input"); + + // starting from 1 since 0 is the "toggle all" input + for (var i = 1, len = elements.length; i < len; i++) { + var el = elements[i]; + + if (el.checked) { + el.checked = false; + } else { + el.checked = true; + } + + toggleDisplay(el.id); + } + } + window.addEventListener("load", initExpandables); + </script> + </head> + <body> + <div id="header" class="header"> + <h1>Cppcheck report - mate-netbook: maximus/maximus-bind.c</h1> + </div> + <div class="wrapper"> + <div id="menu"> + <p id="filename"><a href="index.html">Defects:</a> maximus-bind.c</p> +<a href="3.html#line-144"> unreadVariable 144</a><a href="3.html#line-203"> unreadVariable 203</a><a href="3.html#line-218"> unreadVariable 218</a><a href="3.html#line-276"> unreadVariable 276</a><a href="3.html#line-402"> unreadVariable 402</a> + </div> + <div id="content"> +<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 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</pre></div></td><td class="code"><div class="highlight"><pre><span></span><a name="line-1"></a><span class="cm">/*</span> +<a name="line-2"></a><span class="cm"> * Copyright (C) 2008 Canonical Ltd</span> +<a name="line-3"></a><span class="cm"> * Copyright (C) 2012-2021 MATE Developers</span> +<a name="line-4"></a><span class="cm"> *</span> +<a name="line-5"></a><span class="cm"> * This program is free software: you can redistribute it and/or modify</span> +<a name="line-6"></a><span class="cm"> * it under the terms of the GNU General Public License version 3 as</span> +<a name="line-7"></a><span class="cm"> * published by the Free Software Foundation.</span> +<a name="line-8"></a><span class="cm"> *</span> +<a name="line-9"></a><span class="cm"> * This program is distributed in the hope that it will be useful,</span> +<a name="line-10"></a><span class="cm"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span> +<a name="line-11"></a><span class="cm"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span> +<a name="line-12"></a><span class="cm"> * GNU General Public License for more details.</span> +<a name="line-13"></a><span class="cm"> *</span> +<a name="line-14"></a><span class="cm"> * You should have received a copy of the GNU General Public License</span> +<a name="line-15"></a><span class="cm"> * along with this program. If not, see <http://www.gnu.org/licenses/>.</span> +<a name="line-16"></a><span class="cm"> *</span> +<a name="line-17"></a><span class="cm"> * Authored by Neil Jagdish Patel <[email protected]></span> +<a name="line-18"></a><span class="cm"> *</span> +<a name="line-19"></a><span class="cm"> */</span> +<a name="line-20"></a> +<a name="line-21"></a><span class="cp">#include</span> <span class="cpf"><stdio.h></span><span class="cp"></span> +<a name="line-22"></a><span class="cp">#include</span> <span class="cpf"><string.h></span><span class="cp"></span> +<a name="line-23"></a> +<a name="line-24"></a><span class="cp">#include</span> <span class="cpf"><gtk/gtk.h></span><span class="cp"></span> +<a name="line-25"></a><span class="cp">#include</span> <span class="cpf"><gdk/gdkx.h></span><span class="cp"></span> +<a name="line-26"></a> +<a name="line-27"></a><span class="cp">#include</span> <span class="cpf"><gdk/gdkkeysyms.h></span><span class="cp"></span> +<a name="line-28"></a> +<a name="line-29"></a><span class="cp">#include</span> <span class="cpf"><gio/gio.h></span><span class="cp"></span> +<a name="line-30"></a> +<a name="line-31"></a><span class="cp">#define WNCK_I_KNOW_THIS_IS_UNSTABLE</span> +<a name="line-32"></a><span class="cp">#include</span> <span class="cpf"><libwnck/libwnck.h></span><span class="cp"></span> +<a name="line-33"></a> +<a name="line-34"></a><span class="cp">#include</span> <span class="cpf"><X11/Xlib.h></span><span class="cp"></span> +<a name="line-35"></a><span class="cp">#include</span> <span class="cpf"><X11/Xresource.h></span><span class="cp"></span> +<a name="line-36"></a><span class="cp">#include</span> <span class="cpf"><X11/Xutil.h></span><span class="cp"></span> +<a name="line-37"></a><span class="cp">#include</span> <span class="cpf"><X11/extensions/XTest.h></span><span class="cp"></span> +<a name="line-38"></a><span class="cp">#include</span> <span class="cpf"><X11/keysymdef.h></span><span class="cp"></span> +<a name="line-39"></a><span class="cp">#include</span> <span class="cpf"><X11/keysym.h></span><span class="cp"></span> +<a name="line-40"></a> +<a name="line-41"></a><span class="cp">#include</span> <span class="cpf"><fakekey/fakekey.h></span><span class="cp"></span> +<a name="line-42"></a> +<a name="line-43"></a><span class="cp">#include</span> <span class="cpf">"maximus-bind.h"</span><span class="cp"></span> +<a name="line-44"></a> +<a name="line-45"></a><span class="cp">#include</span> <span class="cpf">"tomboykeybinder.h"</span><span class="cp"></span> +<a name="line-46"></a><span class="cp">#include</span> <span class="cpf">"eggaccelerators.h"</span><span class="cp"></span> +<a name="line-47"></a> +<a name="line-48"></a><span class="cp">#define KEY_RELEASE_TIMEOUT 300</span> +<a name="line-49"></a><span class="cp">#define STATE_CHANGED_SLEEP 0.5</span> +<a name="line-50"></a> +<a name="line-51"></a><span class="cm">/* GSettings schemas and keys */</span> +<a name="line-52"></a><span class="cp">#define BIND_SCHEMA "org.mate.maximus"</span> +<a name="line-53"></a><span class="cp">#define BIND_EXCLUDE_CLASS "binding"</span> +<a name="line-54"></a> +<a name="line-55"></a><span class="cp">#define SYSRULESDIR SYSCONFDIR"/maximus"</span> +<a name="line-56"></a> +<a name="line-57"></a><span class="cp">#ifdef __GNUC__</span> +<a name="line-58"></a><span class="cp">#define UNUSED_VARIABLE __attribute__ ((unused))</span> +<a name="line-59"></a><span class="cp">#else</span> +<a name="line-60"></a><span class="cp">#define UNUSED_VARIABLE</span> +<a name="line-61"></a><span class="cp">#endif</span> +<a name="line-62"></a> +<a name="line-63"></a><span class="k">struct</span> <span class="nc">_MaximusBindPrivate</span> +<a name="line-64"></a><span class="p">{</span> +<a name="line-65"></a> <span class="n">FakeKey</span> <span class="o">*</span><span class="n">fk</span><span class="p">;</span> +<a name="line-66"></a> <span class="n">WnckScreen</span> <span class="o">*</span><span class="n">screen</span><span class="p">;</span> +<a name="line-67"></a> <span class="n">GSettings</span> <span class="o">*</span><span class="n">settings</span><span class="p">;</span> +<a name="line-68"></a> +<a name="line-69"></a> <span class="n">gchar</span> <span class="o">*</span><span class="n">binding</span><span class="p">;</span> +<a name="line-70"></a> +<a name="line-71"></a> <span class="n">GList</span> <span class="o">*</span><span class="n">rules</span><span class="p">;</span> +<a name="line-72"></a><span class="p">};</span> +<a name="line-73"></a> +<a name="line-74"></a><span class="k">typedef</span> <span class="k">struct</span> +<a name="line-75"></a><span class="p">{</span> +<a name="line-76"></a> <span class="n">gchar</span> <span class="o">*</span><span class="n">wm_class</span><span class="p">;</span> +<a name="line-77"></a> <span class="n">gchar</span> <span class="o">*</span><span class="n">fullscreen</span><span class="p">;</span> +<a name="line-78"></a> <span class="n">gchar</span> <span class="o">*</span><span class="n">unfullscreen</span><span class="p">;</span> +<a name="line-79"></a><span class="p">}</span> <span class="n">MaximusRule</span><span class="p">;</span> +<a name="line-80"></a> +<a name="line-81"></a><span class="n">G_DEFINE_TYPE_WITH_PRIVATE</span> <span class="p">(</span><span class="n">MaximusBind</span><span class="p">,</span> <span class="n">maximus_bind</span><span class="p">,</span> <span class="n">G_TYPE_OBJECT</span><span class="p">);</span> +<a name="line-82"></a> +<a name="line-83"></a><span class="k">static</span> <span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span> +<a name="line-84"></a><span class="n">get_fullscreen_keystroke</span> <span class="p">(</span><span class="n">GList</span> <span class="o">*</span><span class="n">rules</span><span class="p">,</span> <span class="n">WnckWindow</span> <span class="o">*</span><span class="n">window</span><span class="p">)</span> +<a name="line-85"></a><span class="p">{</span> +<a name="line-86"></a> <span class="n">WnckClassGroup</span> <span class="o">*</span><span class="n">group</span><span class="p">;</span> +<a name="line-87"></a> <span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">class_name</span><span class="p">;</span> +<a name="line-88"></a> <span class="n">GList</span> <span class="o">*</span><span class="n">r</span><span class="p">;</span> +<a name="line-89"></a> +<a name="line-90"></a> <span class="n">group</span> <span class="o">=</span> <span class="n">wnck_window_get_class_group</span> <span class="p">(</span><span class="n">window</span><span class="p">);</span> +<a name="line-91"></a> <span class="n">class_name</span> <span class="o">=</span> <span class="n">wnck_class_group_get_name</span> <span class="p">(</span><span class="n">group</span><span class="p">);</span> +<a name="line-92"></a> +<a name="line-93"></a> <span class="n">g_debug</span> <span class="p">(</span><span class="s">"Searching rules for %s:</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">wnck_window_get_name</span> <span class="p">(</span><span class="n">window</span><span class="p">));</span> +<a name="line-94"></a> +<a name="line-95"></a> <span class="k">for</span> <span class="p">(</span><span class="n">r</span> <span class="o">=</span> <span class="n">rules</span><span class="p">;</span> <span class="n">r</span><span class="p">;</span> <span class="n">r</span> <span class="o">=</span> <span class="n">r</span><span class="o">-></span><span class="n">next</span><span class="p">)</span> +<a name="line-96"></a> <span class="p">{</span> +<a name="line-97"></a> <span class="n">MaximusRule</span> <span class="o">*</span><span class="n">rule</span> <span class="o">=</span> <span class="n">r</span><span class="o">-></span><span class="n">data</span><span class="p">;</span> +<a name="line-98"></a> +<a name="line-99"></a> <span class="n">g_debug</span> <span class="p">(</span><span class="s">"</span><span class="se">\t</span><span class="s">%s ?= %s"</span><span class="p">,</span> <span class="n">class_name</span><span class="p">,</span> <span class="n">rule</span><span class="o">-></span><span class="n">wm_class</span><span class="p">);</span> +<a name="line-100"></a> +<a name="line-101"></a> <span class="k">if</span> <span class="p">(</span><span class="n">class_name</span> <span class="o">&&</span> <span class="n">rule</span><span class="o">-></span><span class="n">wm_class</span> <span class="o">&&</span> <span class="n">strstr</span> <span class="p">(</span><span class="n">class_name</span><span class="p">,</span> <span class="n">rule</span><span class="o">-></span><span class="n">wm_class</span><span class="p">))</span> +<a name="line-102"></a> <span class="p">{</span> +<a name="line-103"></a> <span class="n">g_debug</span> <span class="p">(</span><span class="s">"</span><span class="se">\t</span><span class="s">YES!</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span> +<a name="line-104"></a> <span class="k">return</span> <span class="n">rule</span><span class="o">-></span><span class="n">fullscreen</span><span class="p">;</span> +<a name="line-105"></a> <span class="p">}</span> +<a name="line-106"></a> <span class="n">g_debug</span> <span class="p">(</span><span class="s">"</span><span class="se">\t</span><span class="s">NO!</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span> +<a name="line-107"></a> <span class="p">}</span> +<a name="line-108"></a> +<a name="line-109"></a> <span class="k">return</span> <span class="nb">NULL</span><span class="p">;</span> +<a name="line-110"></a><span class="p">}</span> +<a name="line-111"></a> +<a name="line-112"></a><span class="k">static</span> <span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span> +<a name="line-113"></a><span class="n">get_unfullscreen_keystroke</span> <span class="p">(</span><span class="n">GList</span> <span class="o">*</span><span class="n">rules</span><span class="p">,</span> <span class="n">WnckWindow</span> <span class="o">*</span><span class="n">window</span><span class="p">)</span> +<a name="line-114"></a><span class="p">{</span> +<a name="line-115"></a> <span class="n">WnckClassGroup</span> <span class="o">*</span><span class="n">group</span><span class="p">;</span> +<a name="line-116"></a> <span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">class_name</span><span class="p">;</span> +<a name="line-117"></a> <span class="n">GList</span> <span class="o">*</span><span class="n">r</span><span class="p">;</span> +<a name="line-118"></a> +<a name="line-119"></a> <span class="n">group</span> <span class="o">=</span> <span class="n">wnck_window_get_class_group</span> <span class="p">(</span><span class="n">window</span><span class="p">);</span> +<a name="line-120"></a> <span class="n">class_name</span> <span class="o">=</span> <span class="n">wnck_class_group_get_name</span> <span class="p">(</span><span class="n">group</span><span class="p">);</span> +<a name="line-121"></a> +<a name="line-122"></a> <span class="k">for</span> <span class="p">(</span><span class="n">r</span> <span class="o">=</span> <span class="n">rules</span><span class="p">;</span> <span class="n">r</span><span class="p">;</span> <span class="n">r</span> <span class="o">=</span> <span class="n">r</span><span class="o">-></span><span class="n">next</span><span class="p">)</span> +<a name="line-123"></a> <span class="p">{</span> +<a name="line-124"></a> <span class="n">MaximusRule</span> <span class="o">*</span><span class="n">rule</span> <span class="o">=</span> <span class="n">r</span><span class="o">-></span><span class="n">data</span><span class="p">;</span> +<a name="line-125"></a> +<a name="line-126"></a> <span class="k">if</span> <span class="p">(</span><span class="n">class_name</span> <span class="o">&&</span> <span class="n">rule</span><span class="o">-></span><span class="n">wm_class</span> <span class="o">&&</span> <span class="n">strstr</span> <span class="p">(</span><span class="n">class_name</span><span class="p">,</span> <span class="n">rule</span><span class="o">-></span><span class="n">wm_class</span><span class="p">))</span> +<a name="line-127"></a> <span class="p">{</span> +<a name="line-128"></a> <span class="k">return</span> <span class="n">rule</span><span class="o">-></span><span class="n">unfullscreen</span><span class="p">;</span> +<a name="line-129"></a> <span class="p">}</span> +<a name="line-130"></a> <span class="p">}</span> +<a name="line-131"></a> +<a name="line-132"></a> <span class="k">return</span> <span class="nb">NULL</span><span class="p">;</span> +<a name="line-133"></a><span class="p">}</span> +<a name="line-134"></a><span class="k">static</span> <span class="n">gboolean</span> +<a name="line-135"></a><span class="n">real_fullscreen</span> <span class="p">(</span><span class="n">MaximusBind</span> <span class="o">*</span><span class="n">bind</span><span class="p">)</span> +<a name="line-136"></a><span class="p">{</span> +<a name="line-137"></a> <span class="n">MaximusBindPrivate</span> <span class="o">*</span><span class="n">priv</span><span class="p">;</span> +<a name="line-138"></a> <span class="n">GdkDisplay</span> <span class="n">UNUSED_VARIABLE</span> <span class="o">*</span><span class="n">display</span><span class="p">;</span> +<a name="line-139"></a> <span class="n">WnckWindow</span> <span class="o">*</span><span class="n">active</span><span class="p">;</span> +<a name="line-140"></a> <span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">keystroke</span><span class="p">;</span> +<a name="line-141"></a> +<a name="line-142"></a> <span class="n">priv</span> <span class="o">=</span> <span class="n">bind</span><span class="o">-></span><span class="n">priv</span><span class="p">;</span> +<a name="line-143"></a> +<a name="line-144"></a><span class="hll"> <span class="n">display</span> <span class="o">=</span> <span class="n">gdk_display_get_default</span> <span class="p">();</span><span class="error2"><--- Variable 'display' is assigned a value that is never used.</span> +</span><a name="line-145"></a> <span class="n">active</span> <span class="o">=</span> <span class="n">wnck_screen_get_active_window</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">screen</span><span class="p">);</span> +<a name="line-146"></a> +<a name="line-147"></a> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">WNCK_IS_WINDOW</span> <span class="p">(</span><span class="n">active</span><span class="p">)</span> +<a name="line-148"></a> <span class="o">||</span> <span class="n">wnck_window_get_window_type</span> <span class="p">(</span><span class="n">active</span><span class="p">)</span> <span class="o">!=</span> <span class="n">WNCK_WINDOW_NORMAL</span><span class="p">)</span> +<a name="line-149"></a> <span class="k">return</span> <span class="n">FALSE</span><span class="p">;</span> +<a name="line-150"></a> +<a name="line-151"></a> <span class="n">keystroke</span> <span class="o">=</span> <span class="n">get_fullscreen_keystroke</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">rules</span><span class="p">,</span> <span class="n">active</span><span class="p">);</span> +<a name="line-152"></a> +<a name="line-153"></a> <span class="k">if</span> <span class="p">(</span><span class="n">keystroke</span><span class="p">)</span> +<a name="line-154"></a> <span class="p">{</span> +<a name="line-155"></a> <span class="n">guint</span> <span class="n">keysym</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-156"></a> <span class="n">EggVirtualModifierType</span> <span class="n">modifiers</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-157"></a> +<a name="line-158"></a> <span class="k">if</span> <span class="p">(</span><span class="n">egg_accelerator_parse_virtual</span> <span class="p">(</span><span class="n">keystroke</span><span class="p">,</span> <span class="o">&</span><span class="n">keysym</span><span class="p">,</span> <span class="o">&</span><span class="n">modifiers</span><span class="p">))</span> +<a name="line-159"></a> <span class="p">{</span> +<a name="line-160"></a> <span class="n">guint</span> <span class="n">mods</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-161"></a> +<a name="line-162"></a> <span class="k">if</span> <span class="p">(</span><span class="n">modifiers</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_SHIFT_MASK</span><span class="p">)</span> +<a name="line-163"></a> <span class="n">mods</span> <span class="o">|=</span> <span class="n">FAKEKEYMOD_SHIFT</span><span class="p">;</span> +<a name="line-164"></a> <span class="k">if</span> <span class="p">(</span><span class="n">modifiers</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_CONTROL_MASK</span><span class="p">)</span> +<a name="line-165"></a> <span class="n">mods</span> <span class="o">|=</span> <span class="n">FAKEKEYMOD_CONTROL</span><span class="p">;</span> +<a name="line-166"></a> <span class="k">if</span> <span class="p">(</span><span class="n">modifiers</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_ALT_MASK</span><span class="p">)</span> +<a name="line-167"></a> <span class="n">mods</span> <span class="o">|=</span> <span class="n">FAKEKEYMOD_ALT</span><span class="p">;</span> +<a name="line-168"></a> <span class="k">if</span> <span class="p">(</span><span class="n">modifiers</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_META_MASK</span><span class="p">)</span> +<a name="line-169"></a> <span class="n">mods</span> <span class="o">|=</span> <span class="n">FAKEKEYMOD_META</span><span class="p">;</span> +<a name="line-170"></a> +<a name="line-171"></a> <span class="n">g_debug</span> <span class="p">(</span><span class="s">"Sending fullscreen special event: %s = %d %d"</span><span class="p">,</span> +<a name="line-172"></a> <span class="n">keystroke</span><span class="p">,</span> <span class="n">keysym</span><span class="p">,</span> <span class="n">mods</span><span class="p">);</span> +<a name="line-173"></a> <span class="n">fakekey_press_keysym</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">fk</span><span class="p">,</span> <span class="n">keysym</span><span class="p">,</span> <span class="n">mods</span><span class="p">);</span> +<a name="line-174"></a> <span class="n">fakekey_release</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">fk</span><span class="p">);</span> +<a name="line-175"></a> +<a name="line-176"></a> <span class="k">return</span> <span class="n">FALSE</span><span class="p">;</span> +<a name="line-177"></a> <span class="p">}</span> +<a name="line-178"></a> <span class="p">}</span> +<a name="line-179"></a> +<a name="line-180"></a> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">wnck_window_is_fullscreen</span> <span class="p">(</span><span class="n">active</span><span class="p">))</span> +<a name="line-181"></a> <span class="p">{</span> +<a name="line-182"></a> <span class="n">g_debug</span> <span class="p">(</span><span class="s">"Sending fullscreen F11 event"</span><span class="p">);</span> +<a name="line-183"></a> <span class="n">fakekey_press_keysym</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">fk</span><span class="p">,</span> <span class="n">XK_F11</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span> +<a name="line-184"></a> <span class="n">fakekey_release</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">fk</span><span class="p">);</span> +<a name="line-185"></a> <span class="p">}</span> +<a name="line-186"></a> +<a name="line-187"></a> <span class="n">sleep</span> <span class="p">(</span><span class="n">STATE_CHANGED_SLEEP</span><span class="p">);</span> +<a name="line-188"></a> +<a name="line-189"></a> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">wnck_window_is_fullscreen</span> <span class="p">(</span><span class="n">active</span><span class="p">))</span> +<a name="line-190"></a> <span class="p">{</span> +<a name="line-191"></a> <span class="n">g_debug</span> <span class="p">(</span><span class="s">"Forcing fullscreen wnck event"</span><span class="p">);</span> +<a name="line-192"></a> <span class="n">wnck_window_set_fullscreen</span> <span class="p">(</span><span class="n">active</span><span class="p">,</span> <span class="n">TRUE</span><span class="p">);</span> +<a name="line-193"></a> <span class="p">}</span> +<a name="line-194"></a> +<a name="line-195"></a> <span class="k">return</span> <span class="n">FALSE</span><span class="p">;</span> +<a name="line-196"></a><span class="p">}</span> +<a name="line-197"></a> +<a name="line-198"></a><span class="k">static</span> <span class="kt">void</span> +<a name="line-199"></a><span class="n">fullscreen</span> <span class="p">(</span><span class="n">MaximusBind</span> <span class="o">*</span><span class="n">bind</span><span class="p">,</span> <span class="n">WnckWindow</span> <span class="o">*</span><span class="n">window</span><span class="p">)</span> +<a name="line-200"></a><span class="p">{</span> +<a name="line-201"></a> <span class="n">MaximusBindPrivate</span> <span class="n">UNUSED_VARIABLE</span> <span class="o">*</span><span class="n">priv</span><span class="p">;</span> +<a name="line-202"></a> +<a name="line-203"></a><span class="hll"> <span class="n">priv</span> <span class="o">=</span> <span class="n">bind</span><span class="o">-></span><span class="n">priv</span><span class="p">;</span><span class="error2"><--- Variable 'priv' is assigned a value that is never used.</span> +</span><a name="line-204"></a> +<a name="line-205"></a> <span class="n">g_timeout_add</span> <span class="p">(</span><span class="n">KEY_RELEASE_TIMEOUT</span><span class="p">,</span> <span class="p">(</span><span class="n">GSourceFunc</span><span class="p">)</span><span class="n">real_fullscreen</span><span class="p">,</span> <span class="n">bind</span><span class="p">);</span> +<a name="line-206"></a><span class="p">}</span> +<a name="line-207"></a> +<a name="line-208"></a><span class="k">static</span> <span class="n">gboolean</span> +<a name="line-209"></a><span class="n">real_unfullscreen</span> <span class="p">(</span><span class="n">MaximusBind</span> <span class="o">*</span><span class="n">bind</span><span class="p">)</span> +<a name="line-210"></a><span class="p">{</span> +<a name="line-211"></a> <span class="n">MaximusBindPrivate</span> <span class="o">*</span><span class="n">priv</span><span class="p">;</span> +<a name="line-212"></a> <span class="n">GdkDisplay</span> <span class="n">UNUSED_VARIABLE</span> <span class="o">*</span><span class="n">display</span><span class="p">;</span> +<a name="line-213"></a> <span class="n">WnckWindow</span> <span class="o">*</span><span class="n">active</span><span class="p">;</span> +<a name="line-214"></a> <span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">keystroke</span><span class="p">;</span> +<a name="line-215"></a> +<a name="line-216"></a> <span class="n">priv</span> <span class="o">=</span> <span class="n">bind</span><span class="o">-></span><span class="n">priv</span><span class="p">;</span> +<a name="line-217"></a> +<a name="line-218"></a><span class="hll"> <span class="n">display</span> <span class="o">=</span> <span class="n">gdk_display_get_default</span> <span class="p">();</span><span class="error2"><--- Variable 'display' is assigned a value that is never used.</span> +</span><a name="line-219"></a> <span class="n">active</span> <span class="o">=</span> <span class="n">wnck_screen_get_active_window</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">screen</span><span class="p">);</span> +<a name="line-220"></a> +<a name="line-221"></a> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">WNCK_IS_WINDOW</span> <span class="p">(</span><span class="n">active</span><span class="p">)</span> +<a name="line-222"></a> <span class="o">||</span> <span class="n">wnck_window_get_window_type</span> <span class="p">(</span><span class="n">active</span><span class="p">)</span> <span class="o">!=</span> <span class="n">WNCK_WINDOW_NORMAL</span><span class="p">)</span> +<a name="line-223"></a> <span class="k">return</span> <span class="n">FALSE</span><span class="p">;</span> +<a name="line-224"></a> +<a name="line-225"></a> <span class="n">keystroke</span> <span class="o">=</span> <span class="n">get_unfullscreen_keystroke</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">rules</span><span class="p">,</span> <span class="n">active</span><span class="p">);</span> +<a name="line-226"></a> +<a name="line-227"></a> <span class="k">if</span> <span class="p">(</span><span class="n">keystroke</span><span class="p">)</span> +<a name="line-228"></a> <span class="p">{</span> +<a name="line-229"></a> <span class="n">guint</span> <span class="n">keysym</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-230"></a> <span class="n">EggVirtualModifierType</span> <span class="n">modifiers</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-231"></a> +<a name="line-232"></a> <span class="k">if</span> <span class="p">(</span><span class="n">egg_accelerator_parse_virtual</span> <span class="p">(</span><span class="n">keystroke</span><span class="p">,</span> <span class="o">&</span><span class="n">keysym</span><span class="p">,</span> <span class="o">&</span><span class="n">modifiers</span><span class="p">))</span> +<a name="line-233"></a> <span class="p">{</span> +<a name="line-234"></a> <span class="n">guint</span> <span class="n">mods</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> +<a name="line-235"></a> +<a name="line-236"></a> <span class="k">if</span> <span class="p">(</span><span class="n">modifiers</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_SHIFT_MASK</span><span class="p">)</span> +<a name="line-237"></a> <span class="n">mods</span> <span class="o">|=</span> <span class="n">FAKEKEYMOD_SHIFT</span><span class="p">;</span> +<a name="line-238"></a> <span class="k">if</span> <span class="p">(</span><span class="n">modifiers</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_CONTROL_MASK</span><span class="p">)</span> +<a name="line-239"></a> <span class="n">mods</span> <span class="o">|=</span> <span class="n">FAKEKEYMOD_CONTROL</span><span class="p">;</span> +<a name="line-240"></a> <span class="k">if</span> <span class="p">(</span><span class="n">modifiers</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_ALT_MASK</span><span class="p">)</span> +<a name="line-241"></a> <span class="n">mods</span> <span class="o">|=</span> <span class="n">FAKEKEYMOD_ALT</span><span class="p">;</span> +<a name="line-242"></a> <span class="k">if</span> <span class="p">(</span><span class="n">modifiers</span> <span class="o">&</span> <span class="n">EGG_VIRTUAL_META_MASK</span><span class="p">)</span> +<a name="line-243"></a> <span class="n">mods</span> <span class="o">|=</span> <span class="n">FAKEKEYMOD_META</span><span class="p">;</span> +<a name="line-244"></a> +<a name="line-245"></a> <span class="n">g_debug</span> <span class="p">(</span><span class="s">"Sending fullscreen special event: %s = %d %d"</span><span class="p">,</span> +<a name="line-246"></a> <span class="n">keystroke</span><span class="p">,</span> <span class="n">keysym</span><span class="p">,</span> <span class="n">mods</span><span class="p">);</span> +<a name="line-247"></a> <span class="n">fakekey_press_keysym</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">fk</span><span class="p">,</span> <span class="n">keysym</span><span class="p">,</span> <span class="n">mods</span><span class="p">);</span> +<a name="line-248"></a> <span class="n">fakekey_release</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">fk</span><span class="p">);</span> +<a name="line-249"></a> +<a name="line-250"></a> <span class="k">return</span> <span class="n">FALSE</span><span class="p">;</span> +<a name="line-251"></a> <span class="p">}</span> +<a name="line-252"></a> <span class="p">}</span> +<a name="line-253"></a> <span class="k">if</span> <span class="p">(</span><span class="n">wnck_window_is_fullscreen</span> <span class="p">(</span><span class="n">active</span><span class="p">))</span> +<a name="line-254"></a> <span class="p">{</span> +<a name="line-255"></a> <span class="n">g_debug</span> <span class="p">(</span><span class="s">"Sending un-fullscreen F11 event"</span><span class="p">);</span> +<a name="line-256"></a> <span class="n">fakekey_press_keysym</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">fk</span><span class="p">,</span> <span class="n">XK_F11</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span> +<a name="line-257"></a> <span class="n">fakekey_release</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">fk</span><span class="p">);</span> +<a name="line-258"></a> <span class="p">}</span> +<a name="line-259"></a> +<a name="line-260"></a> <span class="n">sleep</span> <span class="p">(</span><span class="n">STATE_CHANGED_SLEEP</span><span class="p">);</span> +<a name="line-261"></a> +<a name="line-262"></a> <span class="k">if</span> <span class="p">(</span><span class="n">wnck_window_is_fullscreen</span> <span class="p">(</span><span class="n">active</span><span class="p">))</span> +<a name="line-263"></a> <span class="p">{</span> +<a name="line-264"></a> <span class="n">g_debug</span> <span class="p">(</span><span class="s">"Forcing un-fullscreen wnck event"</span><span class="p">);</span> +<a name="line-265"></a> <span class="n">wnck_window_set_fullscreen</span> <span class="p">(</span><span class="n">active</span><span class="p">,</span> <span class="n">FALSE</span><span class="p">);</span> +<a name="line-266"></a> <span class="p">}</span> +<a name="line-267"></a> +<a name="line-268"></a> <span class="k">return</span> <span class="n">FALSE</span><span class="p">;</span> +<a name="line-269"></a><span class="p">}</span> +<a name="line-270"></a> +<a name="line-271"></a><span class="k">static</span> <span class="kt">void</span> +<a name="line-272"></a><span class="n">unfullscreen</span> <span class="p">(</span><span class="n">MaximusBind</span> <span class="o">*</span><span class="n">bind</span><span class="p">,</span> <span class="n">WnckWindow</span> <span class="o">*</span><span class="n">window</span><span class="p">)</span> +<a name="line-273"></a><span class="p">{</span> +<a name="line-274"></a> <span class="n">MaximusBindPrivate</span> <span class="n">UNUSED_VARIABLE</span> <span class="o">*</span><span class="n">priv</span><span class="p">;</span> +<a name="line-275"></a> +<a name="line-276"></a><span class="hll"> <span class="n">priv</span> <span class="o">=</span> <span class="n">bind</span><span class="o">-></span><span class="n">priv</span><span class="p">;</span><span class="error2"><--- Variable 'priv' is assigned a value that is never used.</span> +</span><a name="line-277"></a> +<a name="line-278"></a> <span class="n">g_timeout_add</span> <span class="p">(</span><span class="n">KEY_RELEASE_TIMEOUT</span><span class="p">,</span> <span class="p">(</span><span class="n">GSourceFunc</span><span class="p">)</span><span class="n">real_unfullscreen</span><span class="p">,</span> <span class="n">bind</span><span class="p">);</span> +<a name="line-279"></a><span class="p">}</span> +<a name="line-280"></a> +<a name="line-281"></a> +<a name="line-282"></a><span class="k">static</span> <span class="kt">void</span> +<a name="line-283"></a><span class="n">on_binding_activated</span> <span class="p">(</span><span class="n">gchar</span> <span class="o">*</span><span class="n">keystring</span><span class="p">,</span> <span class="n">MaximusBind</span> <span class="o">*</span><span class="n">bind</span><span class="p">)</span> +<a name="line-284"></a><span class="p">{</span> +<a name="line-285"></a> <span class="n">MaximusBindPrivate</span> <span class="o">*</span><span class="n">priv</span><span class="p">;</span> +<a name="line-286"></a> <span class="n">WnckWindow</span> <span class="o">*</span><span class="n">active</span><span class="p">;</span> +<a name="line-287"></a> +<a name="line-288"></a> <span class="n">g_return_if_fail</span> <span class="p">(</span><span class="n">MAXIMUS_IS_BIND</span> <span class="p">(</span><span class="n">bind</span><span class="p">));</span> +<a name="line-289"></a> <span class="n">priv</span> <span class="o">=</span> <span class="n">bind</span><span class="o">-></span><span class="n">priv</span><span class="p">;</span> +<a name="line-290"></a> +<a name="line-291"></a> <span class="n">active</span> <span class="o">=</span> <span class="n">wnck_screen_get_active_window</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">screen</span><span class="p">);</span> +<a name="line-292"></a> +<a name="line-293"></a> <span class="k">if</span> <span class="p">(</span><span class="n">wnck_window_get_window_type</span> <span class="p">(</span><span class="n">active</span><span class="p">)</span> <span class="o">!=</span> <span class="n">WNCK_WINDOW_NORMAL</span><span class="p">)</span> +<a name="line-294"></a> <span class="k">return</span><span class="p">;</span> +<a name="line-295"></a> +<a name="line-296"></a> <span class="k">if</span> <span class="p">(</span><span class="n">wnck_window_is_fullscreen</span> <span class="p">(</span><span class="n">active</span><span class="p">))</span> +<a name="line-297"></a> <span class="p">{</span> +<a name="line-298"></a> <span class="n">unfullscreen</span> <span class="p">(</span><span class="n">bind</span><span class="p">,</span> <span class="n">active</span><span class="p">);</span> +<a name="line-299"></a> <span class="p">}</span> +<a name="line-300"></a> <span class="k">else</span> +<a name="line-301"></a> <span class="p">{</span> +<a name="line-302"></a> <span class="n">fullscreen</span> <span class="p">(</span><span class="n">bind</span><span class="p">,</span> <span class="n">active</span><span class="p">);</span> +<a name="line-303"></a> <span class="p">}</span> +<a name="line-304"></a><span class="p">}</span> +<a name="line-305"></a> +<a name="line-306"></a><span class="cm">/* Callbacks */</span> +<a name="line-307"></a><span class="k">static</span> <span class="n">gboolean</span> +<a name="line-308"></a><span class="n">binding_is_valid</span> <span class="p">(</span><span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">binding</span><span class="p">)</span> +<a name="line-309"></a><span class="p">{</span> +<a name="line-310"></a> <span class="n">gboolean</span> <span class="n">retval</span> <span class="o">=</span> <span class="n">TRUE</span><span class="p">;</span> +<a name="line-311"></a> +<a name="line-312"></a> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">binding</span> <span class="o">||</span> <span class="n">strlen</span> <span class="p">(</span><span class="n">binding</span><span class="p">)</span> <span class="o"><</span> <span class="mi">1</span> <span class="o">||</span> <span class="n">strcmp</span> <span class="p">(</span><span class="n">binding</span><span class="p">,</span> <span class="s">"disabled"</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> +<a name="line-313"></a> <span class="n">retval</span> <span class="o">=</span> <span class="n">FALSE</span><span class="p">;</span> +<a name="line-314"></a> +<a name="line-315"></a> <span class="k">return</span> <span class="n">retval</span><span class="p">;</span> +<a name="line-316"></a><span class="p">}</span> +<a name="line-317"></a> +<a name="line-318"></a><span class="k">static</span> <span class="kt">void</span> +<a name="line-319"></a><span class="n">on_binding_changed</span> <span class="p">(</span><span class="n">GSettings</span> <span class="o">*</span><span class="n">settings</span><span class="p">,</span> +<a name="line-320"></a> <span class="n">gchar</span> <span class="o">*</span><span class="n">key</span><span class="p">,</span> +<a name="line-321"></a> <span class="n">MaximusBind</span> <span class="o">*</span><span class="n">bind</span><span class="p">)</span> +<a name="line-322"></a><span class="p">{</span> +<a name="line-323"></a> <span class="n">MaximusBindPrivate</span> <span class="o">*</span><span class="n">priv</span><span class="p">;</span> +<a name="line-324"></a> +<a name="line-325"></a> <span class="n">g_return_if_fail</span> <span class="p">(</span><span class="n">MAXIMUS_IS_BIND</span> <span class="p">(</span><span class="n">bind</span><span class="p">));</span> +<a name="line-326"></a> <span class="n">priv</span> <span class="o">=</span> <span class="n">bind</span><span class="o">-></span><span class="n">priv</span><span class="p">;</span> +<a name="line-327"></a> +<a name="line-328"></a> <span class="k">if</span> <span class="p">(</span><span class="n">binding_is_valid</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">binding</span><span class="p">))</span> +<a name="line-329"></a> <span class="n">tomboy_keybinder_unbind</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">binding</span><span class="p">,</span> +<a name="line-330"></a> <span class="p">(</span><span class="n">TomboyBindkeyHandler</span><span class="p">)</span><span class="n">on_binding_changed</span><span class="p">);</span> +<a name="line-331"></a> <span class="n">g_free</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">binding</span><span class="p">);</span> +<a name="line-332"></a> +<a name="line-333"></a> <span class="n">priv</span><span class="o">-></span><span class="n">binding</span> <span class="o">=</span> <span class="n">g_settings_get_string</span> <span class="p">(</span><span class="n">settings</span><span class="p">,</span> <span class="n">BIND_EXCLUDE_CLASS</span><span class="p">);</span> +<a name="line-334"></a> +<a name="line-335"></a> <span class="k">if</span> <span class="p">(</span><span class="n">binding_is_valid</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">binding</span><span class="p">))</span> +<a name="line-336"></a> <span class="n">tomboy_keybinder_bind</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">binding</span><span class="p">,</span> +<a name="line-337"></a> <span class="p">(</span><span class="n">TomboyBindkeyHandler</span><span class="p">)</span><span class="n">on_binding_activated</span><span class="p">,</span> +<a name="line-338"></a> <span class="n">bind</span><span class="p">);</span> +<a name="line-339"></a> +<a name="line-340"></a> <span class="n">g_print</span> <span class="p">(</span><span class="s">"Binding changed: %s</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">priv</span><span class="o">-></span><span class="n">binding</span><span class="p">);</span> +<a name="line-341"></a><span class="p">}</span> +<a name="line-342"></a> +<a name="line-343"></a> +<a name="line-344"></a><span class="cm">/* GObject stuff */</span> +<a name="line-345"></a><span class="k">static</span> <span class="kt">void</span> +<a name="line-346"></a><span class="n">create_rule</span> <span class="p">(</span><span class="n">MaximusBind</span> <span class="o">*</span><span class="n">bind</span><span class="p">,</span> <span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">filename</span><span class="p">)</span> +<a name="line-347"></a><span class="p">{</span> +<a name="line-348"></a><span class="cp">#define RULE_GROUP "Fullscreening"</span> +<a name="line-349"></a><span class="cp">#define RULE_WMCLASS "WMClass"</span> +<a name="line-350"></a><span class="cp">#define RULE_FULLSCREEN "Fullscreen"</span> +<a name="line-351"></a><span class="cp">#define RULE_UNFULLSCREEN "Unfullscreen"</span> +<a name="line-352"></a> <span class="n">MaximusBindPrivate</span> <span class="o">*</span><span class="n">priv</span><span class="p">;</span> +<a name="line-353"></a> <span class="n">GKeyFile</span> <span class="o">*</span><span class="n">file</span><span class="p">;</span> +<a name="line-354"></a> <span class="n">GError</span> <span class="o">*</span><span class="n">error</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span> +<a name="line-355"></a> <span class="n">MaximusRule</span> <span class="o">*</span><span class="n">rule</span><span class="p">;</span> +<a name="line-356"></a> +<a name="line-357"></a> <span class="n">priv</span> <span class="o">=</span> <span class="n">bind</span><span class="o">-></span><span class="n">priv</span><span class="p">;</span> +<a name="line-358"></a> +<a name="line-359"></a> <span class="n">file</span> <span class="o">=</span> <span class="n">g_key_file_new</span> <span class="p">();</span> +<a name="line-360"></a> <span class="n">g_key_file_load_from_file</span> <span class="p">(</span><span class="n">file</span><span class="p">,</span> <span class="n">filename</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">&</span><span class="n">error</span><span class="p">);</span> +<a name="line-361"></a> <span class="k">if</span> <span class="p">(</span><span class="n">error</span><span class="p">)</span> +<a name="line-362"></a> <span class="p">{</span> +<a name="line-363"></a> <span class="n">g_warning</span> <span class="p">(</span><span class="s">"Unable to load %s: %s</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">filename</span><span class="p">,</span> <span class="n">error</span><span class="o">-></span><span class="n">message</span><span class="p">);</span> +<a name="line-364"></a> <span class="n">g_error_free</span> <span class="p">(</span><span class="n">error</span><span class="p">);</span> +<a name="line-365"></a> <span class="n">g_key_file_free</span> <span class="p">(</span><span class="n">file</span><span class="p">);</span> +<a name="line-366"></a> <span class="k">return</span><span class="p">;</span> +<a name="line-367"></a> <span class="p">}</span> +<a name="line-368"></a> +<a name="line-369"></a> <span class="n">rule</span> <span class="o">=</span> <span class="n">g_slice_new0</span> <span class="p">(</span><span class="n">MaximusRule</span><span class="p">);</span> +<a name="line-370"></a> +<a name="line-371"></a> <span class="n">rule</span><span class="o">-></span><span class="n">wm_class</span> <span class="o">=</span> <span class="n">g_key_file_get_string</span> <span class="p">(</span><span class="n">file</span><span class="p">,</span> +<a name="line-372"></a> <span class="n">RULE_GROUP</span><span class="p">,</span> <span class="n">RULE_WMCLASS</span><span class="p">,</span> +<a name="line-373"></a> <span class="nb">NULL</span><span class="p">);</span> +<a name="line-374"></a> <span class="n">rule</span><span class="o">-></span><span class="n">fullscreen</span> <span class="o">=</span> <span class="n">g_key_file_get_string</span> <span class="p">(</span><span class="n">file</span><span class="p">,</span> +<a name="line-375"></a> <span class="n">RULE_GROUP</span><span class="p">,</span> <span class="n">RULE_FULLSCREEN</span><span class="p">,</span> +<a name="line-376"></a> <span class="nb">NULL</span><span class="p">);</span> +<a name="line-377"></a> <span class="n">rule</span><span class="o">-></span><span class="n">unfullscreen</span> <span class="o">=</span> <span class="n">g_key_file_get_string</span> <span class="p">(</span><span class="n">file</span><span class="p">,</span> +<a name="line-378"></a> <span class="n">RULE_GROUP</span><span class="p">,</span> <span class="n">RULE_UNFULLSCREEN</span><span class="p">,</span> +<a name="line-379"></a> <span class="nb">NULL</span><span class="p">);</span> +<a name="line-380"></a> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">rule</span><span class="o">-></span><span class="n">wm_class</span> <span class="o">||</span> <span class="o">!</span><span class="n">rule</span><span class="o">-></span><span class="n">fullscreen</span> <span class="o">||</span> <span class="o">!</span><span class="n">rule</span><span class="o">-></span><span class="n">unfullscreen</span><span class="p">)</span> +<a name="line-381"></a> <span class="p">{</span> +<a name="line-382"></a> <span class="n">g_free</span> <span class="p">(</span><span class="n">rule</span><span class="o">-></span><span class="n">wm_class</span><span class="p">);</span> +<a name="line-383"></a> <span class="n">g_free</span> <span class="p">(</span><span class="n">rule</span><span class="o">-></span><span class="n">fullscreen</span><span class="p">);</span> +<a name="line-384"></a> <span class="n">g_free</span> <span class="p">(</span><span class="n">rule</span><span class="o">-></span><span class="n">unfullscreen</span><span class="p">);</span> +<a name="line-385"></a> <span class="n">g_slice_free</span> <span class="p">(</span><span class="n">MaximusRule</span><span class="p">,</span> <span class="n">rule</span><span class="p">);</span> +<a name="line-386"></a> +<a name="line-387"></a> <span class="n">g_warning</span> <span class="p">(</span><span class="s">"Unable to load %s, missing strings"</span><span class="p">,</span> <span class="n">filename</span><span class="p">);</span> +<a name="line-388"></a> <span class="p">}</span> +<a name="line-389"></a> <span class="k">else</span> +<a name="line-390"></a> <span class="n">priv</span><span class="o">-></span><span class="n">rules</span> <span class="o">=</span> <span class="n">g_list_append</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">rules</span><span class="p">,</span> <span class="n">rule</span><span class="p">);</span> +<a name="line-391"></a> +<a name="line-392"></a> <span class="n">g_key_file_free</span> <span class="p">(</span><span class="n">file</span><span class="p">);</span> +<a name="line-393"></a><span class="p">}</span> +<a name="line-394"></a> +<a name="line-395"></a><span class="k">static</span> <span class="kt">void</span> +<a name="line-396"></a><span class="n">load_rules</span> <span class="p">(</span><span class="n">MaximusBind</span> <span class="o">*</span><span class="n">bind</span><span class="p">,</span> <span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">path</span><span class="p">)</span> +<a name="line-397"></a><span class="p">{</span> +<a name="line-398"></a> <span class="n">MaximusBindPrivate</span> <span class="n">UNUSED_VARIABLE</span> <span class="o">*</span><span class="n">priv</span><span class="p">;</span> +<a name="line-399"></a> <span class="n">GDir</span> <span class="o">*</span><span class="n">dir</span><span class="p">;</span> +<a name="line-400"></a> <span class="k">const</span> <span class="n">gchar</span> <span class="o">*</span><span class="n">name</span><span class="p">;</span> +<a name="line-401"></a> +<a name="line-402"></a><span class="hll"> <span class="n">priv</span> <span class="o">=</span> <span class="n">bind</span><span class="o">-></span><span class="n">priv</span><span class="p">;</span><span class="error2"><--- Variable 'priv' is assigned a value that is never used.</span> +</span><a name="line-403"></a> +<a name="line-404"></a> <span class="n">dir</span> <span class="o">=</span> <span class="n">g_dir_open</span> <span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span> +<a name="line-405"></a> +<a name="line-406"></a> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">dir</span><span class="p">)</span> +<a name="line-407"></a> <span class="k">return</span><span class="p">;</span> +<a name="line-408"></a> +<a name="line-409"></a> <span class="k">while</span> <span class="p">((</span><span class="n">name</span> <span class="o">=</span> <span class="n">g_dir_read_name</span> <span class="p">(</span><span class="n">dir</span><span class="p">)))</span> +<a name="line-410"></a> <span class="p">{</span> +<a name="line-411"></a> <span class="n">gchar</span> <span class="o">*</span><span class="n">filename</span><span class="p">;</span> +<a name="line-412"></a> +<a name="line-413"></a> <span class="n">filename</span><span class="o">=</span> <span class="n">g_build_filename</span> <span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span> +<a name="line-414"></a> +<a name="line-415"></a> <span class="n">create_rule</span> <span class="p">(</span><span class="n">bind</span><span class="p">,</span> <span class="n">filename</span><span class="p">);</span> +<a name="line-416"></a> +<a name="line-417"></a> <span class="n">g_free</span> <span class="p">(</span><span class="n">filename</span><span class="p">);</span> +<a name="line-418"></a> <span class="p">}</span> +<a name="line-419"></a> +<a name="line-420"></a> +<a name="line-421"></a> <span class="n">g_dir_close</span> <span class="p">(</span><span class="n">dir</span><span class="p">);</span> +<a name="line-422"></a><span class="p">}</span> +<a name="line-423"></a> +<a name="line-424"></a><span class="k">static</span> <span class="kt">void</span> +<a name="line-425"></a><span class="n">maximus_bind_finalize</span> <span class="p">(</span><span class="n">GObject</span> <span class="o">*</span><span class="n">obj</span><span class="p">)</span> +<a name="line-426"></a><span class="p">{</span> +<a name="line-427"></a> <span class="n">MaximusBind</span> <span class="o">*</span><span class="n">bind</span> <span class="o">=</span> <span class="n">MAXIMUS_BIND</span> <span class="p">(</span><span class="n">obj</span><span class="p">);</span> +<a name="line-428"></a> <span class="n">MaximusBindPrivate</span> <span class="o">*</span><span class="n">priv</span><span class="p">;</span> +<a name="line-429"></a> <span class="n">GList</span> <span class="o">*</span><span class="n">r</span><span class="p">;</span> +<a name="line-430"></a> +<a name="line-431"></a> <span class="n">g_return_if_fail</span> <span class="p">(</span><span class="n">MAXIMUS_IS_BIND</span> <span class="p">(</span><span class="n">bind</span><span class="p">));</span> +<a name="line-432"></a> <span class="n">priv</span> <span class="o">=</span> <span class="n">bind</span><span class="o">-></span><span class="n">priv</span><span class="p">;</span> +<a name="line-433"></a> +<a name="line-434"></a> <span class="k">for</span> <span class="p">(</span><span class="n">r</span> <span class="o">=</span> <span class="n">priv</span><span class="o">-></span><span class="n">rules</span><span class="p">;</span> <span class="n">r</span><span class="p">;</span> <span class="n">r</span> <span class="o">=</span> <span class="n">r</span><span class="o">-></span><span class="n">next</span><span class="p">)</span> +<a name="line-435"></a> <span class="p">{</span> +<a name="line-436"></a> <span class="n">MaximusRule</span> <span class="o">*</span><span class="n">rule</span> <span class="o">=</span> <span class="n">r</span><span class="o">-></span><span class="n">data</span><span class="p">;</span> +<a name="line-437"></a> +<a name="line-438"></a> <span class="n">g_free</span> <span class="p">(</span><span class="n">rule</span><span class="o">-></span><span class="n">wm_class</span><span class="p">);</span> +<a name="line-439"></a> <span class="n">g_free</span> <span class="p">(</span><span class="n">rule</span><span class="o">-></span><span class="n">fullscreen</span><span class="p">);</span> +<a name="line-440"></a> <span class="n">g_free</span> <span class="p">(</span><span class="n">rule</span><span class="o">-></span><span class="n">unfullscreen</span><span class="p">);</span> +<a name="line-441"></a> +<a name="line-442"></a> <span class="n">g_slice_free</span> <span class="p">(</span><span class="n">MaximusRule</span><span class="p">,</span> <span class="n">rule</span><span class="p">);</span> +<a name="line-443"></a> <span class="p">}</span> +<a name="line-444"></a> <span class="n">g_free</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">binding</span><span class="p">);</span> +<a name="line-445"></a> +<a name="line-446"></a> <span class="n">G_OBJECT_CLASS</span> <span class="p">(</span><span class="n">maximus_bind_parent_class</span><span class="p">)</span><span class="o">-></span><span class="n">finalize</span> <span class="p">(</span><span class="n">obj</span><span class="p">);</span> +<a name="line-447"></a><span class="p">}</span> +<a name="line-448"></a> +<a name="line-449"></a><span class="k">static</span> <span class="kt">void</span> +<a name="line-450"></a><span class="n">maximus_bind_class_init</span> <span class="p">(</span><span class="n">MaximusBindClass</span> <span class="o">*</span><span class="n">klass</span><span class="p">)</span> +<a name="line-451"></a><span class="p">{</span> +<a name="line-452"></a> <span class="n">GObjectClass</span> <span class="o">*</span><span class="n">obj_class</span> <span class="o">=</span> <span class="n">G_OBJECT_CLASS</span> <span class="p">(</span><span class="n">klass</span><span class="p">);</span> +<a name="line-453"></a> +<a name="line-454"></a> <span class="n">obj_class</span><span class="o">-></span><span class="n">finalize</span> <span class="o">=</span> <span class="n">maximus_bind_finalize</span><span class="p">;</span> +<a name="line-455"></a><span class="p">}</span> +<a name="line-456"></a> +<a name="line-457"></a><span class="k">static</span> <span class="kt">void</span> +<a name="line-458"></a><span class="n">maximus_bind_init</span> <span class="p">(</span><span class="n">MaximusBind</span> <span class="o">*</span><span class="n">bind</span><span class="p">)</span> +<a name="line-459"></a><span class="p">{</span> +<a name="line-460"></a> <span class="n">MaximusBindPrivate</span> <span class="o">*</span><span class="n">priv</span><span class="p">;</span> +<a name="line-461"></a> <span class="n">GdkDisplay</span> <span class="o">*</span><span class="n">display</span> <span class="o">=</span> <span class="n">gdk_display_get_default</span> <span class="p">();</span> +<a name="line-462"></a> <span class="n">WnckScreen</span> <span class="o">*</span><span class="n">screen</span><span class="p">;</span> +<a name="line-463"></a> +<a name="line-464"></a> <span class="n">priv</span> <span class="o">=</span> <span class="n">bind</span><span class="o">-></span><span class="n">priv</span> <span class="o">=</span> <span class="n">maximus_bind_get_instance_private</span> <span class="p">(</span><span class="n">bind</span><span class="p">);</span> +<a name="line-465"></a> +<a name="line-466"></a> <span class="n">priv</span><span class="o">-></span><span class="n">fk</span> <span class="o">=</span> <span class="n">fakekey_init</span> <span class="p">(</span><span class="n">GDK_DISPLAY_XDISPLAY</span> <span class="p">(</span><span class="n">display</span><span class="p">));</span> +<a name="line-467"></a> <span class="n">priv</span><span class="o">-></span><span class="n">screen</span> <span class="o">=</span> <span class="n">screen</span> <span class="o">=</span> <span class="n">wnck_screen_get_default</span> <span class="p">();</span> +<a name="line-468"></a> <span class="n">priv</span><span class="o">-></span><span class="n">rules</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span> +<a name="line-469"></a> <span class="n">priv</span><span class="o">-></span><span class="n">settings</span> <span class="o">=</span> <span class="n">g_settings_new</span> <span class="p">(</span><span class="n">BIND_SCHEMA</span><span class="p">);</span> +<a name="line-470"></a> +<a name="line-471"></a> <span class="n">tomboy_keybinder_init</span> <span class="p">();</span> +<a name="line-472"></a> +<a name="line-473"></a> <span class="n">g_signal_connect</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">settings</span><span class="p">,</span> <span class="s">"changed::"</span> <span class="n">BIND_EXCLUDE_CLASS</span><span class="p">,</span> +<a name="line-474"></a> <span class="n">G_CALLBACK</span> <span class="p">(</span><span class="n">on_binding_changed</span><span class="p">),</span> <span class="n">bind</span><span class="p">);</span> +<a name="line-475"></a> +<a name="line-476"></a> <span class="n">priv</span><span class="o">-></span><span class="n">binding</span> <span class="o">=</span> <span class="n">g_settings_get_string</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">settings</span><span class="p">,</span> <span class="n">BIND_EXCLUDE_CLASS</span><span class="p">);</span> +<a name="line-477"></a> +<a name="line-478"></a> <span class="k">if</span> <span class="p">(</span><span class="n">binding_is_valid</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">binding</span><span class="p">))</span> +<a name="line-479"></a> <span class="n">tomboy_keybinder_bind</span> <span class="p">(</span><span class="n">priv</span><span class="o">-></span><span class="n">binding</span><span class="p">,</span> +<a name="line-480"></a> <span class="p">(</span><span class="n">TomboyBindkeyHandler</span><span class="p">)</span><span class="n">on_binding_activated</span><span class="p">,</span> +<a name="line-481"></a> <span class="n">bind</span><span class="p">);</span> +<a name="line-482"></a> +<a name="line-483"></a> <span class="n">load_rules</span> <span class="p">(</span><span class="n">bind</span><span class="p">,</span> <span class="n">SYSRULESDIR</span><span class="p">);</span> +<a name="line-484"></a><span class="p">}</span> +<a name="line-485"></a> +<a name="line-486"></a><span class="n">MaximusBind</span> <span class="o">*</span> +<a name="line-487"></a><span class="n">maximus_bind_get_default</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span> +<a name="line-488"></a> +<a name="line-489"></a><span class="p">{</span> +<a name="line-490"></a> <span class="k">static</span> <span class="n">MaximusBind</span> <span class="o">*</span><span class="n">bind</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span> +<a name="line-491"></a> +<a name="line-492"></a> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">bind</span><span class="p">)</span> +<a name="line-493"></a> <span class="n">bind</span> <span class="o">=</span> <span class="n">g_object_new</span> <span class="p">(</span><span class="n">MAXIMUS_TYPE_BIND</span><span class="p">,</span> +<a name="line-494"></a> <span class="nb">NULL</span><span class="p">);</span> +<a name="line-495"></a> +<a name="line-496"></a> <span class="k">return</span> <span class="n">bind</span><span class="p">;</span> +<a name="line-497"></a><span class="p">}</span> +</pre></div> +</td></tr></table> + </div> <!-- /.wrapper --> + </div> + <div id="footer" class="footer"> + <p> + Cppcheck 2.3 - a tool for static C/C++ code analysis<br> + <br> + Internet: <a href="http://cppcheck.net">http://cppcheck.net</a><br> + IRC: <a href="irc://irc.freenode.net/cppcheck">irc://irc.freenode.net/cppcheck</a><br> + </p> + </div> + </body> +</html> diff --git a/2021-06-21-213330-4389-cppcheck@e2f7cfd5fc80_master/index.html b/2021-06-21-213330-4389-cppcheck@e2f7cfd5fc80_master/index.html new file mode 100644 index 0000000..84df1b3 --- /dev/null +++ b/2021-06-21-213330-4389-cppcheck@e2f7cfd5fc80_master/index.html @@ -0,0 +1,129 @@ + +<!doctype html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>Cppcheck - HTML report - mate-netbook</title> + <link rel="stylesheet" href="style.css"> + <style> + + </style> + <script> + function getStyle(el, styleProp) { + var y; + + if (el.currentStyle) { + y = el.currentStyle[styleProp]; + } else if (window.getComputedStyle) { + y = document.defaultView.getComputedStyle(el, null).getPropertyValue(styleProp); + } + + return y; + } + + function toggle() { + var el = this.expandable_content; + var mark = this.expandable_marker; + + if (el.style.display === "block") { + el.style.display = "none"; + mark.textContent = "[+]"; + } else { + el.style.display = "block"; + mark.textContent = "[-]"; + } + } + + function initExpandables() { + var elements = document.querySelectorAll(".expandable"); + + for (var i = 0, len = elements.length; i < len; i++) { + var el = elements[i]; + var clickable = el.querySelector("span"); + var marker = clickable.querySelector(".marker"); + var content = el.querySelector(".content"); + var width = clickable.clientWidth - parseInt(getStyle(content, "padding-left")) - parseInt(getStyle(content, "padding-right")); + content.style.width = width + "px"; + clickable.expandable_content = content; + clickable.expandable_marker = marker; + clickable.addEventListener("click", toggle); + } + } + + function toggleDisplay(id) { + var elements = document.querySelectorAll("." + id); + + for (var i = 0, len = elements.length; i < len; i++) { + elements[i].classList.toggle("d-none"); + } + } + + function toggleAll() { + var elements = document.querySelectorAll("input"); + + // starting from 1 since 0 is the "toggle all" input + for (var i = 1, len = elements.length; i < len; i++) { + var el = elements[i]; + + if (el.checked) { + el.checked = false; + } else { + el.checked = true; + } + + toggleDisplay(el.id); + } + } + window.addEventListener("load", initExpandables); + </script> + </head> + <body> + <div id="header" class="header"> + <h1>Cppcheck report - mate-netbook: </h1> + </div> + <div class="wrapper"> + <div id="menu_index"> + <p id="filename"><a href="index.html">Defect summary;</a> </p> + + <label><input type="checkbox" onclick="toggleAll()" checked> Toggle all</label> + <table> + <tr><th>Show</th><th>#</th><th>Defect ID</th></tr> + <tr><td><input type="checkbox" onclick="toggleDisplay(this.id)" id="unreadVariable" name="unreadVariable" checked></td><td>6</td><td>unreadVariable</td></tr> + <tr><td><input type="checkbox" onclick="toggleDisplay(this.id)" id="duplicateExpression" name="duplicateExpression" checked></td><td>1</td><td>duplicateExpression</td></tr> + <tr><td><input type="checkbox" onclick="toggleDisplay(this.id)" id="knownConditionTrueFalse" name="knownConditionTrueFalse" checked></td><td>1</td><td>knownConditionTrueFalse</td></tr> + <tr><td><input type="checkbox" onclick="toggleDisplay(this.id)" id="missingIncludeSystem" name="missingIncludeSystem" checked></td><td>1</td><td>missingIncludeSystem</td></tr> + <tr><td></td><td>9</td><td>total</td></tr> + </table> + <p><a href="stats.html">Statistics</a></p> + </div> + <div id="content_index"> + + <table> + <tr><th>Line</th><th>Id</th><th>CWE</th><th>Severity</th><th>Message</th></tr> + <tr><td colspan="5"><a href="4.html"></a></td></tr> + <tr class="missingIncludeSystem"><td><a href="4.html#line-0">0</a></td><td>missingIncludeSystem</td><td></td><td>information</td><td >Cppcheck cannot find all the include files (use --check-config for details)</td></tr> + <tr><td colspan="5"><a href="0.html">maximus/eggaccelerators.c</a></td></tr> + <tr class="duplicateExpression"><td><a href="0.html#line-322">322</a></td><td>duplicateExpression</td><td><a href="https://cwe.mitre.org/data/definitions/398.html">398</a></td><td>style</td><td >Same expression on both sides of '-='.</td></tr> + <tr><td colspan="5"><a href="1.html">maximus/main.c</a></td></tr> + <tr class="unreadVariable"><td><a href="1.html#line-96">96</a></td><td>unreadVariable</td><td><a href="https://cwe.mitre.org/data/definitions/563.html">563</a></td><td>style</td><td >Variable 'app' is assigned a value that is never used.</td></tr> + <tr><td colspan="5"><a href="2.html">maximus/maximus-app.c</a></td></tr> + <tr class="knownConditionTrueFalse"><td><a href="2.html#line-124">124</a></td><td>knownConditionTrueFalse</td><td><a href="https://cwe.mitre.org/data/definitions/571.html">571</a></td><td>style</td><td >Condition 'data' is always true</td></tr> + <tr><td colspan="5"><a href="3.html">maximus/maximus-bind.c</a></td></tr> + <tr class="unreadVariable"><td><a href="3.html#line-144">144</a></td><td>unreadVariable</td><td><a href="https://cwe.mitre.org/data/definitions/563.html">563</a></td><td>style</td><td >Variable 'display' is assigned a value that is never used.</td></tr> + <tr class="unreadVariable"><td><a href="3.html#line-203">203</a></td><td>unreadVariable</td><td><a href="https://cwe.mitre.org/data/definitions/563.html">563</a></td><td>style</td><td >Variable 'priv' is assigned a value that is never used.</td></tr> + <tr class="unreadVariable"><td><a href="3.html#line-218">218</a></td><td>unreadVariable</td><td><a href="https://cwe.mitre.org/data/definitions/563.html">563</a></td><td>style</td><td >Variable 'display' is assigned a value that is never used.</td></tr> + <tr class="unreadVariable"><td><a href="3.html#line-276">276</a></td><td>unreadVariable</td><td><a href="https://cwe.mitre.org/data/definitions/563.html">563</a></td><td>style</td><td >Variable 'priv' is assigned a value that is never used.</td></tr> + <tr class="unreadVariable"><td><a href="3.html#line-402">402</a></td><td>unreadVariable</td><td><a href="https://cwe.mitre.org/data/definitions/563.html">563</a></td><td>style</td><td >Variable 'priv' is assigned a value that is never used.</td></tr> + </table> + </div> <!-- /.wrapper --> + </div> + <div id="footer" class="footer"> + <p> + Cppcheck 2.3 - a tool for static C/C++ code analysis<br> + <br> + Internet: <a href="http://cppcheck.net">http://cppcheck.net</a><br> + IRC: <a href="irc://irc.freenode.net/cppcheck">irc://irc.freenode.net/cppcheck</a><br> + </p> + </div> + </body> +</html> diff --git a/2021-06-21-213330-4389-cppcheck@e2f7cfd5fc80_master/stats.html b/2021-06-21-213330-4389-cppcheck@e2f7cfd5fc80_master/stats.html new file mode 100644 index 0000000..36cad0c --- /dev/null +++ b/2021-06-21-213330-4389-cppcheck@e2f7cfd5fc80_master/stats.html @@ -0,0 +1,108 @@ + +<!doctype html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>Cppcheck - HTML report - mate-netbook</title> + <link rel="stylesheet" href="style.css"> + <style> + + </style> + <script> + function getStyle(el, styleProp) { + var y; + + if (el.currentStyle) { + y = el.currentStyle[styleProp]; + } else if (window.getComputedStyle) { + y = document.defaultView.getComputedStyle(el, null).getPropertyValue(styleProp); + } + + return y; + } + + function toggle() { + var el = this.expandable_content; + var mark = this.expandable_marker; + + if (el.style.display === "block") { + el.style.display = "none"; + mark.textContent = "[+]"; + } else { + el.style.display = "block"; + mark.textContent = "[-]"; + } + } + + function initExpandables() { + var elements = document.querySelectorAll(".expandable"); + + for (var i = 0, len = elements.length; i < len; i++) { + var el = elements[i]; + var clickable = el.querySelector("span"); + var marker = clickable.querySelector(".marker"); + var content = el.querySelector(".content"); + var width = clickable.clientWidth - parseInt(getStyle(content, "padding-left")) - parseInt(getStyle(content, "padding-right")); + content.style.width = width + "px"; + clickable.expandable_content = content; + clickable.expandable_marker = marker; + clickable.addEventListener("click", toggle); + } + } + + function toggleDisplay(id) { + var elements = document.querySelectorAll("." + id); + + for (var i = 0, len = elements.length; i < len; i++) { + elements[i].classList.toggle("d-none"); + } + } + + function toggleAll() { + var elements = document.querySelectorAll("input"); + + // starting from 1 since 0 is the "toggle all" input + for (var i = 1, len = elements.length; i < len; i++) { + var el = elements[i]; + + if (el.checked) { + el.checked = false; + } else { + el.checked = true; + } + + toggleDisplay(el.id); + } + } + window.addEventListener("load", initExpandables); + </script> + </head> + <body> + <div id="header" class="header"> + <h1>Cppcheck report - mate-netbook: Statistics</h1> + </div> + <div class="wrapper"> + <div id="menu_index"> + <p id="filename"><a href="index.html">Back to summary</a> </p> + + </div> + <div id="content_index"> +<p>Top 10 files for style severity, total findings: 8<br> +   5 <a href="3.html"> maximus/maximus-bind.c</a><br> +   1 <a href="2.html"> maximus/maximus-app.c</a><br> +   1 <a href="1.html"> maximus/main.c</a><br> +   1 <a href="0.html"> maximus/eggaccelerators.c</a><br> +</p> + + </div> <!-- /.wrapper --> + </div> + <div id="footer" class="footer"> + <p> + Cppcheck 2.3 - a tool for static C/C++ code analysis<br> + <br> + Internet: <a href="http://cppcheck.net">http://cppcheck.net</a><br> + IRC: <a href="irc://irc.freenode.net/cppcheck">irc://irc.freenode.net/cppcheck</a><br> + </p> + </div> + </body> +</html> diff --git a/2021-06-21-213330-4389-cppcheck@e2f7cfd5fc80_master/style.css b/2021-06-21-213330-4389-cppcheck@e2f7cfd5fc80_master/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-06-21-213330-4389-cppcheck@e2f7cfd5fc80_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; +} |