Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2007-02-23 21:41:47 +0000
committerAndrew Niefer2007-02-23 21:41:47 +0000
commit73c71adf0b71dd672741ac534e8716fe56467e71 (patch)
treeca45a94ca0cfbf5995049c4653ac8615eeb0629e /bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c
parent97114bb5c5d2f21fff1846811aa16f9dbf76d6ac (diff)
downloadrt.equinox.framework-73c71adf0b71dd672741ac534e8716fe56467e71.tar.gz
rt.equinox.framework-73c71adf0b71dd672741ac534e8716fe56467e71.tar.xz
rt.equinox.framework-73c71adf0b71dd672741ac534e8716fe56467e71.zip
bug 173764
Diffstat (limited to 'bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c')
-rw-r--r--bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c
index ec69c1fb7..7940d05fd 100644
--- a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c
+++ b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c
@@ -310,4 +310,55 @@ static CGImageRef loadBMPImage (const char *bmpPathname) {
NgBitmapImageFree(&image);
return ref;
+}
+
+#define DOCK_ICON_PREFIX "-Xdock:icon="
+#define DOCK_NAME_PREFIX "-Xdock:name="
+#define APP_ICON_PATTERN "APP_ICON_%d"
+#define APP_NAME_PATTERN "APP_NAME_%d"
+
+void processVMArgs(char **vmargs[] )
+{
+ int i = -1;
+ int pid = 0, pidLength = 1, temp = 0;
+ char * name = NULL, *icon = NULL;
+ char * c;
+
+ if( *vmargs == NULL)
+ return;
+
+ while( (*vmargs)[++i] != NULL ) {
+ /*-Xdock:icon -> APP_ICON_<pid>*/
+ if(_tcsncmp((*vmargs)[i], DOCK_ICON_PREFIX, _tcslen(DOCK_ICON_PREFIX)) == 0) {
+ icon = (*vmargs)[i] + _tcslen(DOCK_ICON_PREFIX);
+ }
+ /*-Xdock:name -> APP_NAME_<pid>*/
+ else if(_tcsncmp((*vmargs)[i], DOCK_NAME_PREFIX, _tcslen(DOCK_NAME_PREFIX)) == 0) {
+ name = (*vmargs)[i] + _tcslen(DOCK_NAME_PREFIX);
+ }
+ if (name != NULL && icons != NULL)
+ break;
+ }
+
+ if (name == NULL && icon == NULL)
+ return; /* don't need to do anything */
+
+ temp = pid = getpid();
+ /* how many digits in pid? */
+ while (temp > 9) {
+ pidLength++;
+ temp /= 10;
+ }
+
+ if (name != NULL) {
+ c = malloc( (_tcslen(APP_NAME_PATTERN) + pidLength + 1) * sizeof(char*));
+ _stprintf( c, APP_NAME_PATTERN, pid );
+ setenv(c, name, 1);
+ }
+
+ if (icon != NULL) {
+ c = malloc( (_tcslen(icon) + _tcslen(APP_ICON_PATTERN) + pidLength + 1) * sizeof(char*));
+ _stprintf( c, APP_ICON_PATTERN, pid );
+ setenv(c, icon, 1);
+ }
} \ No newline at end of file

Back to the top