void launcher_launch (Launcher *launcher, GtkWidget *widget) { char *type; g_return_if_fail (launcher != NULL); g_return_if_fail (launcher->key_file != NULL); launcher_do_zoom_animation (widget); type = panel_key_file_get_string (launcher->key_file, "Type"); if (type && !strcmp (type, "Link")) launch_url (launcher); else { GError *error = NULL; panel_launch_key_file (launcher->key_file, NULL, launcher_get_screen (launcher), &error); if (error) { GtkWidget *error_dialog; error_dialog = panel_error_dialog ( NULL, launcher_get_screen (launcher), "cannot_launch_application", TRUE, _("Could not launch application"), error->message); launcher_register_error_dialog (launcher, error_dialog); g_clear_error (&error); } } g_free (type); }
/* button event handler */ gboolean event_button(GtkWidget *widget, GdkEventButton *button_event) { int ret = 0; gchar *match; if(button_event->button == 1) { match = vte_terminal_match_check(VTE_TERMINAL(widget), button_event->x / vte_terminal_get_char_width (VTE_TERMINAL (widget)), button_event->y / vte_terminal_get_char_height (VTE_TERMINAL (widget)), &ret); if (match) { launch_url(match); return TRUE; } } return FALSE; }
void do_launch_urls(void) { HGLOBAL clipdata; char *s = NULL, *t = NULL, *p, *q, *r, *e; int len, ret, in_url = 0, n = 0; if (!OpenClipboard(NULL)) { goto error; /* unable to read clipboard */ } clipdata = GetClipboardData(CF_TEXT); CloseClipboard(); if (!clipdata) { goto error; /* clipboard contains no text */ } s = GlobalLock(clipdata); if (!s) { goto error; /* unable to lock clipboard memory */ } /* * Now strip (some) whitespace from the URL text. * In a future version this might be made configurable. */ len = strlen(s); t = malloc(len+8); /* leading "http://" plus trailing \0 */ if (!t) { GlobalUnlock(s); goto error; /* out of memory */ } p = s; q = t; /* Strip leading whitespace. */ while (p[0] && our_isspace(p[0])) p++; /* Find any newlines, and close up any white-space around them. */ while ((r = strpbrk(p, "\r\n"))) { char *rr = r; /* Strip whitespace before newline(s) */ while (our_isspace(rr[0])) rr--; while (p <= rr) *q++ = *p++; /* Strip newline(s) and following whitespace */ p = r; while (p[0] && our_isspace(p[0])) p++; } /* Strip any trailing whitespace */ r = p + strlen(p); while (r > p && our_isspace(r[-1])) r--; while (p < r) *q++ = *p++; *q = '\0'; GlobalUnlock(s); /* * Now we have whitespace-filtered text in t. * First look for <>-delimited strings per RFC3986, and try to * launch any we find as URLs. */ q = t; while ((e = strpbrk(q, "<>"))) { switch (*e) { case '<': q = e+1; in_url = 1; break; case '>': if (in_url) { /* deal with RFC1738 <URL:...> */ if (strncmp(q, "URL:", 4) == 0) q += 4; /* Remove whitespace between < / <URL: / > and URL. */ while (our_isspace(*q)) q++; { char *ee = e-1; while (our_isspace(*ee)) ee--; ee[1] = '\0'; } /* We may as well allow non-RFC <*****@*****.**> and * indeed <URL:www.example.com>. */ (void) launch_url(q); n++; in_url = 0; } q = e+1; break; } } if (!n) { /* Didn't find any URLs by that method. Try parsing the string * as a whole as one. */ ret = launch_url(t); } free(t); error: /* * Not entirely sure what we should do in case of error here. * Perhaps a simple beep might be suitable. Then again, `out of * memory' is a bit scarier. FIXME: should probably do * different error handling depending on context. */ ; }
void about_window::on_aboutTxt4_linkActivated(const QString &link) { launch_url(link); }
void about_window::on_reportBugsBtn_clicked() { launch_url(QStringLiteral("https://github.com/resfilter/eehack/issues/new")); }
void about_window::on_donateBtn_clicked() { launch_url(QStringLiteral("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=resfilter%40resfilter%2enet&lc=CA&item_name=fbodytech%2ecom¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted")); }
/** * Window procedure to handle events on the main program window * * @param hdlg Handle to current program instance * @param message Event type this window has just received * @param wParam message specific data * @param lParam message specific data * @return */ static LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { HMENU hmenu; switch (message) /* handle the messages */ { case WM_CREATE: strcpy(config.isoname, ""); return 0; case WM_COMMAND: hmenu=GetMenu(hwnd); switch (LOWORD(wParam)) { case IDM_FILE_RESET: resetrpc(); return 0; case IDM_FILE_EXIT: closevideo(); PostQuitMessage(0); return 0; case IDM_DISC_LD0: changedisc(ghwnd,0); return 0; case IDM_DISC_LD1: changedisc(ghwnd,1); return 0; case IDM_CONFIG: DialogBox(hinstance,TEXT("ConfigureDlg"),ghwnd,configdlgproc); return 0; case IDM_NETWORKING: DialogBox(hinstance, TEXT("NetworkDlg"), ghwnd, networkdlgproc); return 0; case IDM_FULLSCR: if (mousecapture) { ClipCursor(&oldclip); mousecapture=0; } togglefullscreen(1); return 0; case IDM_CPUIDLE: if (MessageBox(ghwnd, "This will reset RPCEmu!\nOkay to continue?", "RPCEmu", MB_OKCANCEL) == IDOK) { config.cpu_idle ^= 1; resetrpc(); CheckMenuItem(hmenu, IDM_CPUIDLE, config.cpu_idle ? MF_CHECKED : MF_UNCHECKED); } return 0; case IDM_CDROM_DISABLED: if (config.cdromenabled) { if (MessageBox(ghwnd, "This will reset RPCEmu!\nOkay to continue?", "RPCEmu", MB_OKCANCEL) == IDOK) { config.cdromenabled = 0; resetrpc(); CheckMenuItem(hmenu, IDM_CDROM_DISABLED + config.cdromtype, MF_UNCHECKED); config.cdromtype = IDM_CDROM_DISABLED - IDM_CDROM_DISABLED; CheckMenuItem(hmenu, IDM_CDROM_DISABLED + config.cdromtype, MF_CHECKED); } } return 0; case IDM_CDROM_EMPTY: if (!config.cdromenabled) { if (MessageBox(ghwnd, "This will reset RPCEmu!\nOkay to continue?", "RPCEmu", MB_OKCANCEL) == IDOK) { config.cdromenabled = 1; resetrpc(); } else return 0; } atapi->exit(); iso_init(); CheckMenuItem(hmenu, IDM_CDROM_DISABLED + config.cdromtype, MF_UNCHECKED); config.cdromtype = IDM_CDROM_EMPTY - IDM_CDROM_DISABLED; CheckMenuItem(hmenu, IDM_CDROM_DISABLED + config.cdromtype, MF_CHECKED); return 0; case IDM_CDROM_ISO: if (selectiso(ghwnd)) { if (!config.cdromenabled) { if (MessageBox(ghwnd, "This will reset RPCEmu!\nOkay to continue?", "RPCEmu", MB_OKCANCEL) == IDOK) { config.cdromenabled = 1; resetrpc(); } else return 0; } atapi->exit(); iso_open(config.isoname); } CheckMenuItem(hmenu, IDM_CDROM_DISABLED + config.cdromtype, MF_UNCHECKED); config.cdromtype = IDM_CDROM_ISO - IDM_CDROM_DISABLED; CheckMenuItem(hmenu, IDM_CDROM_DISABLED + config.cdromtype, MF_CHECKED); return 0; case IDM_MOUSE_FOL: CheckMenuItem(hmenu,IDM_MOUSE_FOL,MF_CHECKED); CheckMenuItem(hmenu,IDM_MOUSE_CAP,MF_UNCHECKED); config.mousehackon = 1; if (mousecapture) { ClipCursor(&oldclip); mousecapture=0; } return 0; case IDM_MOUSE_CAP: CheckMenuItem(hmenu,IDM_MOUSE_FOL,MF_UNCHECKED); CheckMenuItem(hmenu,IDM_MOUSE_CAP,MF_CHECKED); config.mousehackon = 0; return 0; case IDM_MOUSE_TWOBUTTON: config.mousetwobutton ^= 1; CheckMenuItem(hmenu, IDM_MOUSE_TWOBUTTON, config.mousetwobutton ? MF_CHECKED : MF_UNCHECKED); return 0; case IDM_HELP_ONLINE_MANUAL: launch_url(URL_MANUAL); return 0; case IDM_HELP_VISIT_WEBSITE: launch_url(URL_WEBSITE); return 0; case IDM_HELP_ABOUT: if (!IsWindow(hwnd_about)) { hwnd_about = CreateDialog(hinstance, MAKEINTRESOURCE(IDD_ABOUT), ghwnd, about_dlg_proc); window_centre_parent(hwnd_about, ghwnd); ShowWindow(hwnd_about, SW_SHOW); } return 0; } if (LOWORD(wParam)>=IDM_CDROM_REAL && LOWORD(wParam)<(IDM_CDROM_REAL+100)) { if (!config.cdromenabled) { if (MessageBox(ghwnd, "This will reset RPCEmu!\nOkay to continue?", "RPCEmu", MB_OKCANCEL) == IDOK) { config.cdromenabled = 1; resetrpc(); } else return 0; } atapi->exit(); ioctl_open(LOWORD(wParam)-IDM_CDROM_REAL); CheckMenuItem(hmenu, IDM_CDROM_DISABLED + config.cdromtype, MF_UNCHECKED); config.cdromtype = LOWORD(wParam) - IDM_CDROM_DISABLED; CheckMenuItem(hmenu, IDM_CDROM_DISABLED + config.cdromtype, MF_CHECKED); return 0; } break; case WM_DESTROY: closevideo(); PostQuitMessage (0); /* send a WM_QUIT to the message queue */ break; case WM_SETFOCUS: resetbuffer(); break; case WM_KILLFOCUS: if (mousecapture) { ClipCursor(&oldclip); mousecapture=0; } break; case WM_LBUTTONUP: if (!mousecapture && !fullscreen && !config.mousehackon) { RECT arcclip; GetClipCursor(&oldclip); GetWindowRect(hwnd,&arcclip); arcclip.left+=GetSystemMetrics(SM_CXFIXEDFRAME)+10; arcclip.right-=GetSystemMetrics(SM_CXFIXEDFRAME)+10; arcclip.top+=GetSystemMetrics(SM_CXFIXEDFRAME)+GetSystemMetrics(SM_CYMENUSIZE)+GetSystemMetrics(SM_CYCAPTION)+10; arcclip.bottom-=GetSystemMetrics(SM_CXFIXEDFRAME)+10; ClipCursor(&arcclip); mousecapture=1; updatemips=1; } break; default: /* for messages that we don't deal with */ return DefWindowProc (hwnd, message, wParam, lParam); } return 0; }