[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #11429 [meek]: meek-http-helper opens up a second dock icon



#11429: meek-http-helper opens up a second dock icon
------------------------+-----------------
     Reporter:  dcf     |      Owner:  dcf
         Type:  defect  |     Status:  new
     Priority:  normal  |  Milestone:
    Component:  meek    |    Version:
   Resolution:          |   Keywords:
Actual Points:          |  Parent ID:
       Points:          |
------------------------+-----------------

Comment (by lunar):

 Other examples: [https://github.com/albertz/google-books-
 export/blob/master/google-books-export.py#L188 `hideMacDockIcon()` in
 Python], [https://github.com/albertz/google-books-export/blob/master
 /google-books-export.py#L164 `showMacDockIcon()` in Python]

 The following piece of code is absolutely untested but should help:

 {{{
 Components.utils.import("resource://gre/modules/ctypes.jsm");

 var carbon =
 ctypes.open("/System/Library/Frameworks/Carbon.framework/Carbon");

 /* MacTypes.h */
 var OSStatus = ctypes.c_int32;

 /* Processes.h
  *
  * struct ProcessSerialNumber {
  *   unsigned long highLongOfPSN;
  *   unsigned long lowLongOfPSN;
  * };
  *
  * enum {
  *   kNoProcess = 0,
  *   kSystemProcess = 1,
  *   kCurrentProcess = 2
  * };
  */

 var ProcessSerialNumber = StructType("ProcessSerialNumber",
                                      [ { "highLongOfPSN":
 ctypes.unsigned_long,
                                           "lowLongOfPSN":
 ctypes.unsigned_long,
                                         } ]);
 var kCurrentProcess = 2;

 /* Processes.h
  *
  * enum {
  *   kProcessTransformToForegroundApplication = 1L,
  *   kProcessTransformToBackgroundApplication = 2L,
  *   kProcessTransformToUIElementApplication = 4L,
  * };
  * typedef UInt32 ProcessApplicationTransformState;
  */

 var ProcessApplicationTransformState = ctypes.c_uint32;
 var kProcessTransformToUIElementApplication = 4;

 /* Processes.h
  *
  * OSStatus TransformProcessType (
  *   const ProcessSerialNumber *psn,
  *   ProcessApplicationTransformState transformState
  * );
  */
 var TransformProcessType = carbon.declare("TransformProcessType",
                                           ctypes.default_abi,
                                           OSStatus /* return type */,
 ctypes.PointerType(ProcessSerialNumber),
 ProcessApplicationTransformState);

 var psn = ProcessSerialNumber();
 psn.highLongOfPSN = 0;
 psn.lowLongOfPSN = kCurrentProcess;

 r = TransformProcessType(psn, kProcessTransformToUIElementApplication)
 console.log("TransformProcessType returned " + r);

 carbon.close();

 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/11429#comment:8>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs