GNOME Bugzilla – Bug 537183
gtk_window_set_skip_taskbar_hint not working on Win32
Last modified: 2018-02-10 03:35:50 UTC
Please describe the problem: Hi, I have developed a program in which the user can minimize the window to the system tray. This is done by using the GtkStatusIcon and catching the 'window_state_changed' signal (from GtkWindow). In the 'window_state_changed' callback function I check whether an minimize just occured and if so, call gtk_window_set_skip_taskbar_hint(TRUE) to remove the program from the task bar. On Linux this works fine, but under Windows (Vista) the program doesn't disappear from the taskbar. Attached testcase demonstrates this behaviour Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information:
Created attachment 112344 [details] Testcase This testcase is used against GTK 2.13.2
I think the taskbar skipping is closely related to how transient/modal windows are implemented in the Win32 backend. I may have broken this while I was trying to fix the transient/modal window problems. I'll try to take a look at this whenever I have time to work on the Win32 code again.
I just looked at the GDK source and I've found out that you put a comment in the function gdk_window_set_skip_taskbar_hint()... ### TODO: Need to figure out what to do here. ... followed by a return; This was done in revision 18929: http://svn.gnome.org/viewvc/gtk%2B?view=revision&revision=18929 I've tried reverting this change. The hiding of the window now works, but the 'un-hiding' doesn't.
Created attachment 112508 [details] [review] Proposed patch Attached patch should make the function gtk_window_set_skip_taskbar_hint() work properly on Win32 I've also removed the #if 0 block as it doesn't have anything to do with removing the window from the taskbar and it hasn't been touched since 2003 (http://svn.gnome.org/viewvc/gtk%2B?view=revision&revision=9225)
Created attachment 112509 [details] Another testcase I've also updated the original testcase. This testcase switches the skip_taskbar_hint flag every 2 seconds. The proposed patch introduces a slight flicker every time the skip_taskbar_hint function is called, but normally it is only called on initialisation or on minimize (to tray), so this shouldn't be too much of an issue
This is almost certainly going to confuse the transient window code, but I'll try to take a look at it this weekend and test it out.
After further testing I've found my proposed patch introduces a regression.. When trying to show a context menu (gtk_menu_popup), the context menu immediately disappears (just a quick flash)
*** Bug 568888 has been marked as a duplicate of this bug. ***
any updates on this? this bug has been open for nearly a year now.
I still see the bug in GTK2.14.3
> this bug has been open for nearly a year now OK, so feel free to ask for your money back then.
(In reply to comment #11) > OK, so feel free to ask for your money back then. No need to get cranky, Just asking for an update..geez
I have te same problem... But after some searches on Google, i found some pieces of answer and i made a function to make the trick for Windows.... void showWindowInTaskBar(gboolean bool) { HWND handle; handle=(HWND)gdk_win32_drawable_get_handle(pWindow->window); if(bool) { SetWindowLong(handle, GWL_EXSTYLE, GetWindowLong(handle, GWL_EXSTYLE) & ~WS_EX_APPWINDOW); SetWindowPos(handle, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); SetForegroundWindow(handle); ShowWindow(handle, SW_SHOW); } else { ShowWindow(handle, SW_HIDE); } } pWindow is a GtkWidget* and the main window of my application. This function hide the window in taskbar when bool=FALSE and show the window in taskbar + get the focus when bool=TRUE It could be used while the bug is not yet fixed in GTK...
I'm a humble Pidgin user that doesn't like taskbar entries, and through some Googling came down to this RFE http://developer.pidgin.im/ticket/9690 pointing the problem to this bug. Just wanted to let the people here know this bug could affect a lot of Windows users looking for a fix.
The fix is easy: Use Linux instead.
*** Bug 613190 has been marked as a duplicate of this bug. ***
(In reply to comment #15) > The fix is easy: Use Linux instead. Attitudes like this are a large part of why Linux software gets almost no love outside the developer community and little love within it. GTK+ is supposed to be one of those "important" foundational components, and it's evidently maintained by an anti-social neckbeard who can't fake professionalism. Suggesting that the user use an entirely new operating system, and all the trouble switching entails, suggests laziness to the highest degree, apathy to the problem, hatred of the spirit of the developer community, and it no doubt makes every one who reads this thread a little more anti-Linux and Open Source.
I would post a witty reply if I wasn't too lazy.
So has anyone tried this quick fix (https://bugzilla.gnome.org/show_bug.cgi?id=537183#c13) from comment #13 above or Erik's patch (comment #7)? Is there any other status on this bug?
about the proposed patch Erik van Pienbroek.... I already use a workaround on my programs using the same SetWindowLong to hide taskbar. sometimes I need to do it 3 or more times to work. look that I not using that patch, just a workaround. maybe some function of gtk restores the SetWindowLong. I'm commenting this just to help. regards
We're moving to gitlab! As part of this move, we are closing bugs that haven't seen activity in more than 5 years. If this issue is still imporant to you and still relevant with GTK+ 3.22 or master, please consider creating a gitlab issue for it.