mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-10-17 10:37:12 +00:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2922c9982a | ||
|
|
062c105bc1 | ||
|
|
18d77b7279 | ||
|
|
a1cd9897ea | ||
|
|
dad6abee58 |
Vendored
-153
@@ -78,11 +78,6 @@ a {
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
::selection {
|
|
||||||
background: var(--accent);
|
|
||||||
color: #fff8ea;
|
|
||||||
}
|
|
||||||
|
|
||||||
button,
|
button,
|
||||||
input,
|
input,
|
||||||
textarea,
|
textarea,
|
||||||
@@ -144,7 +139,6 @@ select {
|
|||||||
z-index: 2000;
|
z-index: 2000;
|
||||||
border-bottom: 3px solid var(--rule);
|
border-bottom: 3px solid var(--rule);
|
||||||
background: rgba(238, 229, 211, 0.94);
|
background: rgba(238, 229, 211, 0.94);
|
||||||
-webkit-backdrop-filter: blur(8px);
|
|
||||||
backdrop-filter: blur(8px);
|
backdrop-filter: blur(8px);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,17 +231,6 @@ select {
|
|||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
}
|
}
|
||||||
|
|
||||||
.site-nav a[aria-current="page"] {
|
|
||||||
border-block-color: var(--rule);
|
|
||||||
background: var(--panel-dark);
|
|
||||||
color: var(--paper-warm);
|
|
||||||
box-shadow: inset 0 -0.3rem 0 var(--accent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-nav a[aria-current="page"]::before {
|
|
||||||
color: #d19b25;
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-nav a:hover,
|
.site-nav a:hover,
|
||||||
.site-nav a:focus-visible {
|
.site-nav a:focus-visible {
|
||||||
border-block-color: var(--rule);
|
border-block-color: var(--rule);
|
||||||
@@ -528,7 +511,6 @@ select {
|
|||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
line-height: 1.18;
|
line-height: 1.18;
|
||||||
box-shadow: 4px 4px 0 var(--rule);
|
box-shadow: 4px 4px 0 var(--rule);
|
||||||
touch-action: manipulation;
|
|
||||||
transition: transform 0.12s ease, background-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
|
transition: transform 0.12s ease, background-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -545,11 +527,6 @@ select {
|
|||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button:active {
|
|
||||||
transform: translate(3px, 3px);
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-primary {
|
.button-primary {
|
||||||
background: var(--accent);
|
background: var(--accent);
|
||||||
color: #fff8ea;
|
color: #fff8ea;
|
||||||
@@ -1199,11 +1176,6 @@ select {
|
|||||||
color: rgba(255, 248, 234, 0.82);
|
color: rgba(255, 248, 234, 0.82);
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer-links a {
|
|
||||||
width: fit-content;
|
|
||||||
border-bottom: 1px solid transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer-links a::before {
|
.footer-links a::before {
|
||||||
color: #d19b25;
|
color: #d19b25;
|
||||||
content: "↳ ";
|
content: "↳ ";
|
||||||
@@ -1212,7 +1184,6 @@ select {
|
|||||||
.footer-links a:hover,
|
.footer-links a:hover,
|
||||||
.footer-links a:focus-visible {
|
.footer-links a:focus-visible {
|
||||||
color: #fff8ea;
|
color: #fff8ea;
|
||||||
border-bottom-color: currentColor;
|
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1375,70 +1346,6 @@ select {
|
|||||||
animation-iteration-count: 1 !important;
|
animation-iteration-count: 1 !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Automatic dark appearance, matching the main ZoiteChat site palette. */
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
:root {
|
|
||||||
color-scheme: dark;
|
|
||||||
--paper: #161514;
|
|
||||||
--paper-warm: #f4ead9;
|
|
||||||
--paper-cool: #1c2522;
|
|
||||||
--ink: #f2eadb;
|
|
||||||
--ink-soft: #ddd2c1;
|
|
||||||
--muted: #bdb19f;
|
|
||||||
--quiet: #928777;
|
|
||||||
--rule: #080706;
|
|
||||||
--rule-soft: rgba(242, 234, 219, 0.16);
|
|
||||||
--rule-mid: rgba(242, 234, 219, 0.3);
|
|
||||||
--panel: #211e1a;
|
|
||||||
--panel-alt: #2b261f;
|
|
||||||
--panel-dark: #0b0c0c;
|
|
||||||
--accent: #c34720;
|
|
||||||
--accent-dark: #ff966d;
|
|
||||||
--accent-soft: rgba(195, 71, 32, 0.17);
|
|
||||||
--green: #367662;
|
|
||||||
--blue: #386b8d;
|
|
||||||
--warning: #9b6508;
|
|
||||||
--success: #43856a;
|
|
||||||
--shadow: 8px 8px 0 rgba(0, 0, 0, 0.82);
|
|
||||||
--shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.36);
|
|
||||||
}
|
|
||||||
|
|
||||||
html {
|
|
||||||
background: var(--paper);
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
background:
|
|
||||||
linear-gradient(90deg, rgba(242, 234, 219, 0.025) 1px, transparent 1px) 0 0 / 68px 68px,
|
|
||||||
linear-gradient(180deg, rgba(242, 234, 219, 0.022) 1px, transparent 1px) 0 0 / 68px 68px,
|
|
||||||
radial-gradient(circle at 11% 18%, rgba(195, 71, 32, 0.15), transparent 24rem),
|
|
||||||
radial-gradient(circle at 86% 4%, rgba(54, 118, 98, 0.16), transparent 28rem),
|
|
||||||
linear-gradient(180deg, #181715 0%, #111311 58%, #191714 100%);
|
|
||||||
}
|
|
||||||
|
|
||||||
body::before {
|
|
||||||
background:
|
|
||||||
repeating-linear-gradient(90deg, transparent 0 17px, rgba(242, 234, 219, 0.025) 17px 18px),
|
|
||||||
repeating-linear-gradient(0deg, transparent 0 5px, rgba(255, 255, 255, 0.025) 5px 6px);
|
|
||||||
mix-blend-mode: screen;
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-header {
|
|
||||||
background: rgba(22, 21, 20, 0.94);
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-nav a,
|
|
||||||
.nav-menu summary {
|
|
||||||
background: rgba(39, 35, 30, 0.52);
|
|
||||||
}
|
|
||||||
|
|
||||||
.eyebrow::before,
|
|
||||||
.footer-links a::before {
|
|
||||||
color: #e0aa3c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sphinx/Read the Docs bridge: aggressively map documentation onto the main ZoiteChat site skin. */
|
/* Sphinx/Read the Docs bridge: aggressively map documentation onto the main ZoiteChat site skin. */
|
||||||
html {
|
html {
|
||||||
font-size: 16px !important;
|
font-size: 16px !important;
|
||||||
@@ -1578,17 +1485,6 @@ body a {
|
|||||||
font-weight: 900 !important;
|
font-weight: 900 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#navbar-top .site-nav a[aria-current="page"] {
|
|
||||||
border-block-color: var(--rule) !important;
|
|
||||||
background: var(--panel-dark) !important;
|
|
||||||
color: var(--paper-warm) !important;
|
|
||||||
box-shadow: inset 0 -0.3rem 0 var(--accent) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#navbar-top .site-nav a[aria-current="page"]::before {
|
|
||||||
color: #d19b25 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#navbar-top .site-nav a:hover,
|
#navbar-top .site-nav a:hover,
|
||||||
#navbar-top .site-nav a:focus-visible,
|
#navbar-top .site-nav a:focus-visible,
|
||||||
#navbar-top .site-nav summary:hover,
|
#navbar-top .site-nav summary:hover,
|
||||||
@@ -1775,7 +1671,6 @@ footer.site-footer-lite {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.document .body p {
|
.document .body p {
|
||||||
max-width: 78ch;
|
|
||||||
margin: 0 0 1rem !important;
|
margin: 0 0 1rem !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1821,7 +1716,6 @@ ul.search a:focus-visible {
|
|||||||
|
|
||||||
.document .body ul,
|
.document .body ul,
|
||||||
.document .body ol {
|
.document .body ol {
|
||||||
max-width: 78ch;
|
|
||||||
margin: 0.75rem 0 1.4rem !important;
|
margin: 0.75rem 0 1.4rem !important;
|
||||||
padding-left: 1.35rem !important;
|
padding-left: 1.35rem !important;
|
||||||
}
|
}
|
||||||
@@ -1971,11 +1865,6 @@ ul.search a:focus-visible {
|
|||||||
text-transform: uppercase !important;
|
text-transform: uppercase !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.document .body table tbody tr:hover td,
|
|
||||||
.document .body table tbody tr:focus-within td {
|
|
||||||
background: var(--accent-soft) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admonition,
|
.admonition,
|
||||||
.note,
|
.note,
|
||||||
.warning,
|
.warning,
|
||||||
@@ -2115,7 +2004,6 @@ input[type="submit"],
|
|||||||
line-height: 1.18 !important;
|
line-height: 1.18 !important;
|
||||||
text-shadow: none !important;
|
text-shadow: none !important;
|
||||||
box-shadow: 4px 4px 0 var(--rule) !important;
|
box-shadow: 4px 4px 0 var(--rule) !important;
|
||||||
touch-action: manipulation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn:hover,
|
.btn:hover,
|
||||||
@@ -2131,13 +2019,6 @@ input[type="submit"]:focus-visible {
|
|||||||
outline: none !important;
|
outline: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn:active,
|
|
||||||
button:active,
|
|
||||||
input[type="submit"]:active {
|
|
||||||
transform: translate(3px, 3px) !important;
|
|
||||||
box-shadow: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#navbar-related {
|
#navbar-related {
|
||||||
min-height: auto !important;
|
min-height: auto !important;
|
||||||
margin: 1rem 0 1.5rem !important;
|
margin: 1rem 0 1.5rem !important;
|
||||||
@@ -2394,37 +2275,3 @@ footer:not(.site-footer) {
|
|||||||
letter-spacing: -0.04em !important;
|
letter-spacing: -0.04em !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keep basicstrap's stronger overrides readable with the main site's dark palette. */
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
#navbar-top.site-header {
|
|
||||||
background: rgba(22, 21, 20, 0.94) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#navbar-top .site-nav a,
|
|
||||||
#navbar-top .site-nav summary {
|
|
||||||
background: rgba(39, 35, 30, 0.52) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.document::after,
|
|
||||||
.sidebar::after,
|
|
||||||
#navbar-related::after {
|
|
||||||
background: linear-gradient(135deg, transparent 50%, rgba(242, 234, 219, 0.09) 50%) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
input[type="text"],
|
|
||||||
input[type="search"],
|
|
||||||
.search-query,
|
|
||||||
.form-control,
|
|
||||||
textarea,
|
|
||||||
select {
|
|
||||||
background: var(--panel) !important;
|
|
||||||
box-shadow: inset 3px 3px 0 rgba(0, 0, 0, 0.32) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.warning,
|
|
||||||
.caution,
|
|
||||||
.danger {
|
|
||||||
background: #3a2e19 !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Vendored
+1
-5
@@ -209,8 +209,6 @@
|
|||||||
{%- endif %}
|
{%- endif %}
|
||||||
<meta name="description" content="">
|
<meta name="description" content="">
|
||||||
<meta name="author" content="">
|
<meta name="author" content="">
|
||||||
<meta name="theme-color" content="#eee5d3" media="(prefers-color-scheme: light)">
|
|
||||||
<meta name="theme-color" content="#161514" media="(prefers-color-scheme: dark)">
|
|
||||||
|
|
||||||
{{ css() }}
|
{{ css() }}
|
||||||
{%- if not embedded %}
|
{%- if not embedded %}
|
||||||
@@ -262,9 +260,8 @@
|
|||||||
<nav class="site-nav" aria-label="Primary">
|
<nav class="site-nav" aria-label="Primary">
|
||||||
<a href="https://zoitechat.org/">Home</a>
|
<a href="https://zoitechat.org/">Home</a>
|
||||||
<a href="https://zoitechat.org/addons.php">Addons</a>
|
<a href="https://zoitechat.org/addons.php">Addons</a>
|
||||||
<a href="https://zoitechat.org/announcements.php">Announcements</a>
|
|
||||||
<a href="https://zoitechat.org/download.php">Download</a>
|
<a href="https://zoitechat.org/download.php">Download</a>
|
||||||
<a href="{{ pathto(master_doc) }}" aria-current="page">Docs</a>
|
<a href="{{ pathto(master_doc) }}">Docs</a>
|
||||||
<a href="https://github.com/ZoiteChat/zoitechat" target="_blank" rel="noopener">GitHub</a>
|
<a href="https://github.com/ZoiteChat/zoitechat" target="_blank" rel="noopener">GitHub</a>
|
||||||
<details class="nav-menu">
|
<details class="nav-menu">
|
||||||
<summary>IRC Support</summary>
|
<summary>IRC Support</summary>
|
||||||
@@ -339,7 +336,6 @@
|
|||||||
<div class="footer-links">
|
<div class="footer-links">
|
||||||
<a href="https://zoitechat.org/download.php">Download</a>
|
<a href="https://zoitechat.org/download.php">Download</a>
|
||||||
<a href="https://zoitechat.org/addons.php">Addons</a>
|
<a href="https://zoitechat.org/addons.php">Addons</a>
|
||||||
<a href="https://zoitechat.org/announcements.php">Announcements</a>
|
|
||||||
<a href="https://zoitechat.org/privacy.php">Privacy Policy</a>
|
<a href="https://zoitechat.org/privacy.php">Privacy Policy</a>
|
||||||
<a href="{{ pathto(master_doc) }}">Documentation</a>
|
<a href="{{ pathto(master_doc) }}">Documentation</a>
|
||||||
<a href="https://github.com/ZoiteChat/zoitechat" target="_blank" rel="noopener">Source code</a>
|
<a href="https://github.com/ZoiteChat/zoitechat" target="_blank" rel="noopener">Source code</a>
|
||||||
|
|||||||
+50
-34
@@ -6,50 +6,66 @@ sysinfo_sources = [
|
|||||||
sysinfo_deps = [
|
sysinfo_deps = [
|
||||||
libgio_dep,
|
libgio_dep,
|
||||||
zoitechat_plugin_dep,
|
zoitechat_plugin_dep,
|
||||||
common_sysinfo_deps,
|
|
||||||
]
|
]
|
||||||
|
|
||||||
sysinfo_includes = []
|
sysinfo_includes = []
|
||||||
sysinfo_cargs = ['-DHAVE_CONFIG_H']
|
sysinfo_cargs = ['-DHAVE_CONFIG_H']
|
||||||
|
|
||||||
system = host_machine.system()
|
system = host_machine.system()
|
||||||
if system == 'linux' or system == 'gnu' or system.startswith('gnu/') or system == 'darwin' or system == 'freebsd'
|
if system == 'linux'
|
||||||
sysinfo_includes += 'shared'
|
if get_option('gtk-frontend')
|
||||||
sysinfo_sources += [
|
sysinfo_deps += dependency('gtk+-3.0', version: '>= 3.22')
|
||||||
'shared/df.c'
|
|
||||||
]
|
|
||||||
|
|
||||||
if system == 'linux' or system == 'gnu' or system.startswith('gnu/') or system == 'freebsd'
|
|
||||||
libpci = dependency('libpci', required: false, method: 'pkg-config')
|
|
||||||
if libpci.found()
|
|
||||||
sysinfo_deps += libpci
|
|
||||||
sysinfo_cargs += '-DHAVE_LIBPCI'
|
|
||||||
sysinfo_sources += 'unix/pci.c'
|
|
||||||
|
|
||||||
picidsdir = libpci.get_variable(pkgconfig : 'idsdir')
|
|
||||||
pciids = join_paths(picidsdir, 'pci.ids')
|
|
||||||
sysinfo_cargs += '-DPCIIDS_FILE="@0@"'.format(pciids)
|
|
||||||
endif
|
|
||||||
if get_option('gtk-frontend')
|
|
||||||
sysinfo_deps += dependency('gtk+-3.0', version: '>= 3.22')
|
|
||||||
endif
|
|
||||||
|
|
||||||
sysinfo_includes += 'unix'
|
|
||||||
sysinfo_sources += [
|
|
||||||
'unix/backend.c',
|
|
||||||
'unix/match.c',
|
|
||||||
'unix/parse.c',
|
|
||||||
]
|
|
||||||
elif system == 'darwin'
|
|
||||||
add_languages('objc')
|
|
||||||
sysinfo_sources += 'osx/backend.m'
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
elif system == 'windows'
|
libpci = dependency('libpci', required: false, method: 'pkg-config')
|
||||||
|
if libpci.found()
|
||||||
|
sysinfo_deps += libpci
|
||||||
|
sysinfo_cargs += '-DHAVE_LIBPCI'
|
||||||
|
endif
|
||||||
|
|
||||||
|
sysinfo_includes += 'unix'
|
||||||
|
sysinfo_sources += 'unix/modern-backend.c'
|
||||||
|
|
||||||
|
elif system == 'freebsd' or system == 'gnu' or system.startswith('gnu/')
|
||||||
|
sysinfo_includes += ['shared', 'unix']
|
||||||
sysinfo_sources += [
|
sysinfo_sources += [
|
||||||
'win32/backend.c',
|
'shared/df.c',
|
||||||
'../../src/common/sysinfo/win32/backend.c'
|
'unix/backend.c',
|
||||||
|
'unix/match.c',
|
||||||
|
'unix/parse.c',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
libpci = dependency('libpci', required: false, method: 'pkg-config')
|
||||||
|
if libpci.found()
|
||||||
|
sysinfo_deps += libpci
|
||||||
|
sysinfo_cargs += '-DHAVE_LIBPCI'
|
||||||
|
sysinfo_sources += 'unix/pci.c'
|
||||||
|
|
||||||
|
picidsdir = libpci.get_variable(pkgconfig: 'idsdir')
|
||||||
|
pciids = join_paths(picidsdir, 'pci.ids')
|
||||||
|
sysinfo_cargs += '-DPCIIDS_FILE="@0@"'.format(pciids)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get_option('gtk-frontend')
|
||||||
|
sysinfo_deps += dependency('gtk+-3.0', version: '>= 3.22')
|
||||||
|
endif
|
||||||
|
|
||||||
|
elif system == 'darwin'
|
||||||
|
sysinfo_includes += 'shared'
|
||||||
|
sysinfo_sources += 'shared/df.c'
|
||||||
|
add_languages('objc')
|
||||||
|
sysinfo_sources += 'osx/backend.m'
|
||||||
|
|
||||||
|
elif system == 'windows'
|
||||||
|
cc = meson.get_compiler('c')
|
||||||
|
sysinfo_deps += [
|
||||||
|
cc.find_library('advapi32', required: true),
|
||||||
|
cc.find_library('dxgi', required: true),
|
||||||
|
cc.find_library('dxguid', required: true),
|
||||||
|
cc.find_library('iphlpapi', required: true),
|
||||||
|
cc.find_library('winmm', required: true),
|
||||||
|
]
|
||||||
|
sysinfo_sources += 'win32/backend.c'
|
||||||
else
|
else
|
||||||
error('sysinfo: Unknown system?')
|
error('sysinfo: Unknown system?')
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ static zoitechat_plugin *ph;
|
|||||||
|
|
||||||
static char name[] = "Sysinfo";
|
static char name[] = "Sysinfo";
|
||||||
static char desc[] = "Display info about your hardware and OS";
|
static char desc[] = "Display info about your hardware and OS";
|
||||||
static char version[] = "1.0";
|
static char version[] = "2.0";
|
||||||
static char sysinfo_help[] = "SysInfo Usage:\n /SYSINFO [-e|-o] [CLIENT|UI|OS|CPU|RAM|STORAGE|GPU|CHIPSET|SOUND|ETHERNET|UPTIME], print various details about your system or print a summary without arguments\n /SYSINFO SET <variable>\n";
|
static char sysinfo_help[] = "SysInfo Usage:\n /SYSINFO [-e|-o] [CLIENT|UI|OS|CPU|RAM|MEMORY|STORAGE|DISK|GPU|VGA|CHIPSET|SOUND|NETWORK|ETHERNET|UPTIME], print various details about your system or print a summary without arguments\n /SYSINFO SET <variable>\n";
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -68,11 +68,11 @@ static hwinfo hwinfos[] = {
|
|||||||
{"os", "OS", sysinfo_backend_get_os},
|
{"os", "OS", sysinfo_backend_get_os},
|
||||||
{"cpu", "CPU", sysinfo_backend_get_cpu},
|
{"cpu", "CPU", sysinfo_backend_get_cpu},
|
||||||
{"memory", "Memory", sysinfo_backend_get_memory},
|
{"memory", "Memory", sysinfo_backend_get_memory},
|
||||||
{"storage", "Storage", sysinfo_backend_get_disk, TRUE},
|
{"storage", "Storage", sysinfo_backend_get_disk},
|
||||||
{"gpu", "GPU", sysinfo_backend_get_gpu},
|
{"gpu", "GPU", sysinfo_backend_get_gpu},
|
||||||
{"chipset", "CHIPSET", sysinfo_backend_get_chipset, TRUE},
|
{"chipset", "Chipset", sysinfo_backend_get_chipset, TRUE},
|
||||||
{"sound", "Sound", sysinfo_backend_get_sound, TRUE},
|
{"sound", "Sound", sysinfo_backend_get_sound, TRUE},
|
||||||
{"ethernet", "Ethernet", sysinfo_backend_get_network, TRUE},
|
{"ethernet", "Network", sysinfo_backend_get_network, TRUE},
|
||||||
{"uptime", "Uptime", sysinfo_backend_get_uptime},
|
{"uptime", "Uptime", sysinfo_backend_get_uptime},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
@@ -115,14 +115,30 @@ print_summary (gboolean announce)
|
|||||||
g_free (output);
|
g_free (output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
normalize_info_name (const char *info)
|
||||||
|
{
|
||||||
|
if (!g_ascii_strcasecmp (info, "ram"))
|
||||||
|
return "memory";
|
||||||
|
if (!g_ascii_strcasecmp (info, "disk"))
|
||||||
|
return "storage";
|
||||||
|
if (!g_ascii_strcasecmp (info, "vga"))
|
||||||
|
return "gpu";
|
||||||
|
if (!g_ascii_strcasecmp (info, "network"))
|
||||||
|
return "ethernet";
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_info (char *info, gboolean announce)
|
print_info (char *info, gboolean announce)
|
||||||
{
|
{
|
||||||
|
const char *normalized = normalize_info_name (info);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; hwinfos[i].name != NULL; i++)
|
for (i = 0; hwinfos[i].name != NULL; i++)
|
||||||
{
|
{
|
||||||
if (!g_ascii_strcasecmp (info, hwinfos[i].name))
|
if (!g_ascii_strcasecmp (normalized, hwinfos[i].name))
|
||||||
{
|
{
|
||||||
char *str = hwinfos[i].callback();
|
char *str = hwinfos[i].callback();
|
||||||
if (str)
|
if (str)
|
||||||
@@ -183,12 +199,17 @@ sysinfo_set_pref (char *key, char *value)
|
|||||||
}
|
}
|
||||||
else if (g_str_has_prefix (key, "hide_"))
|
else if (g_str_has_prefix (key, "hide_"))
|
||||||
{
|
{
|
||||||
|
const char *normalized = normalize_info_name (key + 5);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; hwinfos[i].name != NULL; i++)
|
for (i = 0; hwinfos[i].name != NULL; i++)
|
||||||
{
|
{
|
||||||
if (!strcmp (key + 5, hwinfos[i].name))
|
if (!strcmp (normalized, hwinfos[i].name))
|
||||||
{
|
{
|
||||||
sysinfo_set_pref_real (key, value, hwinfos[i].def);
|
char canonical[32];
|
||||||
|
|
||||||
|
g_snprintf (canonical, sizeof (canonical), "hide_%s", hwinfos[i].name);
|
||||||
|
sysinfo_set_pref_real (canonical, value, hwinfos[i].def);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
+709
-83
@@ -1,28 +1,34 @@
|
|||||||
/* ZoiteChat
|
/*
|
||||||
* Copyright (c) 2011-2012 Berke Viktor.
|
* Modern Windows SysInfo backend for ZoiteChat.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Avoids WMI in the plugin hot path and uses native Win32/DXGI APIs.
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#ifndef _WIN32_WINNT
|
||||||
|
#define _WIN32_WINNT 0x0601
|
||||||
|
#elif _WIN32_WINNT < 0x0601
|
||||||
|
#undef _WIN32_WINNT
|
||||||
|
#define _WIN32_WINNT 0x0601
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <winsock2.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <wbemidl.h>
|
#include <winternl.h>
|
||||||
|
#include <dxgi.h>
|
||||||
|
#include <iphlpapi.h>
|
||||||
|
#include <ipifcons.h>
|
||||||
|
#include <mmsystem.h>
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma comment(lib, "advapi32.lib")
|
||||||
|
#pragma comment(lib, "dxgi.lib")
|
||||||
|
#pragma comment(lib, "dxguid.lib")
|
||||||
|
#pragma comment(lib, "iphlpapi.lib")
|
||||||
|
#pragma comment(lib, "winmm.lib")
|
||||||
|
#endif
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
@@ -30,63 +36,548 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../../../src/common/sysinfo/sysinfo.h"
|
|
||||||
|
|
||||||
#include "../format.h"
|
#include "../format.h"
|
||||||
|
#include "../sysinfo-backend.h"
|
||||||
|
|
||||||
static char *get_memory_info (void);
|
#define SYSINFO_SEP " \xC2\xB7 "
|
||||||
|
|
||||||
char *
|
typedef struct
|
||||||
sysinfo_backend_get_sound (void)
|
|
||||||
{
|
{
|
||||||
return NULL;
|
char *os;
|
||||||
}
|
char *cpu;
|
||||||
|
char *gpu;
|
||||||
|
char *sound;
|
||||||
|
} WinStaticSnapshot;
|
||||||
|
|
||||||
char *
|
static WinStaticSnapshot snapshot;
|
||||||
sysinfo_backend_get_network (void)
|
static gsize os_initialized = 0;
|
||||||
|
static gsize cpu_initialized = 0;
|
||||||
|
static gsize gpu_initialized = 0;
|
||||||
|
static gsize sound_initialized = 0;
|
||||||
|
|
||||||
|
static char *wide_to_utf8 (const WCHAR *value);
|
||||||
|
static char *read_registry_string (HKEY root, const WCHAR *subkey, const WCHAR *value_name);
|
||||||
|
static gboolean read_registry_dword (HKEY root, const WCHAR *subkey, const WCHAR *value_name, DWORD *value);
|
||||||
|
static const char *get_native_arch (void);
|
||||||
|
static DWORD get_windows_build_number (void);
|
||||||
|
static char *build_os_string (void);
|
||||||
|
static DWORD count_physical_cores (void);
|
||||||
|
static char *build_cpu_string (void);
|
||||||
|
static char *build_gpu_string (void);
|
||||||
|
static char *build_sound_string (void);
|
||||||
|
static void ensure_os_snapshot (void);
|
||||||
|
static void ensure_cpu_snapshot (void);
|
||||||
|
static void ensure_gpu_snapshot (void);
|
||||||
|
static void ensure_sound_snapshot (void);
|
||||||
|
static char *format_usage (guint64 total, guint64 available);
|
||||||
|
static char *join_ptr_array (GPtrArray *items, const char *separator);
|
||||||
|
static void ptr_array_add_unique (GPtrArray *items, const char *value);
|
||||||
|
static gboolean adapter_looks_virtual (const char *name);
|
||||||
|
|
||||||
|
static char *
|
||||||
|
wide_to_utf8 (const WCHAR *value)
|
||||||
{
|
{
|
||||||
return NULL;
|
if (!value || value[0] == L'\0')
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
|
||||||
sysinfo_backend_get_uptime (void)
|
|
||||||
{
|
|
||||||
return sysinfo_format_uptime (GetTickCount64 () / 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
|
||||||
sysinfo_backend_get_disk (void)
|
|
||||||
{
|
|
||||||
guint64 hdd_capacity;
|
|
||||||
guint64 hdd_free_space;
|
|
||||||
|
|
||||||
sysinfo_get_hdd_info (&hdd_capacity, &hdd_free_space);
|
|
||||||
|
|
||||||
if (hdd_capacity != 0)
|
|
||||||
{
|
{
|
||||||
return sysinfo_format_disk(hdd_capacity, hdd_free_space);
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return g_utf16_to_utf8 ((const gunichar2 *) value, -1, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
read_registry_string (HKEY root, const WCHAR *subkey, const WCHAR *value_name)
|
||||||
|
{
|
||||||
|
HKEY key;
|
||||||
|
DWORD type = 0;
|
||||||
|
DWORD size = 0;
|
||||||
|
WCHAR *buffer;
|
||||||
|
char *result = NULL;
|
||||||
|
LONG status;
|
||||||
|
|
||||||
|
status = RegOpenKeyExW (root, subkey, 0, KEY_READ | KEY_WOW64_64KEY, &key);
|
||||||
|
if (status != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
status = RegQueryValueExW (key, value_name, NULL, &type, NULL, &size);
|
||||||
|
if (status != ERROR_SUCCESS || (type != REG_SZ && type != REG_EXPAND_SZ) || size < sizeof (WCHAR))
|
||||||
|
{
|
||||||
|
RegCloseKey (key);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer = g_malloc0 ((gsize) size + sizeof (WCHAR));
|
||||||
|
status = RegQueryValueExW (key, value_name, NULL, &type, (LPBYTE) buffer, &size);
|
||||||
|
if (status == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
result = wide_to_utf8 (buffer);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
g_strstrip (result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (buffer);
|
||||||
|
RegCloseKey (key);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
read_registry_dword (HKEY root, const WCHAR *subkey, const WCHAR *value_name, DWORD *value)
|
||||||
|
{
|
||||||
|
HKEY key;
|
||||||
|
DWORD type = 0;
|
||||||
|
DWORD size = sizeof (*value);
|
||||||
|
LONG status;
|
||||||
|
|
||||||
|
status = RegOpenKeyExW (root, subkey, 0, KEY_READ | KEY_WOW64_64KEY, &key);
|
||||||
|
if (status != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
status = RegQueryValueExW (key, value_name, NULL, &type, (LPBYTE) value, &size);
|
||||||
|
RegCloseKey (key);
|
||||||
|
return status == ERROR_SUCCESS && type == REG_DWORD;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
get_native_arch (void)
|
||||||
|
{
|
||||||
|
SYSTEM_INFO info;
|
||||||
|
|
||||||
|
GetNativeSystemInfo (&info);
|
||||||
|
switch (info.wProcessorArchitecture)
|
||||||
|
{
|
||||||
|
case PROCESSOR_ARCHITECTURE_AMD64:
|
||||||
|
return "x64";
|
||||||
|
case PROCESSOR_ARCHITECTURE_ARM64:
|
||||||
|
return "ARM64";
|
||||||
|
case PROCESSOR_ARCHITECTURE_INTEL:
|
||||||
|
return "x86";
|
||||||
|
default:
|
||||||
|
return "unknown-arch";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static DWORD
|
||||||
|
get_windows_build_number (void)
|
||||||
|
{
|
||||||
|
typedef LONG (WINAPI *RtlGetVersionFn) (PRTL_OSVERSIONINFOW);
|
||||||
|
HMODULE ntdll;
|
||||||
|
RtlGetVersionFn rtl_get_version;
|
||||||
|
RTL_OSVERSIONINFOW version;
|
||||||
|
DWORD build = 0;
|
||||||
|
|
||||||
|
ntdll = GetModuleHandleW (L"ntdll.dll");
|
||||||
|
if (ntdll)
|
||||||
|
{
|
||||||
|
rtl_get_version = (RtlGetVersionFn) GetProcAddress (ntdll, "RtlGetVersion");
|
||||||
|
if (rtl_get_version)
|
||||||
|
{
|
||||||
|
ZeroMemory (&version, sizeof (version));
|
||||||
|
version.dwOSVersionInfoSize = sizeof (version);
|
||||||
|
if (rtl_get_version (&version) == 0)
|
||||||
|
{
|
||||||
|
build = version.dwBuildNumber;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return build;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
build_os_string (void)
|
||||||
|
{
|
||||||
|
static const WCHAR current_version_key[] = L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
|
||||||
|
char *product;
|
||||||
|
char *display_version;
|
||||||
|
char *registry_build;
|
||||||
|
char *fixed_product = NULL;
|
||||||
|
char *result;
|
||||||
|
DWORD ubr = 0;
|
||||||
|
DWORD build;
|
||||||
|
guint64 parsed_build = 0;
|
||||||
|
|
||||||
|
product = read_registry_string (HKEY_LOCAL_MACHINE, current_version_key, L"ProductName");
|
||||||
|
display_version = read_registry_string (HKEY_LOCAL_MACHINE, current_version_key, L"DisplayVersion");
|
||||||
|
registry_build = read_registry_string (HKEY_LOCAL_MACHINE, current_version_key, L"CurrentBuildNumber");
|
||||||
|
read_registry_dword (HKEY_LOCAL_MACHINE, current_version_key, L"UBR", &ubr);
|
||||||
|
|
||||||
|
build = get_windows_build_number ();
|
||||||
|
if (registry_build)
|
||||||
|
{
|
||||||
|
parsed_build = g_ascii_strtoull (registry_build, NULL, 10);
|
||||||
|
if (parsed_build != 0)
|
||||||
|
{
|
||||||
|
build = (DWORD) parsed_build;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!product)
|
||||||
|
{
|
||||||
|
product = g_strdup (build >= 22000 ? "Windows 11" : "Windows");
|
||||||
|
}
|
||||||
|
else if (build >= 22000 && g_str_has_prefix (product, "Windows 10"))
|
||||||
|
{
|
||||||
|
fixed_product = g_strdup_printf ("Windows 11%s", product + strlen ("Windows 10"));
|
||||||
|
g_free (product);
|
||||||
|
product = fixed_product;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (display_version && build != 0)
|
||||||
|
{
|
||||||
|
result = g_strdup_printf ("%s %s" SYSINFO_SEP "build %lu.%lu" SYSINFO_SEP "%s",
|
||||||
|
product, display_version, (unsigned long) build, (unsigned long) ubr, get_native_arch ());
|
||||||
|
}
|
||||||
|
else if (build != 0)
|
||||||
|
{
|
||||||
|
result = g_strdup_printf ("%s" SYSINFO_SEP "build %lu.%lu" SYSINFO_SEP "%s",
|
||||||
|
product, (unsigned long) build, (unsigned long) ubr, get_native_arch ());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = g_strdup_printf ("%s" SYSINFO_SEP "%s", product, get_native_arch ());
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (product);
|
||||||
|
g_free (display_version);
|
||||||
|
g_free (registry_build);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DWORD
|
||||||
|
count_physical_cores (void)
|
||||||
|
{
|
||||||
|
DWORD length = 0;
|
||||||
|
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX buffer;
|
||||||
|
BYTE *cursor;
|
||||||
|
BYTE *end;
|
||||||
|
DWORD cores = 0;
|
||||||
|
|
||||||
|
GetLogicalProcessorInformationEx (RelationProcessorCore, NULL, &length);
|
||||||
|
if (GetLastError () != ERROR_INSUFFICIENT_BUFFER || length == 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer = g_malloc0 (length);
|
||||||
|
if (!GetLogicalProcessorInformationEx (RelationProcessorCore, buffer, &length))
|
||||||
|
{
|
||||||
|
g_free (buffer);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
cursor = (BYTE *) buffer;
|
||||||
|
end = cursor + length;
|
||||||
|
while (cursor < end)
|
||||||
|
{
|
||||||
|
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX info = (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX) cursor;
|
||||||
|
|
||||||
|
if (info->Size == 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (info->Relationship == RelationProcessorCore)
|
||||||
|
{
|
||||||
|
cores++;
|
||||||
|
}
|
||||||
|
cursor += info->Size;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (buffer);
|
||||||
|
return cores;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
build_cpu_string (void)
|
||||||
|
{
|
||||||
|
static const WCHAR cpu_key[] = L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0";
|
||||||
|
char *name;
|
||||||
|
DWORD cores;
|
||||||
|
DWORD threads;
|
||||||
|
SYSTEM_INFO info;
|
||||||
|
char *result;
|
||||||
|
|
||||||
|
name = read_registry_string (HKEY_LOCAL_MACHINE, cpu_key, L"ProcessorNameString");
|
||||||
|
if (!name)
|
||||||
|
{
|
||||||
|
name = g_strdup ("Unknown CPU");
|
||||||
|
}
|
||||||
|
|
||||||
|
cores = count_physical_cores ();
|
||||||
|
threads = GetActiveProcessorCount (ALL_PROCESSOR_GROUPS);
|
||||||
|
if (threads == 0)
|
||||||
|
{
|
||||||
|
GetNativeSystemInfo (&info);
|
||||||
|
threads = info.dwNumberOfProcessors;
|
||||||
|
}
|
||||||
|
if (cores != 0)
|
||||||
|
{
|
||||||
|
result = g_strdup_printf ("%s" SYSINFO_SEP "%luC/%luT",
|
||||||
|
name, (unsigned long) cores, (unsigned long) threads);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Logical processor count cannot establish the physical core count. */
|
||||||
|
result = g_strdup_printf ("%s" SYSINFO_SEP "%luT", name, (unsigned long) threads);
|
||||||
|
}
|
||||||
|
g_free (name);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
join_ptr_array (GPtrArray *items, const char *separator)
|
||||||
|
{
|
||||||
|
GString *joined;
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
if (!items || items->len == 0)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
joined = g_string_new (NULL);
|
||||||
|
for (i = 0; i < items->len; i++)
|
||||||
|
{
|
||||||
|
if (i != 0)
|
||||||
|
{
|
||||||
|
g_string_append (joined, separator);
|
||||||
|
}
|
||||||
|
g_string_append (joined, g_ptr_array_index (items, i));
|
||||||
|
}
|
||||||
|
return g_string_free (joined, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ptr_array_add_unique (GPtrArray *items, const char *value)
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
if (!value || value[0] == '\0')
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < items->len; i++)
|
||||||
|
{
|
||||||
|
if (g_ascii_strcasecmp (g_ptr_array_index (items, i), value) == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g_ptr_array_add (items, g_strdup (value));
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
build_gpu_string (void)
|
||||||
|
{
|
||||||
|
IDXGIFactory1 *factory = NULL;
|
||||||
|
GPtrArray *adapters;
|
||||||
|
UINT index;
|
||||||
|
HRESULT hr;
|
||||||
|
char *result;
|
||||||
|
|
||||||
|
hr = CreateDXGIFactory1 (&IID_IDXGIFactory1, (void **) &factory);
|
||||||
|
if (FAILED (hr) || !factory)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
adapters = g_ptr_array_new_with_free_func (g_free);
|
||||||
|
for (index = 0; ; index++)
|
||||||
|
{
|
||||||
|
IDXGIAdapter1 *adapter = NULL;
|
||||||
|
DXGI_ADAPTER_DESC1 desc;
|
||||||
|
char *name;
|
||||||
|
char *label;
|
||||||
|
|
||||||
|
hr = factory->lpVtbl->EnumAdapters1 (factory, index, &adapter);
|
||||||
|
if (hr == DXGI_ERROR_NOT_FOUND)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (FAILED (hr) || !adapter)
|
||||||
|
{
|
||||||
|
/* A failed enumeration is not another adapter. Retrying every
|
||||||
|
* index can freeze the client indefinitely after a device error. */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZeroMemory (&desc, sizeof (desc));
|
||||||
|
hr = adapter->lpVtbl->GetDesc1 (adapter, &desc);
|
||||||
|
adapter->lpVtbl->Release (adapter);
|
||||||
|
if (FAILED (hr) || (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
name = wide_to_utf8 (desc.Description);
|
||||||
|
if (!name)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
g_strstrip (name);
|
||||||
|
|
||||||
|
if ((guint64) desc.DedicatedVideoMemory >= (512ULL * 1024ULL * 1024ULL))
|
||||||
|
{
|
||||||
|
char *vram = g_format_size_full ((guint64) desc.DedicatedVideoMemory, G_FORMAT_SIZE_IEC_UNITS);
|
||||||
|
label = g_strdup_printf ("%s (%s VRAM)", name, vram);
|
||||||
|
g_free (vram);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
label = g_strdup (name);
|
||||||
|
}
|
||||||
|
|
||||||
|
ptr_array_add_unique (adapters, label);
|
||||||
|
g_free (label);
|
||||||
|
g_free (name);
|
||||||
|
}
|
||||||
|
|
||||||
|
factory->lpVtbl->Release (factory);
|
||||||
|
result = join_ptr_array (adapters, ", ");
|
||||||
|
g_ptr_array_free (adapters, TRUE);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
build_sound_string (void)
|
||||||
|
{
|
||||||
|
UINT count;
|
||||||
|
UINT i;
|
||||||
|
GPtrArray *devices;
|
||||||
|
char *result;
|
||||||
|
|
||||||
|
count = waveOutGetNumDevs ();
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
devices = g_ptr_array_new_with_free_func (g_free);
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
WAVEOUTCAPSW caps;
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
ZeroMemory (&caps, sizeof (caps));
|
||||||
|
if (waveOutGetDevCapsW ((UINT_PTR) i, &caps, sizeof (caps)) != MMSYSERR_NOERROR)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
name = wide_to_utf8 (caps.szPname);
|
||||||
|
if (name)
|
||||||
|
{
|
||||||
|
g_strstrip (name);
|
||||||
|
ptr_array_add_unique (devices, name);
|
||||||
|
g_free (name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result = join_ptr_array (devices, ", ");
|
||||||
|
g_ptr_array_free (devices, TRUE);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ensure_os_snapshot (void)
|
||||||
|
{
|
||||||
|
if (g_once_init_enter (&os_initialized))
|
||||||
|
{
|
||||||
|
snapshot.os = build_os_string ();
|
||||||
|
g_once_init_leave (&os_initialized, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ensure_cpu_snapshot (void)
|
||||||
|
{
|
||||||
|
if (g_once_init_enter (&cpu_initialized))
|
||||||
|
{
|
||||||
|
snapshot.cpu = build_cpu_string ();
|
||||||
|
g_once_init_leave (&cpu_initialized, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ensure_gpu_snapshot (void)
|
||||||
|
{
|
||||||
|
if (g_once_init_enter (&gpu_initialized))
|
||||||
|
{
|
||||||
|
snapshot.gpu = build_gpu_string ();
|
||||||
|
g_once_init_leave (&gpu_initialized, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ensure_sound_snapshot (void)
|
||||||
|
{
|
||||||
|
if (g_once_init_enter (&sound_initialized))
|
||||||
|
{
|
||||||
|
snapshot.sound = build_sound_string ();
|
||||||
|
g_once_init_leave (&sound_initialized, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
format_usage (guint64 total, guint64 available)
|
||||||
|
{
|
||||||
|
guint64 used;
|
||||||
|
char *used_fmt;
|
||||||
|
char *total_fmt;
|
||||||
|
char *result;
|
||||||
|
double percent;
|
||||||
|
|
||||||
|
if (total == 0)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (available > total)
|
||||||
|
{
|
||||||
|
available = total;
|
||||||
|
}
|
||||||
|
used = total - available;
|
||||||
|
percent = ((double) used / (double) total) * 100.0;
|
||||||
|
used_fmt = g_format_size_full (used, G_FORMAT_SIZE_IEC_UNITS);
|
||||||
|
total_fmt = g_format_size_full (total, G_FORMAT_SIZE_IEC_UNITS);
|
||||||
|
result = g_strdup_printf ("%s / %s used (%.0f%%)", used_fmt, total_fmt, percent);
|
||||||
|
g_free (used_fmt);
|
||||||
|
g_free (total_fmt);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
sysinfo_backend_get_os (void)
|
||||||
|
{
|
||||||
|
ensure_os_snapshot ();
|
||||||
|
return g_strdup (snapshot.os);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
sysinfo_backend_get_cpu (void)
|
sysinfo_backend_get_cpu (void)
|
||||||
{
|
{
|
||||||
return sysinfo_get_cpu ();
|
ensure_cpu_snapshot ();
|
||||||
}
|
return g_strdup (snapshot.cpu);
|
||||||
|
|
||||||
char *
|
|
||||||
sysinfo_backend_get_memory (void)
|
|
||||||
{
|
|
||||||
/* Memory information is always loaded dynamically since it includes the current amount of free memory */
|
|
||||||
return get_memory_info ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
sysinfo_backend_get_gpu (void)
|
sysinfo_backend_get_gpu (void)
|
||||||
{
|
{
|
||||||
return sysinfo_get_gpu ();
|
ensure_gpu_snapshot ();
|
||||||
|
return g_strdup (snapshot.gpu);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
sysinfo_backend_get_sound (void)
|
||||||
|
{
|
||||||
|
ensure_sound_snapshot ();
|
||||||
|
return g_strdup (snapshot.sound);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
@@ -96,43 +587,178 @@ sysinfo_backend_get_chipset (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
sysinfo_backend_get_os (void)
|
sysinfo_backend_get_memory (void)
|
||||||
{
|
{
|
||||||
return sysinfo_get_os ();
|
MEMORYSTATUSEX memory;
|
||||||
}
|
|
||||||
|
|
||||||
static char *get_memory_info (void)
|
ZeroMemory (&memory, sizeof (memory));
|
||||||
{
|
memory.dwLength = sizeof (memory);
|
||||||
MEMORYSTATUSEX meminfo = { 0 };
|
if (!GlobalMemoryStatusEx (&memory))
|
||||||
meminfo.dwLength = sizeof (meminfo);
|
|
||||||
|
|
||||||
if (!GlobalMemoryStatusEx (&meminfo))
|
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sysinfo_format_memory (meminfo.ullTotalPhys, meminfo.ullAvailPhys);
|
return format_usage ((guint64) memory.ullTotalPhys, (guint64) memory.ullAvailPhys);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *sysinfo_detect_toolkit(void)
|
char *
|
||||||
|
sysinfo_backend_get_disk (void)
|
||||||
{
|
{
|
||||||
#if defined(USE_GTK_FRONTEND)
|
WCHAR windows_dir[MAX_PATH];
|
||||||
return "GTK3";
|
WCHAR volume_path[MAX_PATH];
|
||||||
#else
|
ULARGE_INTEGER available;
|
||||||
return NULL;
|
ULARGE_INTEGER total;
|
||||||
#endif
|
ULARGE_INTEGER total_free;
|
||||||
|
char *usage;
|
||||||
|
char *volume_utf8;
|
||||||
|
char *result;
|
||||||
|
|
||||||
|
if (GetWindowsDirectoryW (windows_dir, G_N_ELEMENTS (windows_dir)) == 0)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (!GetVolumePathNameW (windows_dir, volume_path, G_N_ELEMENTS (volume_path)))
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (!GetDiskFreeSpaceExW (volume_path, &available, &total, &total_free))
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
usage = format_usage ((guint64) total.QuadPart, (guint64) available.QuadPart);
|
||||||
|
if (!usage)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
volume_utf8 = wide_to_utf8 (volume_path);
|
||||||
|
if (!volume_utf8)
|
||||||
|
{
|
||||||
|
return usage;
|
||||||
|
}
|
||||||
|
g_strchomp (volume_utf8);
|
||||||
|
result = g_strdup_printf ("%s" SYSINFO_SEP "%s", usage, volume_utf8);
|
||||||
|
g_free (volume_utf8);
|
||||||
|
g_free (usage);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
sysinfo_backend_get_uptime (void)
|
||||||
|
{
|
||||||
|
return sysinfo_format_uptime ((gint64) (GetTickCount64 () / 1000ULL));
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
adapter_looks_virtual (const char *name)
|
||||||
|
{
|
||||||
|
char *lower;
|
||||||
|
gboolean result;
|
||||||
|
|
||||||
|
if (!name)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
lower = g_ascii_strdown (name, -1);
|
||||||
|
result = strstr (lower, "virtual") != NULL ||
|
||||||
|
strstr (lower, "hyper-v") != NULL ||
|
||||||
|
strstr (lower, "vmware") != NULL ||
|
||||||
|
strstr (lower, "virtualbox") != NULL ||
|
||||||
|
strstr (lower, "tap-windows") != NULL ||
|
||||||
|
strstr (lower, "wireguard") != NULL ||
|
||||||
|
strstr (lower, "vpn") != NULL;
|
||||||
|
g_free (lower);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
sysinfo_backend_get_network (void)
|
||||||
|
{
|
||||||
|
ULONG size = 16 * 1024;
|
||||||
|
ULONG status;
|
||||||
|
IP_ADAPTER_ADDRESSES *addresses;
|
||||||
|
IP_ADAPTER_ADDRESSES *adapter;
|
||||||
|
GPtrArray *physical;
|
||||||
|
GPtrArray *fallback;
|
||||||
|
GPtrArray *selected;
|
||||||
|
char *result;
|
||||||
|
|
||||||
|
addresses = g_malloc0 (size);
|
||||||
|
status = GetAdaptersAddresses (AF_UNSPEC,
|
||||||
|
GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER,
|
||||||
|
NULL, addresses, &size);
|
||||||
|
if (status == ERROR_BUFFER_OVERFLOW)
|
||||||
|
{
|
||||||
|
g_free (addresses);
|
||||||
|
addresses = g_malloc0 (size);
|
||||||
|
status = GetAdaptersAddresses (AF_UNSPEC,
|
||||||
|
GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER,
|
||||||
|
NULL, addresses, &size);
|
||||||
|
}
|
||||||
|
if (status != NO_ERROR)
|
||||||
|
{
|
||||||
|
g_free (addresses);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
physical = g_ptr_array_new_with_free_func (g_free);
|
||||||
|
fallback = g_ptr_array_new_with_free_func (g_free);
|
||||||
|
for (adapter = addresses; adapter != NULL; adapter = adapter->Next)
|
||||||
|
{
|
||||||
|
char *description;
|
||||||
|
char *friendly;
|
||||||
|
const char *name;
|
||||||
|
const char *type;
|
||||||
|
char *label;
|
||||||
|
|
||||||
|
if (adapter->OperStatus != IfOperStatusUp || adapter->PhysicalAddressLength == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (adapter->IfType != IF_TYPE_ETHERNET_CSMACD && adapter->IfType != IF_TYPE_IEEE80211)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
description = wide_to_utf8 (adapter->Description);
|
||||||
|
friendly = wide_to_utf8 (adapter->FriendlyName);
|
||||||
|
name = description && description[0] ? description : friendly;
|
||||||
|
if (!name)
|
||||||
|
{
|
||||||
|
g_free (description);
|
||||||
|
g_free (friendly);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
type = adapter->IfType == IF_TYPE_IEEE80211 ? "Wi-Fi" : "Ethernet";
|
||||||
|
label = g_strdup_printf ("%s: %s", type, name);
|
||||||
|
ptr_array_add_unique (fallback, label);
|
||||||
|
if (!adapter_looks_virtual (name))
|
||||||
|
{
|
||||||
|
ptr_array_add_unique (physical, label);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (label);
|
||||||
|
g_free (description);
|
||||||
|
g_free (friendly);
|
||||||
|
}
|
||||||
|
g_free (addresses);
|
||||||
|
|
||||||
|
selected = physical->len != 0 ? physical : fallback;
|
||||||
|
result = join_ptr_array (selected, ", ");
|
||||||
|
g_ptr_array_free (physical, TRUE);
|
||||||
|
g_ptr_array_free (fallback, TRUE);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
sysinfo_backend_get_ui (void)
|
sysinfo_backend_get_ui (void)
|
||||||
{
|
{
|
||||||
const char *toolkit = sysinfo_detect_toolkit();
|
#if defined(USE_GTK_FRONTEND)
|
||||||
|
return g_strdup ("Windows / GTK3");
|
||||||
/* On Windows we don't have X11/Wayland. Keep it simple. */
|
#else
|
||||||
if (toolkit)
|
|
||||||
{
|
|
||||||
return g_strdup_printf ("Windows / %s", toolkit);
|
|
||||||
}
|
|
||||||
|
|
||||||
return g_strdup ("Windows");
|
return g_strdup ("Windows");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -430,8 +430,6 @@ const struct prefs vars[] =
|
|||||||
{"gui_lang", P_OFFINT (hex_gui_lang), TYPE_INT},
|
{"gui_lang", P_OFFINT (hex_gui_lang), TYPE_INT},
|
||||||
{"gui_mode_buttons", P_OFFINT (hex_gui_mode_buttons), TYPE_BOOL},
|
{"gui_mode_buttons", P_OFFINT (hex_gui_mode_buttons), TYPE_BOOL},
|
||||||
{"gui_mode_buttons_inline", P_OFFINT (hex_gui_mode_buttons_inline), TYPE_BOOL},
|
{"gui_mode_buttons_inline", P_OFFINT (hex_gui_mode_buttons_inline), TYPE_BOOL},
|
||||||
{"gui_onboarding_disable", P_OFFINT (hex_gui_onboarding_disable), TYPE_BOOL},
|
|
||||||
{"gui_onboarding_pending", P_OFFINT (hex_gui_onboarding_pending), TYPE_BOOL},
|
|
||||||
{"gui_pane_divider_position", P_OFFINT (hex_gui_pane_divider_position), TYPE_INT},
|
{"gui_pane_divider_position", P_OFFINT (hex_gui_pane_divider_position), TYPE_INT},
|
||||||
{"gui_pane_left_size", P_OFFINT (hex_gui_pane_left_size), TYPE_INT},
|
{"gui_pane_left_size", P_OFFINT (hex_gui_pane_left_size), TYPE_INT},
|
||||||
{"gui_pane_right_size", P_OFFINT (hex_gui_pane_right_size), TYPE_INT},
|
{"gui_pane_right_size", P_OFFINT (hex_gui_pane_right_size), TYPE_INT},
|
||||||
|
|||||||
@@ -70,9 +70,6 @@ void fe_add_rawlog (struct server *serv, char *text, int len, int outbound);
|
|||||||
#define FE_MSG_ERROR 8
|
#define FE_MSG_ERROR 8
|
||||||
#define FE_MSG_MARKUP 16
|
#define FE_MSG_MARKUP 16
|
||||||
void fe_message (char *msg, int flags);
|
void fe_message (char *msg, int flags);
|
||||||
#ifdef __linux__
|
|
||||||
void fe_root_warning (void);
|
|
||||||
#endif
|
|
||||||
#define FIA_READ 1
|
#define FIA_READ 1
|
||||||
#define FIA_WRITE 2
|
#define FIA_WRITE 2
|
||||||
#define FIA_EX 4
|
#define FIA_EX 4
|
||||||
|
|||||||
@@ -2826,7 +2826,6 @@ static gboolean
|
|||||||
client_tag_allowed (server *serv, const char *tag)
|
client_tag_allowed (server *serv, const char *tag)
|
||||||
{
|
{
|
||||||
char **deny;
|
char **deny;
|
||||||
gboolean blocked = FALSE;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!serv->have_message_tags)
|
if (!serv->have_message_tags)
|
||||||
@@ -2838,16 +2837,15 @@ client_tag_allowed (server *serv, const char *tag)
|
|||||||
deny = g_strsplit (serv->clienttagdeny, ",", 0);
|
deny = g_strsplit (serv->clienttagdeny, ",", 0);
|
||||||
for (i = 0; deny[i]; i++)
|
for (i = 0; deny[i]; i++)
|
||||||
{
|
{
|
||||||
if (!strcmp (deny[i], "*"))
|
if (!strcmp (deny[i], "*") || !strcmp (deny[i], tag) || (deny[i][0] == '+' && !strcmp (deny[i] + 1, tag)))
|
||||||
blocked = TRUE;
|
{
|
||||||
else if (deny[i][0] == '-' && !strcmp (deny[i] + 1, tag))
|
g_strfreev (deny);
|
||||||
blocked = FALSE;
|
return FALSE;
|
||||||
else if (!strcmp (deny[i], tag) || (deny[i][0] == '+' && !strcmp (deny[i] + 1, tag)))
|
}
|
||||||
blocked = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_strfreev (deny);
|
g_strfreev (deny);
|
||||||
return !blocked;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
|
|||||||
+1
-16
@@ -191,8 +191,6 @@ struct defaultserver
|
|||||||
gboolean ssl;
|
gboolean ssl;
|
||||||
};
|
};
|
||||||
|
|
||||||
static gboolean servlist_needs_onboarding_flag;
|
|
||||||
|
|
||||||
static const struct defaultserver def[] =
|
static const struct defaultserver def[] =
|
||||||
{
|
{
|
||||||
{"2600net", 0},
|
{"2600net", 0},
|
||||||
@@ -1183,10 +1181,7 @@ servlist_load (void)
|
|||||||
|
|
||||||
fp = zoitechat_fopen_file ("servlist.conf", "r", 0);
|
fp = zoitechat_fopen_file ("servlist.conf", "r", 0);
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
|
||||||
servlist_needs_onboarding_flag = TRUE;
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
while (fgets (buf, sizeof (buf) - 2, fp))
|
while (fgets (buf, sizeof (buf) - 2, fp))
|
||||||
{
|
{
|
||||||
@@ -1250,7 +1245,6 @@ servlist_load (void)
|
|||||||
net = servlist_net_add (buf + 2, NULL, FALSE);
|
net = servlist_net_add (buf + 2, NULL, FALSE);
|
||||||
}
|
}
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
servlist_needs_onboarding_flag = (network_list == NULL);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -1259,16 +1253,8 @@ void
|
|||||||
servlist_init (void)
|
servlist_init (void)
|
||||||
{
|
{
|
||||||
if (!network_list)
|
if (!network_list)
|
||||||
{
|
if (!servlist_load ())
|
||||||
if (!servlist_load () || !network_list)
|
|
||||||
servlist_load_defaults ();
|
servlist_load_defaults ();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
servlist_needs_onboarding (void)
|
|
||||||
{
|
|
||||||
return servlist_needs_onboarding_flag;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if a charset is known by Iconv */
|
/* check if a charset is known by Iconv */
|
||||||
@@ -1409,7 +1395,6 @@ servlist_save (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
servlist_needs_onboarding_flag = FALSE;
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,6 @@ extern GSList *network_list;
|
|||||||
#define IRC_DEFAULT_CHARSET "UTF-8 (Unicode)"
|
#define IRC_DEFAULT_CHARSET "UTF-8 (Unicode)"
|
||||||
|
|
||||||
void servlist_init (void);
|
void servlist_init (void);
|
||||||
gboolean servlist_needs_onboarding (void);
|
|
||||||
int servlist_save (void);
|
int servlist_save (void);
|
||||||
int servlist_cycle (server *serv);
|
int servlist_cycle (server *serv);
|
||||||
void servlist_connect (session *sess, ircnet *net, gboolean join);
|
void servlist_connect (session *sess, ircnet *net, gboolean join);
|
||||||
|
|||||||
+1
-21
@@ -95,7 +95,6 @@ int zoitechat_is_quitting = FALSE;
|
|||||||
/* command-line args */
|
/* command-line args */
|
||||||
int arg_dont_autoconnect = FALSE;
|
int arg_dont_autoconnect = FALSE;
|
||||||
int arg_skip_plugins = FALSE;
|
int arg_skip_plugins = FALSE;
|
||||||
gint arg_run_as_root = FALSE;
|
|
||||||
char *arg_url = NULL;
|
char *arg_url = NULL;
|
||||||
char **arg_urls = NULL;
|
char **arg_urls = NULL;
|
||||||
char *arg_command = NULL;
|
char *arg_command = NULL;
|
||||||
@@ -1176,25 +1175,6 @@ main (int argc, char *argv[])
|
|||||||
HRESULT coinit_result;
|
HRESULT coinit_result;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __linux__
|
|
||||||
for (i = 1; i < argc; i++)
|
|
||||||
{
|
|
||||||
if (strcmp (argv[i], "--") == 0)
|
|
||||||
break;
|
|
||||||
if (strcmp (argv[i], "--run-as-root") == 0)
|
|
||||||
{
|
|
||||||
arg_run_as_root = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (geteuid () == 0 && !arg_run_as_root)
|
|
||||||
{
|
|
||||||
fe_root_warning ();
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
srand ((unsigned int) time (NULL)); /* CL: do this only once! */
|
srand ((unsigned int) time (NULL)); /* CL: do this only once! */
|
||||||
|
|
||||||
/* We must check for the config dir parameter, otherwise load_config() will behave incorrectly.
|
/* We must check for the config dir parameter, otherwise load_config() will behave incorrectly.
|
||||||
@@ -1283,7 +1263,7 @@ main (int argc, char *argv[])
|
|||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#ifndef __EMX__
|
#ifndef __EMX__
|
||||||
/* OS/2 uses UID 0 all the time */
|
/* OS/2 uses UID 0 all the time */
|
||||||
if (getuid () == 0 && !arg_run_as_root)
|
if (getuid () == 0)
|
||||||
fe_message (_("* Running IRC as root is stupid! You should\n"
|
fe_message (_("* Running IRC as root is stupid! You should\n"
|
||||||
" create a User Account and use that to login.\n"), FE_MSG_WARN|FE_MSG_WAIT);
|
" create a User Account and use that to login.\n"), FE_MSG_WARN|FE_MSG_WAIT);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -134,8 +134,6 @@ struct zoitechatprefs
|
|||||||
unsigned int hex_gui_join_dialog;
|
unsigned int hex_gui_join_dialog;
|
||||||
unsigned int hex_gui_mode_buttons;
|
unsigned int hex_gui_mode_buttons;
|
||||||
unsigned int hex_gui_mode_buttons_inline;
|
unsigned int hex_gui_mode_buttons_inline;
|
||||||
unsigned int hex_gui_onboarding_disable;
|
|
||||||
unsigned int hex_gui_onboarding_pending;
|
|
||||||
unsigned int hex_gui_quit_dialog;
|
unsigned int hex_gui_quit_dialog;
|
||||||
/* unsigned int hex_gui_single; */
|
/* unsigned int hex_gui_single; */
|
||||||
unsigned int hex_gui_slist_fav;
|
unsigned int hex_gui_slist_fav;
|
||||||
@@ -452,7 +450,6 @@ typedef struct session
|
|||||||
int mode_timeout_tag;
|
int mode_timeout_tag;
|
||||||
int typing_timeout_tag;
|
int typing_timeout_tag;
|
||||||
int typing_status;
|
int typing_status;
|
||||||
gint64 typing_last_sent;
|
|
||||||
int typing_animation_tag;
|
int typing_animation_tag;
|
||||||
int typing_animation_frame;
|
int typing_animation_frame;
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ extern struct zoitechatprefs prefs;
|
|||||||
extern int zoitechat_is_quitting;
|
extern int zoitechat_is_quitting;
|
||||||
extern gint arg_skip_plugins; /* command-line args */
|
extern gint arg_skip_plugins; /* command-line args */
|
||||||
extern gint arg_dont_autoconnect;
|
extern gint arg_dont_autoconnect;
|
||||||
extern gint arg_run_as_root;
|
|
||||||
extern char *arg_url;
|
extern char *arg_url;
|
||||||
extern char **arg_urls;
|
extern char **arg_urls;
|
||||||
extern char *arg_command;
|
extern char *arg_command;
|
||||||
|
|||||||
@@ -90,9 +90,6 @@ static const GOptionEntry gopt_entries[] =
|
|||||||
{"no-auto", 'a', 0, G_OPTION_ARG_NONE, &arg_dont_autoconnect, N_("Don't auto connect to servers"), NULL},
|
{"no-auto", 'a', 0, G_OPTION_ARG_NONE, &arg_dont_autoconnect, N_("Don't auto connect to servers"), NULL},
|
||||||
{"cfgdir", 'd', 0, G_OPTION_ARG_STRING, &arg_cfgdir, N_("Use a different config directory"), "PATH"},
|
{"cfgdir", 'd', 0, G_OPTION_ARG_STRING, &arg_cfgdir, N_("Use a different config directory"), "PATH"},
|
||||||
{"no-plugins", 'n', 0, G_OPTION_ARG_NONE, &arg_skip_plugins, N_("Don't auto load any plugins"), NULL},
|
{"no-plugins", 'n', 0, G_OPTION_ARG_NONE, &arg_skip_plugins, N_("Don't auto load any plugins"), NULL},
|
||||||
#ifdef __linux__
|
|
||||||
{"run-as-root", 0, 0, G_OPTION_ARG_NONE, &arg_run_as_root, N_("Allow ZoiteChat to run as root (unsafe)"), NULL},
|
|
||||||
#endif
|
|
||||||
{"plugindir", 'p', 0, G_OPTION_ARG_NONE, &arg_show_autoload, N_("Show plugin/script auto-load directory"), NULL},
|
{"plugindir", 'p', 0, G_OPTION_ARG_NONE, &arg_show_autoload, N_("Show plugin/script auto-load directory"), NULL},
|
||||||
{"configdir", 'u', 0, G_OPTION_ARG_NONE, &arg_show_config, N_("Show user config directory"), NULL},
|
{"configdir", 'u', 0, G_OPTION_ARG_NONE, &arg_show_config, N_("Show user config directory"), NULL},
|
||||||
{"url", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &arg_url, N_("Open an irc://server:port/channel?key URL"), "URL"},
|
{"url", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &arg_url, N_("Open an irc://server:port/channel?key URL"), "URL"},
|
||||||
@@ -106,33 +103,6 @@ static const GOptionEntry gopt_entries[] =
|
|||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __linux__
|
|
||||||
void
|
|
||||||
fe_root_warning (void)
|
|
||||||
{
|
|
||||||
const char *message =
|
|
||||||
"ZoiteChat refuses to run as root on Linux.\n\n"
|
|
||||||
"Run it as a normal user, or pass --run-as-root to override this protection.";
|
|
||||||
GtkWidget *dialog;
|
|
||||||
|
|
||||||
g_printerr ("%s\n", message);
|
|
||||||
|
|
||||||
/* A graphical session may not be accessible to root, particularly under
|
|
||||||
* Wayland. Keep stderr as the fallback if GTK cannot open the display. */
|
|
||||||
if (!gtk_init_check (NULL, NULL))
|
|
||||||
return;
|
|
||||||
|
|
||||||
dialog = gtk_message_dialog_new (NULL,
|
|
||||||
GTK_DIALOG_MODAL,
|
|
||||||
GTK_MESSAGE_ERROR,
|
|
||||||
GTK_BUTTONS_CLOSE,
|
|
||||||
"%s", message);
|
|
||||||
gtk_window_set_title (GTK_WINDOW (dialog), "ZoiteChat");
|
|
||||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
|
||||||
gtk_widget_destroy (dialog);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
static void
|
static void
|
||||||
create_msg_dialog (gchar *title, gchar *message)
|
create_msg_dialog (gchar *title, gchar *message)
|
||||||
|
|||||||
+14
-27
@@ -778,13 +778,10 @@ mg_inputbox_focus (GtkWidget *widget, GdkEventFocus *event, session_gui *gui)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define TYPING_THROTTLE_USEC (3 * G_USEC_PER_SEC)
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
mg_client_tag_allowed (server *serv, const char *tag)
|
mg_client_tag_allowed (server *serv, const char *tag)
|
||||||
{
|
{
|
||||||
char **deny;
|
char **deny;
|
||||||
gboolean blocked = FALSE;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!serv->have_message_tags)
|
if (!serv->have_message_tags)
|
||||||
@@ -796,42 +793,30 @@ mg_client_tag_allowed (server *serv, const char *tag)
|
|||||||
deny = g_strsplit (serv->clienttagdeny, ",", 0);
|
deny = g_strsplit (serv->clienttagdeny, ",", 0);
|
||||||
for (i = 0; deny[i]; i++)
|
for (i = 0; deny[i]; i++)
|
||||||
{
|
{
|
||||||
if (!strcmp (deny[i], "*"))
|
if (!strcmp (deny[i], "*") || !strcmp (deny[i], tag) || (deny[i][0] == '+' && !strcmp (deny[i] + 1, tag)))
|
||||||
blocked = TRUE;
|
{
|
||||||
else if (deny[i][0] == '-' && !strcmp (deny[i] + 1, tag))
|
g_strfreev (deny);
|
||||||
blocked = FALSE;
|
return FALSE;
|
||||||
else if (!strcmp (deny[i], tag) || (deny[i][0] == '+' && !strcmp (deny[i] + 1, tag)))
|
}
|
||||||
blocked = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_strfreev (deny);
|
g_strfreev (deny);
|
||||||
return !blocked;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static void
|
||||||
mg_typing_can_send (session *sess)
|
|
||||||
{
|
|
||||||
gint64 now = g_get_monotonic_time ();
|
|
||||||
|
|
||||||
return sess->typing_last_sent == 0 ||
|
|
||||||
now - sess->typing_last_sent >= TYPING_THROTTLE_USEC;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
mg_send_typing (session *sess, const char *state)
|
mg_send_typing (session *sess, const char *state)
|
||||||
{
|
{
|
||||||
char tags[32];
|
char tags[32];
|
||||||
|
|
||||||
if (!sess || !sess->server->connected || !mg_client_tag_allowed (sess->server, "typing") || !sess->channel[0])
|
if (!sess || !sess->server->connected || !mg_client_tag_allowed (sess->server, "typing") || !sess->channel[0])
|
||||||
return FALSE;
|
return;
|
||||||
|
|
||||||
if (sess->type != SESS_CHANNEL && sess->type != SESS_DIALOG)
|
if (sess->type != SESS_CHANNEL && sess->type != SESS_DIALOG)
|
||||||
return FALSE;
|
return;
|
||||||
|
|
||||||
g_snprintf (tags, sizeof (tags), "+typing=%s", state);
|
g_snprintf (tags, sizeof (tags), "+typing=%s", state);
|
||||||
sess->server->p_tagmsg (sess->server, tags, sess->channel);
|
sess->server->p_tagmsg (sess->server, tags, sess->channel);
|
||||||
sess->typing_last_sent = g_get_monotonic_time ();
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -860,15 +845,17 @@ mg_typing_update (session *sess, const char *text)
|
|||||||
|
|
||||||
if (!text || !*text || text[0] == prefs.hex_input_command_char[0])
|
if (!text || !*text || text[0] == prefs.hex_input_command_char[0])
|
||||||
{
|
{
|
||||||
if (sess->typing_status && mg_typing_can_send (sess))
|
if (sess->typing_status)
|
||||||
mg_send_typing (sess, "done");
|
mg_send_typing (sess, "done");
|
||||||
sess->typing_status = 0;
|
sess->typing_status = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mg_typing_can_send (sess))
|
if (sess->typing_status != 1)
|
||||||
|
{
|
||||||
mg_send_typing (sess, "active");
|
mg_send_typing (sess, "active");
|
||||||
sess->typing_status = 1;
|
sess->typing_status = 1;
|
||||||
|
}
|
||||||
sess->typing_timeout_tag = fe_timeout_add_seconds (6, mg_typing_pause_cb, sess);
|
sess->typing_timeout_tag = fe_timeout_add_seconds (6, mg_typing_pause_cb, sess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ zoitechat_gtk_ldflags = []
|
|||||||
if host_machine.system() == 'windows'
|
if host_machine.system() == 'windows'
|
||||||
zoitechat_gtk_sources += 'notifications/notification-windows.c'
|
zoitechat_gtk_sources += 'notifications/notification-windows.c'
|
||||||
zoitechat_gtk_deps += cc.find_library('dwmapi', required: true)
|
zoitechat_gtk_deps += cc.find_library('dwmapi', required: true)
|
||||||
zoitechat_gtk_deps += cc.find_library('winhttp', required: true)
|
|
||||||
zoitechat_theme_deps += cc.find_library('dwmapi', required: true)
|
zoitechat_theme_deps += cc.find_library('dwmapi', required: true)
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|||||||
+18
-2828
File diff suppressed because it is too large
Load Diff
@@ -648,9 +648,6 @@ static const char *const proxyuse[] =
|
|||||||
|
|
||||||
static const setting network_settings[] =
|
static const setting network_settings[] =
|
||||||
{
|
{
|
||||||
{ST_HEADER, N_("Startup"), 0, 0, 0, 0},
|
|
||||||
{ST_TOGGLE, N_("Disable first-run assistant"), P_OFFINTNL(hex_gui_onboarding_disable), 0, 0, 0},
|
|
||||||
|
|
||||||
{ST_HEADER, N_("Your Address"), 0, 0, 0, 0},
|
{ST_HEADER, N_("Your Address"), 0, 0, 0, 0},
|
||||||
{ST_ENTRY, N_("Bind to:"), P_OFFSETNL(hex_net_bind_host), 0, 0, sizeof prefs.hex_net_bind_host},
|
{ST_ENTRY, N_("Bind to:"), P_OFFSETNL(hex_net_bind_host), 0, 0, sizeof prefs.hex_net_bind_host},
|
||||||
{ST_LABEL, N_("Only useful for computers with multiple addresses.")},
|
{ST_LABEL, N_("Only useful for computers with multiple addresses.")},
|
||||||
|
|||||||
@@ -1266,6 +1266,8 @@ attr_list_has_attrs (PangoAttrList *attrs)
|
|||||||
static void
|
static void
|
||||||
sexy_spell_entry_recheck_all(SexySpellEntry *entry)
|
sexy_spell_entry_recheck_all(SexySpellEntry *entry)
|
||||||
{
|
{
|
||||||
|
GdkRectangle rect;
|
||||||
|
GtkAllocation allocation;
|
||||||
GtkWidget *widget = GTK_WIDGET(entry);
|
GtkWidget *widget = GTK_WIDGET(entry);
|
||||||
int length, i, text_len;
|
int length, i, text_len;
|
||||||
const char *text;
|
const char *text;
|
||||||
@@ -1297,8 +1299,15 @@ sexy_spell_entry_recheck_all(SexySpellEntry *entry)
|
|||||||
|
|
||||||
gtk_entry_set_attributes (GTK_ENTRY (entry), attr_list_has_attrs (entry->priv->attr_list) ? entry->priv->attr_list : NULL);
|
gtk_entry_set_attributes (GTK_ENTRY (entry), attr_list_has_attrs (entry->priv->attr_list) ? entry->priv->attr_list : NULL);
|
||||||
|
|
||||||
/* GtkEntry shares its parent's GdkWindow in GTK3; redraw the widget area. */
|
if (gtk_widget_get_realized (GTK_WIDGET(entry)))
|
||||||
gtk_widget_queue_draw (widget);
|
{
|
||||||
|
gtk_widget_get_allocation (GTK_WIDGET(entry), &allocation);
|
||||||
|
|
||||||
|
rect.x = 0; rect.y = 0;
|
||||||
|
rect.width = allocation.width;
|
||||||
|
rect.height = allocation.height;
|
||||||
|
gdk_window_invalidate_rect(gtk_widget_get_window (widget), &rect, TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|||||||
@@ -683,7 +683,7 @@ theme_manager_get_userlist_palette_behavior (const PangoFontDescription *font_de
|
|||||||
|
|
||||||
behavior.font_desc = font_desc;
|
behavior.font_desc = font_desc;
|
||||||
behavior.apply_background = TRUE;
|
behavior.apply_background = TRUE;
|
||||||
behavior.apply_foreground = prefs.hex_gui_ulist_color ? FALSE : TRUE;
|
behavior.apply_foreground = (prefs.hex_gui_ulist_color || prefs.hex_text_color_nicks) ? FALSE : TRUE;
|
||||||
|
|
||||||
return behavior;
|
return behavior;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -594,7 +594,7 @@ fe_userlist_rehash (session *sess, struct User *user)
|
|||||||
nick_token = THEME_TOKEN_TAB_AWAY;
|
nick_token = THEME_TOKEN_TAB_AWAY;
|
||||||
have_nick_token = TRUE;
|
have_nick_token = TRUE;
|
||||||
}
|
}
|
||||||
else if (prefs.hex_gui_ulist_color)
|
else if (prefs.hex_gui_ulist_color || prefs.hex_text_color_nicks)
|
||||||
{
|
{
|
||||||
int mirc_index = text_color_of (user->nick);
|
int mirc_index = text_color_of (user->nick);
|
||||||
|
|
||||||
@@ -635,7 +635,7 @@ fe_userlist_insert (session *sess, struct User *newuser, gboolean sel)
|
|||||||
nick_token = THEME_TOKEN_TAB_AWAY;
|
nick_token = THEME_TOKEN_TAB_AWAY;
|
||||||
have_nick_token = TRUE;
|
have_nick_token = TRUE;
|
||||||
}
|
}
|
||||||
else if (prefs.hex_gui_ulist_color)
|
else if (prefs.hex_gui_ulist_color || prefs.hex_text_color_nicks)
|
||||||
{
|
{
|
||||||
int mirc_index = text_color_of (newuser->nick);
|
int mirc_index = text_color_of (newuser->nick);
|
||||||
|
|
||||||
|
|||||||
+3
-57
@@ -273,8 +273,6 @@ static void gtk_xtext_render_page (GtkXText * xtext);
|
|||||||
static void gtk_xtext_calc_lines (xtext_buffer *buf, int);
|
static void gtk_xtext_calc_lines (xtext_buffer *buf, int);
|
||||||
static gboolean gtk_xtext_is_selecting (GtkXText *xtext);
|
static gboolean gtk_xtext_is_selecting (GtkXText *xtext);
|
||||||
static char *gtk_xtext_selection_get_text (GtkXText *xtext, int *len_ret);
|
static char *gtk_xtext_selection_get_text (GtkXText *xtext, int *len_ret);
|
||||||
static void gtk_xtext_clipboard_get (GtkClipboard *, GtkSelectionData *, guint, gpointer);
|
|
||||||
static void gtk_xtext_clipboard_clear (GtkClipboard *, gpointer);
|
|
||||||
static textentry *gtk_xtext_nth (GtkXText *xtext, int line, int *subline);
|
static textentry *gtk_xtext_nth (GtkXText *xtext, int line, int *subline);
|
||||||
static void gtk_xtext_adjustment_changed (GtkAdjustment * adj,
|
static void gtk_xtext_adjustment_changed (GtkAdjustment * adj,
|
||||||
GtkXText * xtext);
|
GtkXText * xtext);
|
||||||
@@ -1084,29 +1082,9 @@ gtk_xtext_new (const XTextColor *palette, int separator)
|
|||||||
return GTK_WIDGET (xtext);
|
return GTK_WIDGET (xtext);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_xtext_release_selections (GtkXText *xtext)
|
|
||||||
{
|
|
||||||
GdkAtom selections[] = { GDK_SELECTION_PRIMARY, GDK_SELECTION_SECONDARY };
|
|
||||||
guint i;
|
|
||||||
|
|
||||||
if (!gtk_widget_has_screen (GTK_WIDGET (xtext)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (selections); i++)
|
|
||||||
{
|
|
||||||
GtkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (xtext), selections[i]);
|
|
||||||
|
|
||||||
if (gtk_clipboard_get_owner (clipboard) == G_OBJECT (xtext))
|
|
||||||
gtk_clipboard_clear (clipboard);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_xtext_cleanup (GtkXText *xtext)
|
gtk_xtext_cleanup (GtkXText *xtext)
|
||||||
{
|
{
|
||||||
gtk_xtext_release_selections (xtext);
|
|
||||||
|
|
||||||
if (xtext->add_io_tag)
|
if (xtext->add_io_tag)
|
||||||
{
|
{
|
||||||
g_source_remove (xtext->add_io_tag);
|
g_source_remove (xtext->add_io_tag);
|
||||||
@@ -1201,7 +1179,6 @@ gtk_xtext_finalize (GObject *object)
|
|||||||
static void
|
static void
|
||||||
gtk_xtext_unrealize (GtkWidget * widget)
|
gtk_xtext_unrealize (GtkWidget * widget)
|
||||||
{
|
{
|
||||||
gtk_xtext_release_selections (GTK_XTEXT (widget));
|
|
||||||
backend_deinit (GTK_XTEXT (widget));
|
backend_deinit (GTK_XTEXT (widget));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2766,16 +2743,8 @@ gtk_xtext_set_clip_owner (GtkWidget * xtext, GdkEventButton * event)
|
|||||||
{
|
{
|
||||||
gtk_clipboard_set_text (gtk_widget_get_clipboard (xtext, GDK_SELECTION_CLIPBOARD), str, len);
|
gtk_clipboard_set_text (gtk_widget_get_clipboard (xtext, GDK_SELECTION_CLIPBOARD), str, len);
|
||||||
|
|
||||||
/* Let GtkClipboard own the X11 selection window. Making xtext
|
gtk_selection_owner_set (xtext, GDK_SELECTION_PRIMARY, event ? event->time : GDK_CURRENT_TIME);
|
||||||
* the selection owner forces its window native and bypasses
|
gtk_selection_owner_set (xtext, GDK_SELECTION_SECONDARY, event ? event->time : GDK_CURRENT_TIME);
|
||||||
* GTK's toplevel backing buffer on subsequent redraws.
|
|
||||||
*/
|
|
||||||
gtk_clipboard_set_with_owner (gtk_widget_get_clipboard (xtext, GDK_SELECTION_PRIMARY),
|
|
||||||
gtk_xtext_selection_targets, G_N_ELEMENTS (gtk_xtext_selection_targets),
|
|
||||||
gtk_xtext_clipboard_get, gtk_xtext_clipboard_clear, G_OBJECT (xtext));
|
|
||||||
gtk_clipboard_set_with_owner (gtk_widget_get_clipboard (xtext, GDK_SELECTION_SECONDARY),
|
|
||||||
gtk_xtext_selection_targets, G_N_ELEMENTS (gtk_xtext_selection_targets),
|
|
||||||
gtk_xtext_clipboard_get, gtk_xtext_clipboard_clear, G_OBJECT (xtext));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (str);
|
g_free (str);
|
||||||
@@ -3203,7 +3172,7 @@ gtk_xtext_selection_get (GtkWidget * widget,
|
|||||||
if (!window || !GDK_IS_WINDOW (window))
|
if (!window || !GDK_IS_WINDOW (window))
|
||||||
break;
|
break;
|
||||||
display = gdk_window_get_display (window);
|
display = gdk_window_get_display (window);
|
||||||
if (!display || !GDK_IS_X11_DISPLAY (display))
|
if (!display)
|
||||||
break;
|
break;
|
||||||
GdkAtom encoding;
|
GdkAtom encoding;
|
||||||
gint format;
|
gint format;
|
||||||
@@ -3228,29 +3197,6 @@ gtk_xtext_selection_get (GtkWidget * widget,
|
|||||||
g_free (stripped);
|
g_free (stripped);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_xtext_clipboard_get (GtkClipboard *clipboard, GtkSelectionData *selection_data,
|
|
||||||
guint info, gpointer owner)
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
char *text = gtk_xtext_selection_get_text (GTK_XTEXT (owner), &len);
|
|
||||||
|
|
||||||
if (text)
|
|
||||||
{
|
|
||||||
gtk_selection_data_set_text (selection_data, text, len);
|
|
||||||
g_free (text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_xtext_clipboard_clear (GtkClipboard *clipboard, gpointer owner)
|
|
||||||
{
|
|
||||||
GtkXText *xtext = GTK_XTEXT (owner);
|
|
||||||
|
|
||||||
if (xtext->orig_buffer)
|
|
||||||
gtk_xtext_selection_kill (xtext, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_xtext_scroll (GtkWidget *widget, GdkEventScroll *event)
|
gtk_xtext_scroll (GtkWidget *widget, GdkEventScroll *event)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -467,9 +467,6 @@ static const GOptionEntry gopt_entries[] =
|
|||||||
{"no-auto", 'a', 0, G_OPTION_ARG_NONE, &arg_dont_autoconnect, N_("Don't auto connect to servers"), NULL},
|
{"no-auto", 'a', 0, G_OPTION_ARG_NONE, &arg_dont_autoconnect, N_("Don't auto connect to servers"), NULL},
|
||||||
{"cfgdir", 'd', 0, G_OPTION_ARG_STRING, &arg_cfgdir, N_("Use a different config directory"), "PATH"},
|
{"cfgdir", 'd', 0, G_OPTION_ARG_STRING, &arg_cfgdir, N_("Use a different config directory"), "PATH"},
|
||||||
{"no-plugins", 'n', 0, G_OPTION_ARG_NONE, &arg_skip_plugins, N_("Don't auto load any plugins"), NULL},
|
{"no-plugins", 'n', 0, G_OPTION_ARG_NONE, &arg_skip_plugins, N_("Don't auto load any plugins"), NULL},
|
||||||
#ifdef __linux__
|
|
||||||
{"run-as-root", 0, 0, G_OPTION_ARG_NONE, &arg_run_as_root, N_("Allow ZoiteChat to run as root (unsafe)"), NULL},
|
|
||||||
#endif
|
|
||||||
{"plugindir", 'p', 0, G_OPTION_ARG_NONE, &arg_show_autoload, N_("Show plugin/script auto-load directory"), NULL},
|
{"plugindir", 'p', 0, G_OPTION_ARG_NONE, &arg_show_autoload, N_("Show plugin/script auto-load directory"), NULL},
|
||||||
{"configdir", 'u', 0, G_OPTION_ARG_NONE, &arg_show_config, N_("Show user config directory"), NULL},
|
{"configdir", 'u', 0, G_OPTION_ARG_NONE, &arg_show_config, N_("Show user config directory"), NULL},
|
||||||
{"url", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &arg_url, N_("Open an irc://server:port/channel URL"), "URL"},
|
{"url", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &arg_url, N_("Open an irc://server:port/channel URL"), "URL"},
|
||||||
@@ -478,16 +475,6 @@ static const GOptionEntry gopt_entries[] =
|
|||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __linux__
|
|
||||||
void
|
|
||||||
fe_root_warning (void)
|
|
||||||
{
|
|
||||||
fputs ("ZoiteChat refuses to run as root on Linux.\n"
|
|
||||||
"Run it as a normal user, or pass --run-as-root to override this protection.\n",
|
|
||||||
stderr);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
int
|
||||||
fe_args (int argc, char *argv[])
|
fe_args (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user