mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-07-08 12:59:24 +00:00
Compare commits
3 Commits
Windows/py
...
win32-task
| Author | SHA1 | Date | |
|---|---|---|---|
| 9465a1e0a8 | |||
|
|
8466e70424 | ||
| b85229f1a1 |
File diff suppressed because it is too large
Load Diff
@@ -67,6 +67,34 @@
|
||||
#include <shellapi.h>
|
||||
#include <gdk/gdkwin32.h>
|
||||
|
||||
/* The shell only minimizes a window from its taskbar button when the
|
||||
* window style carries WS_MINIMIZEBOX; without it the click merely
|
||||
* deactivates the window (issue #65). GTK3 older than 3.24.50 can drop
|
||||
* the bit from top-level windows (https://gitlab.gnome.org/GNOME/gtk/-/issues/7494),
|
||||
* so guarantee it ourselves for session windows. */
|
||||
static void
|
||||
mg_win32_ensure_minimizable (GdkWindow *gdk_window)
|
||||
{
|
||||
HWND hwnd;
|
||||
LONG_PTR window_style;
|
||||
|
||||
if (!gdk_window)
|
||||
return;
|
||||
|
||||
hwnd = gdk_win32_window_get_handle (gdk_window);
|
||||
if (!hwnd)
|
||||
return;
|
||||
|
||||
window_style = GetWindowLongPtr (hwnd, GWL_STYLE);
|
||||
if (!window_style || (window_style & WS_MINIMIZEBOX))
|
||||
return;
|
||||
|
||||
SetWindowLongPtr (hwnd, GWL_STYLE, window_style | WS_MINIMIZEBOX);
|
||||
SetWindowPos (hwnd, NULL, 0, 0, 0, 0,
|
||||
SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE |
|
||||
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER);
|
||||
}
|
||||
|
||||
static void
|
||||
mg_win32_allow_autohide_taskbar (GtkWindow *window, GdkEventWindowState *event)
|
||||
{
|
||||
@@ -3388,10 +3416,19 @@ mg_topicbar_update_height (GtkWidget *topic)
|
||||
|
||||
if (parent && GTK_IS_SCROLLED_WINDOW (parent))
|
||||
{
|
||||
gtk_scrolled_window_set_max_content_height (GTK_SCROLLED_WINDOW (parent), -1);
|
||||
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (parent), -1);
|
||||
gtk_scrolled_window_set_max_content_height (GTK_SCROLLED_WINDOW (parent), target_height);
|
||||
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (parent), target_height);
|
||||
GtkScrolledWindow *scrolled = GTK_SCROLLED_WINDOW (parent);
|
||||
int max_height = gtk_scrolled_window_get_max_content_height (scrolled);
|
||||
|
||||
if (max_height != -1 && target_height > max_height)
|
||||
{
|
||||
gtk_scrolled_window_set_max_content_height (scrolled, target_height);
|
||||
gtk_scrolled_window_set_min_content_height (scrolled, target_height);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_scrolled_window_set_min_content_height (scrolled, target_height);
|
||||
gtk_scrolled_window_set_max_content_height (scrolled, target_height);
|
||||
}
|
||||
gtk_widget_set_size_request (parent, -1, target_height);
|
||||
}
|
||||
}
|
||||
@@ -4976,6 +5013,7 @@ mg_create_topwindow (session *sess)
|
||||
#ifdef G_OS_WIN32
|
||||
parent_win = gtk_widget_get_window (win);
|
||||
gdk_window_add_filter (parent_win, mg_win32_filter, NULL);
|
||||
mg_win32_ensure_minimizable (parent_win);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -5012,6 +5050,18 @@ mg_win32_filter (GdkXEvent *xevent, GdkEvent *event, gpointer data)
|
||||
if (!msg)
|
||||
return GDK_FILTER_CONTINUE;
|
||||
|
||||
if (msg->message == WM_STYLECHANGING && msg->wParam == (WPARAM)GWL_STYLE)
|
||||
{
|
||||
STYLESTRUCT *style = (STYLESTRUCT *)msg->lParam;
|
||||
|
||||
/* Keep the window minimizable from its taskbar button; see
|
||||
* mg_win32_ensure_minimizable (). */
|
||||
if (style)
|
||||
style->styleNew |= WS_MINIMIZEBOX;
|
||||
|
||||
return GDK_FILTER_CONTINUE;
|
||||
}
|
||||
|
||||
if (msg->message == WM_TIMECHANGE)
|
||||
{
|
||||
_tzset();
|
||||
@@ -5161,6 +5211,7 @@ mg_create_tabwindow (session *sess)
|
||||
#ifdef G_OS_WIN32
|
||||
parent_win = gtk_widget_get_window (win);
|
||||
gdk_window_add_filter (parent_win, mg_win32_filter, NULL);
|
||||
mg_win32_ensure_minimizable (parent_win);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -52,14 +52,13 @@ static const guint8 theme_default_99_mirc_colors[THEME_XTEXT_MIRC_COLS][3] = {
|
||||
};
|
||||
|
||||
static void
|
||||
theme_access_apply_default_99_palette (XTextColor *palette, size_t palette_len, gboolean apply_base)
|
||||
theme_access_apply_default_99_palette (XTextColor *palette, size_t palette_len)
|
||||
{
|
||||
size_t i;
|
||||
size_t start = apply_base ? 0 : 32;
|
||||
|
||||
if (palette_len == 0)
|
||||
return;
|
||||
for (i = start; i < THEME_XTEXT_MIRC_COLS && i < palette_len; i++)
|
||||
for (i = 32; i < THEME_XTEXT_MIRC_COLS && i < palette_len; i++)
|
||||
{
|
||||
palette[i].red = theme_default_99_mirc_colors[i][0] / 255.0;
|
||||
palette[i].green = theme_default_99_mirc_colors[i][1] / 255.0;
|
||||
@@ -148,11 +147,10 @@ gboolean
|
||||
theme_get_mirc_color (unsigned int mirc_index, GdkRGBA *out_rgba)
|
||||
{
|
||||
ThemeSemanticToken token = (ThemeSemanticToken) (THEME_TOKEN_MIRC_0 + (int) mirc_index);
|
||||
gboolean has_user_colors = theme_runtime_mode_has_user_colors (theme_runtime_is_dark_active ());
|
||||
|
||||
if (mirc_index >= THEME_XTEXT_MIRC_COLS)
|
||||
return FALSE;
|
||||
if (!has_user_colors || mirc_index >= 32)
|
||||
if (mirc_index >= 32)
|
||||
{
|
||||
out_rgba->red = theme_default_99_mirc_colors[mirc_index][0] / 255.0;
|
||||
out_rgba->green = theme_default_99_mirc_colors[mirc_index][1] / 255.0;
|
||||
@@ -173,11 +171,10 @@ gboolean
|
||||
theme_get_mirc_color_rgb16 (unsigned int mirc_index, guint16 *red, guint16 *green, guint16 *blue)
|
||||
{
|
||||
ThemeSemanticToken token = (ThemeSemanticToken) (THEME_TOKEN_MIRC_0 + (int) mirc_index);
|
||||
gboolean has_user_colors = theme_runtime_mode_has_user_colors (theme_runtime_is_dark_active ());
|
||||
|
||||
if (mirc_index >= THEME_XTEXT_MIRC_COLS)
|
||||
return FALSE;
|
||||
if (!has_user_colors || mirc_index >= 32)
|
||||
if (mirc_index >= 32)
|
||||
{
|
||||
*red = (guint16) (theme_default_99_mirc_colors[mirc_index][0] * 257);
|
||||
*green = (guint16) (theme_default_99_mirc_colors[mirc_index][1] * 257);
|
||||
@@ -227,7 +224,6 @@ void
|
||||
theme_get_xtext_colors_for_widget (GtkWidget *widget, XTextColor *palette, size_t palette_len)
|
||||
{
|
||||
ThemeWidgetStyleValues style_values;
|
||||
gboolean has_user_colors;
|
||||
GdkRGBA marker_color;
|
||||
|
||||
if (!palette)
|
||||
@@ -235,9 +231,8 @@ theme_get_xtext_colors_for_widget (GtkWidget *widget, XTextColor *palette, size_
|
||||
|
||||
theme_get_widget_style_values_for_widget (widget, &style_values);
|
||||
theme_runtime_get_xtext_colors (palette, palette_len);
|
||||
has_user_colors = theme_runtime_mode_has_user_colors (theme_runtime_is_dark_active ());
|
||||
if (palette_len >= THEME_XTEXT_MIRC_COLS)
|
||||
theme_access_apply_default_99_palette (palette, palette_len, !has_user_colors);
|
||||
theme_access_apply_default_99_palette (palette, palette_len);
|
||||
if (palette_len > THEME_XTEXT_MARK_FG_INDEX)
|
||||
{
|
||||
palette[THEME_XTEXT_MARK_FG_INDEX].red = style_values.selection_foreground.red;
|
||||
|
||||
Reference in New Issue
Block a user