Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.0, 1.0.1, and 1.0.2

shellext: implement thgtaskbar.exe termination over pipe

Build a new target 'terminate.exe', which sends the overlay icon update
server (thgtaskbar.exe) a terminate command over the pipe.

Implement the terminate command in the pipe server thread of thgtaskbar.py.

Changeset ff0cede782a4

Parent 449db6a44726

by Adrian Buehlmann

Changes to 4 files · Browse files at ff0cede782a4 Showing diff from parent 449db6a44726 Diff from another changeset...

Change 1 of 3 Show Entire File thgtaskbar.py Stacked
 
104
105
106
107
 
 
 
 
108
109
110
 
339
340
341
 
342
343
344
 
412
413
414
 
 
 
 
 
415
416
417
 
104
105
106
 
107
108
109
110
111
112
113
 
342
343
344
345
346
347
348
 
416
417
418
419
420
421
422
423
424
425
426
@@ -104,7 +104,10 @@
    def OnDestroy(self, hwnd, msg, wparam, lparam):   nid = (self.hwnd, 0) - Shell_NotifyIcon(NIM_DELETE, nid) + try: + Shell_NotifyIcon(NIM_DELETE, nid) + except pywintypes.error: + pass # happens when we run without icon   PostQuitMessage(0) # Terminate the app.     def OnTaskbarNotify(self, hwnd, msg, wparam, lparam): @@ -339,6 +342,7 @@
   class PipeServer:   def __init__(self, hwnd): + self.hwnd = hwnd   self.updater = Updater(hwnd)   self.updater.start()   @@ -412,6 +416,11 @@
    try:   requests.put(data) + if data == 'terminate|': + print 'PipeServer received terminate from pipe' + print 'posting EXIT_CMD to gui thread...' + PostMessage(self.hwnd, win32con.WM_COMMAND, EXIT_CMD, 0) + break   except SystemExit:   raise SystemExit # interrupted by thread2.terminate()   except:
 
21
22
23
 
 
 
 
 
 
 
 
 
24
25
26
 
30
31
32
 
33
34
35
 
36
37
38
 
44
45
46
 
 
 
 
 
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 
39
40
41
42
43
44
 
45
46
47
48
 
54
55
56
57
58
59
60
@@ -21,6 +21,15 @@
  Thgstatus.obj \   QueryDirstate.obj   +# TODO: Break link dependencies: Thgstatus needs ThgDebug if compiled with +# /DTHG_DEBUG, which in turn depends on TortoiseUtils and then even +# IconBitmapUtils and SysInfo +OBJECTS_TERMINATE = TortoiseUtils.obj \ + SysInfo.obj \ + IconBitmapUtils.obj \ + Thgstatus.obj \ + ThgDebug.obj +  LIBS = shlwapi.lib gdiplus.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  DEFFILE = ShellExt.def   @@ -30,9 +39,10 @@
 BASE_LDFLAGS = /nologo /INCREMENTAL:NO /MANIFEST $(LIBS)  LDFLAGS_THGSHELL = $(BASE_LDFLAGS) /DLL /DEF:$(DEFFILE)  LDFLAGS_DIRSTATE = $(BASE_LDFLAGS) /SUBSYSTEM:CONSOLE +LDFLAGS_TERMINATE = $(BASE_LDFLAGS) /SUBSYSTEM:CONSOLE     -all: THgShell.dll +all: THgShell.dll terminate.exe    clean:   del *.obj *.dll *.exe *.lib *.exp *.manifest @@ -44,3 +54,7 @@
 dirstate.exe: dirstate.obj $(OBJECTS_DIRSTATE)   link /OUT:$@ $(LDFLAGS_DIRSTATE) $**   mt -nologo -manifest $@.manifest -outputresource:"$@;#1" + +terminate.exe: terminate.obj $(OBJECTS_TERMINATE) + link /OUT:$@ $(LDFLAGS_TERMINATE) $** + mt -nologo -manifest $@.manifest -outputresource:"$@;#1"
 
33
34
35
 
 
 
36
37
38
 
33
34
35
36
37
38
39
40
41
@@ -33,6 +33,9 @@
  static int error(const std::string& text) {   return SendRequest("error|" + text);   } + static int terminate() { + return SendRequest("terminate|"); + }  };    #endif
Change 1 of 1 Show Entire File win32/​shellext/​terminate.cpp Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
@@ -0,0 +1,11 @@
+// terminates the overlay icon server + +#include "stdafx.h" + +#include "Thgstatus.h" + +int main(int argc, char *argv[]) +{ + Thgstatus::terminate(); + return 0; +}