本文整理汇总了C++中GDK_NOTE函数的典型用法代码示例。如果您正苦于以下问题:C++ GDK_NOTE函数的具体用法?C++ GDK_NOTE怎么用?C++ GDK_NOTE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GDK_NOTE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gdk_win32_display_request_selection_notification
static gboolean
gdk_win32_display_request_selection_notification (GdkDisplay *display,
GdkAtom selection)
{
GdkWin32Display *display_win32 = GDK_WIN32_DISPLAY (display);
gboolean ret = FALSE;
GDK_NOTE (DND,
g_print ("gdk_display_request_selection_notification (..., %s)",
gdk_atom_name (selection)));
if (selection == GDK_SELECTION_CLIPBOARD ||
selection == GDK_SELECTION_PRIMARY)
{
if (display_win32->clipboard_hwnd == NULL)
{
if (register_clipboard_notification (display))
GDK_NOTE (DND, g_print (" registered"));
else
GDK_NOTE (DND, g_print (" failed to register"));
}
ret = (display_win32->clipboard_hwnd != NULL);
}
else
{
GDK_NOTE (DND, g_print (" unsupported"));
ret = FALSE;
}
GDK_NOTE (DND, g_print (" -> %s\n", ret ? "TRUE" : "FALSE"));
return ret;
}
示例2: gdk_win32_display_request_selection_notification
static gboolean
gdk_win32_display_request_selection_notification (GdkDisplay *display,
GdkAtom selection)
{
static HWND hwndViewer = NULL;
gboolean ret = FALSE;
GDK_NOTE (DND,
g_print ("gdk_display_request_selection_notification (..., %s)",
gdk_atom_name (selection)));
if (selection == GDK_SELECTION_CLIPBOARD ||
selection == GDK_SELECTION_PRIMARY)
{
if (!hwndViewer)
{
hwndViewer = _gdk_win32_register_clipboard_notification ();
GDK_NOTE (DND, g_print (" registered"));
}
ret = (hwndViewer != NULL);
}
else
{
GDK_NOTE (DND, g_print (" unsupported"));
ret = FALSE;
}
GDK_NOTE (DND, g_print (" -> %s\n", ret ? "TRUE" : "FALSE"));
return ret;
}
示例3: gdk_selection_property_get
gint
gdk_selection_property_get(GdkWindow * requestor,
guchar ** data,
GdkAtom * ret_type, gint * ret_format)
{
GdkSelProp *prop;
g_return_val_if_fail(requestor != NULL, 0);
g_return_val_if_fail(GDK_IS_WINDOW(requestor), 0);
if (GDK_DRAWABLE_DESTROYED(requestor))
return 0;
GDK_NOTE(DND, g_print("gdk_selection_property_get: %#x",
GDK_DRAWABLE_XID(requestor)));
prop =
g_hash_table_lookup(sel_prop_table, &GDK_DRAWABLE_XID(requestor));
if (prop == NULL) {
GDK_NOTE(DND, g_print(": NULL\n"));
*data = NULL;
return 0;
}
GDK_NOTE(DND, g_print(": %d bytes\n", prop->length));
*data = g_malloc(prop->length);
if (prop->length > 0)
memmove(*data, prop->data, prop->length);
if (ret_type)
*ret_type = prop->type;
if (ret_format)
*ret_format = prop->format;
return prop->length;
}
示例4: _gdk_monitor_init
void
_gdk_monitor_init (void)
{
#ifdef HAVE_MONITOR_INFO
gint i, index;
_gdk_num_monitors = 0;
EnumDisplayMonitors (NULL, NULL, count_monitor, (LPARAM) &_gdk_num_monitors);
_gdk_monitors = g_renew (GdkWin32Monitor, _gdk_monitors, _gdk_num_monitors);
index = 0;
EnumDisplayMonitors (NULL, NULL, enum_monitor, (LPARAM) &index);
_gdk_offset_x = G_MININT;
_gdk_offset_y = G_MININT;
/* Calculate offset */
for (i = 0; i < _gdk_num_monitors; i++)
{
_gdk_offset_x = MAX (_gdk_offset_x, -_gdk_monitors[i].rect.x);
_gdk_offset_y = MAX (_gdk_offset_y, -_gdk_monitors[i].rect.y);
}
GDK_NOTE (MISC, g_print ("Multi-monitor offset: (%d,%d)\n",
_gdk_offset_x, _gdk_offset_y));
/* Translate monitor coords into GDK coordinate space */
for (i = 0; i < _gdk_num_monitors; i++)
{
_gdk_monitors[i].rect.x += _gdk_offset_x;
_gdk_monitors[i].rect.y += _gdk_offset_y;
GDK_NOTE (MISC, g_print ("Monitor %d: %dx%[email protected]%+d%+d\n",
i, _gdk_monitors[i].rect.width,
_gdk_monitors[i].rect.height,
_gdk_monitors[i].rect.x,
_gdk_monitors[i].rect.y));
}
#else
HDC hDC;
_gdk_num_monitors = 1;
_gdk_monitors = g_renew (GdkWin32Monitor, _gdk_monitors, 1);
_gdk_monitors[0].name = g_strdup ("DISPLAY");
hDC = GetDC (NULL);
_gdk_monitors[0].width_mm = GetDeviceCaps (hDC, HORZSIZE);
_gdk_monitors[0].height_mm = GetDeviceCaps (hDC, VERTSIZE);
ReleaseDC (NULL, hDC);
_gdk_monitors[0].rect.x = 0;
_gdk_monitors[0].rect.y = 0;
_gdk_monitors[0].rect.width = GetSystemMetrics (SM_CXSCREEN);
_gdk_monitors[0].rect.height = GetSystemMetrics (SM_CYSCREEN);
_gdk_offset_x = 0;
_gdk_offset_y = 0;
#endif
}
示例5: _gdk_win32_display_open
GdkDisplay *
_gdk_win32_display_open (const gchar *display_name)
{
GdkWin32Display *win32_display;
GDK_NOTE (MISC, g_print ("gdk_display_open: %s\n", (display_name ? display_name : "NULL")));
if (display_name == NULL ||
g_ascii_strcasecmp (display_name,
gdk_display_get_name (_gdk_display)) == 0)
{
if (_gdk_display != NULL)
{
GDK_NOTE (MISC, g_print ("... return _gdk_display\n"));
return _gdk_display;
}
}
else
{
GDK_NOTE (MISC, g_print ("... return NULL\n"));
return NULL;
}
_gdk_display = g_object_new (GDK_TYPE_WIN32_DISPLAY, NULL);
win32_display = GDK_WIN32_DISPLAY (_gdk_display);
win32_display->screen = g_object_new (GDK_TYPE_WIN32_SCREEN, NULL);
_gdk_events_init (_gdk_display);
_gdk_input_ignore_core = 0;
_gdk_device_manager = g_object_new (GDK_TYPE_DEVICE_MANAGER_WIN32,
NULL);
_gdk_device_manager->display = _gdk_display;
_gdk_drag_init ();
_gdk_drop_init ();
_gdk_display->clipboard = gdk_win32_clipboard_new (_gdk_display);
_gdk_display->primary_clipboard = gdk_clipboard_new (_gdk_display);
/* Precalculate display name */
(void) gdk_display_get_name (_gdk_display);
register_display_change_notification (_gdk_display);
g_signal_emit_by_name (_gdk_display, "opened");
GDK_NOTE (MISC, g_print ("... _gdk_display now set up\n"));
return _gdk_display;
}
示例6: _gdk_window_move_resize_child
void
_gdk_window_move_resize_child (GdkWindow *window,
gint x,
gint y,
gint width,
gint height)
{
GdkWindowImplWin32 *impl;
GdkWindowObject *obj;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
obj = GDK_WINDOW_OBJECT (window);
impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
GDK_NOTE (MISC, g_print ("_gdk_window_move_resize_child: %[email protected]%+d%+d %dx%[email protected]%+d%+d\n",
_gdk_win32_drawable_description (window),
obj->x, obj->y, width, height, x, y));
if (width > 65535 || height > 65535)
{
g_warning ("Native children wider or taller than 65535 pixels are not supported.");
if (width > 65535)
width = 65535;
if (height > 65535)
height = 65535;
}
obj->x = x;
obj->y = y;
obj->width = width;
obj->height = height;
_gdk_win32_window_tmp_unset_parent_bg (window);
_gdk_win32_window_tmp_unset_bg (window, TRUE);
GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,%d,%d,"
"NOACTIVATE|NOZORDER)\n",
GDK_WINDOW_HWND (window),
obj->x + obj->parent->abs_x, obj->y + obj->parent->abs_y,
width, height));
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), NULL,
obj->x + obj->parent->abs_x, obj->y + obj->parent->abs_y,
width, height,
SWP_NOACTIVATE | SWP_NOZORDER));
//_gdk_win32_window_tmp_reset_parent_bg (window);
_gdk_win32_window_tmp_reset_bg (window, TRUE);
}
示例7: gdk_selection_owner_set
gint
gdk_selection_owner_set(GdkWindow * owner,
GdkAtom selection, guint32 time, gint send_event)
{
gchar *sel_name;
HWND xwindow;
GDK_NOTE(DND,
(sel_name = gdk_atom_name(selection),
g_print("gdk_selection_owner_set: %#x %#x (%s)\n",
(owner ? GDK_DRAWABLE_XID(owner) : 0),
selection, sel_name), g_free(sel_name)));
if (selection != gdk_clipboard_atom)
return FALSE;
if (owner != NULL)
xwindow = GDK_DRAWABLE_XID(owner);
else
xwindow = NULL;
GDK_NOTE(DND, g_print("...OpenClipboard(%#x)\n", xwindow));
if (!OpenClipboard(xwindow)) {
WIN32_API_FAILED("OpenClipboard");
return FALSE;
}
GDK_NOTE(DND, g_print("...EmptyClipboard()\n"));
if (!EmptyClipboard()) {
WIN32_API_FAILED("EmptyClipboard");
CloseClipboard();
return FALSE;
}
#if 0
/* No delayed rendering */
if (xwindow != NULL)
SetClipboardData(CF_TEXT, NULL);
#endif
GDK_NOTE(DND, g_print("...CloseClipboard()\n"));
if (!CloseClipboard()) {
WIN32_API_FAILED("CloseClipboard");
return FALSE;
}
if (owner != NULL) {
/* Send ourselves an ersatz selection request message so that
* gdk_property_change will be called to store the clipboard data.
*/
SendMessage(xwindow, gdk_selection_request_msg, selection, 0);
}
return TRUE;
}
示例8: primary_source_send
static void
primary_source_send (void *data,
struct gtk_primary_selection_source *source,
const char *mime_type,
int32_t fd)
{
GdkWaylandSelection *wayland_selection = data;
GDK_NOTE (EVENTS,
g_message ("primary source send, source = %p, mime_type = %s, fd = %d",
source, mime_type, fd));
if (!mime_type || !wayland_selection->primary_owner)
{
close (fd);
return;
}
if (!gdk_wayland_selection_request_target (wayland_selection,
wayland_selection->primary_owner,
atoms[ATOM_PRIMARY],
gdk_atom_intern (mime_type, FALSE),
fd))
gdk_wayland_selection_check_write (wayland_selection);
}
示例9: data_source_cancelled
static void
data_source_cancelled (void *data,
struct wl_data_source *source)
{
GdkWaylandSelection *wayland_selection = data;
GdkDragContext *context;
GdkDisplay *display;
GdkAtom atom;
GDK_NOTE (EVENTS,
g_message ("data source cancelled, source = %p", source));
display = gdk_display_get_default ();
if (source == wayland_selection->dnd_source)
atom = atoms[ATOM_DND];
else if (source == wayland_selection->clipboard_source)
atom = atoms[ATOM_CLIPBOARD];
else
return;
context = gdk_wayland_drag_context_lookup_by_data_source (source);
if (context)
gdk_drag_context_cancel (context, GDK_DRAG_CANCEL_ERROR);
emit_selection_clear (display, atom);
gdk_selection_owner_set (NULL, atom, GDK_CURRENT_TIME, TRUE);
gdk_wayland_selection_unset_data_source (display, atom);
}
示例10: gdk_selection_send_notify
void
gdk_selection_send_notify(guint32 requestor,
GdkAtom selection,
GdkAtom target, GdkAtom property, guint32 time)
{
gchar *sel_name, *tgt_name, *prop_name;
GDK_NOTE(DND,
(sel_name = gdk_atom_name(selection),
tgt_name = gdk_atom_name(target),
prop_name = gdk_atom_name(property),
g_print
("gdk_selection_send_notify: %#x %#x (%s) %#x (%s) %#x (%s)\n",
requestor, selection, sel_name, target, tgt_name, property,
prop_name), g_free(sel_name), g_free(tgt_name),
g_free(prop_name)));
/* Send ourselves a selection clear message so that gtk thinks we don't
* have the selection, and will claim it anew when needed, and
* we thus get a chance to store data in the Windows clipboard.
* Otherwise, if a gtkeditable does a copy to clipboard several times
* only the first one actually gets copied to the Windows clipboard,
* as only he first one causes a call to gdk_property_change.
*
* Hmm, there is something fishy with this. Cut and paste inside the
* same app didn't work, the gtkeditable immediately forgot the
* clipboard contents in gtk_editable_selection_clear as a result of
* this message. OTOH, when I changed gdk_selection_owner_get to
* always return NULL, it works. Sigh.
*/
SendMessage((HWND) requestor, gdk_selection_clear_msg, selection, 0);
}
示例11: gdk_window_lookup
GdkWindow *gdk_selection_owner_get(GdkAtom selection)
{
GdkWindow *window;
gchar *sel_name;
#if 0
/* XXX Hmm, gtk selections seem to work best with this. This causes
* gtk to always get the clipboard contents from Windows, and not
* from the editable's own stashed-away copy.
*/
return NULL;
#else
if (selection != gdk_clipboard_atom)
window = NULL;
else {
window = gdk_window_lookup(GetClipboardOwner());
if (window == NULL)
window = (GdkWindow *)GetClipboardOwner();
}
#endif
GDK_NOTE(DND,
(sel_name = gdk_atom_name(selection),
g_print("gdk_selection_owner_get: %#x (%s) = %#x\n",
selection, sel_name,
(window ? GDK_DRAWABLE_XID(window) : 0)),
g_free(sel_name)));
return window;
}
示例12: gdk_property_delete
void
gdk_property_delete (GdkWindow *window,
GdkAtom property)
{
g_return_if_fail (!window || GDK_IS_WINDOW (window));
if (!window)
{
GdkScreen *screen = gdk_screen_get_default ();
window = gdk_screen_get_root_window (screen);
GDK_NOTE (MULTIHEAD,
g_message ("gdk_property_delete(): window is NULL\n"));
}
if (GDK_WINDOW_DESTROYED (window))
return;
gi_atom_id_t aid;
GdkDisplay *display = GDK_DISPLAY_OBJECT(_gdk_display);
aid = gdk_x11_atom_to_xatom_for_display (display, property);
gi_delete_property ( GDK_DRAWABLE_GIX_ID (window), aid);
}
示例13: gdk_parse_args
/**
* gdk_parse_args:
* @argc: the number of command line arguments.
* @argv: (inout) (array length=argc): the array of command line arguments.
*
* Parse command line arguments, and store for future
* use by calls to gdk_display_open().
*
* Any arguments used by GDK are removed from the array and @argc and @argv are
* updated accordingly.
*
* You shouldn’t call this function explicitly if you are using
* gtk_init(), gtk_init_check(), gdk_init(), or gdk_init_check().
*
* Since: 2.2
**/
void
gdk_parse_args (int *argc,
char ***argv)
{
GOptionContext *option_context;
GOptionGroup *option_group;
GError *error = NULL;
if (gdk_initialized)
return;
gdk_pre_parse ();
option_context = g_option_context_new (NULL);
g_option_context_set_ignore_unknown_options (option_context, TRUE);
g_option_context_set_help_enabled (option_context, FALSE);
option_group = g_option_group_new (NULL, NULL, NULL, NULL, NULL);
g_option_context_set_main_group (option_context, option_group);
g_option_group_add_entries (option_group, gdk_args);
if (!g_option_context_parse (option_context, argc, argv, &error))
{
g_warning ("%s", error->message);
g_error_free (error);
}
g_option_context_free (option_context);
GDK_NOTE (MISC, g_message ("progname: \"%s\"", g_get_prgname ()));
}
示例14: inner_display_change_window_procedure
static LRESULT CALLBACK
inner_display_change_window_procedure (HWND hwnd,
UINT message,
WPARAM wparam,
LPARAM lparam)
{
switch (message)
{
case WM_DESTROY:
{
PostQuitMessage (0);
return 0;
}
case WM_DISPLAYCHANGE:
{
_gdk_monitor_init ();
_gdk_root_window_size_init ();
g_signal_emit_by_name (_gdk_screen, "size_changed");
return 0;
}
default:
/* Otherwise call DefWindowProcW(). */
GDK_NOTE (EVENTS, g_print (" DefWindowProcW"));
return DefWindowProc (hwnd, message, wparam, lparam);
}
}
示例15: inner_display_change_window_procedure
static LRESULT CALLBACK
inner_display_change_window_procedure (HWND hwnd,
UINT message,
WPARAM wparam,
LPARAM lparam)
{
switch (message)
{
case WM_DESTROY:
{
PostQuitMessage (0);
return 0;
}
case WM_DISPLAYCHANGE:
{
GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (_gdk_display);
_gdk_win32_screen_on_displaychange_event (GDK_WIN32_SCREEN (win32_display->screen));
return 0;
}
default:
/* Otherwise call DefWindowProcW(). */
GDK_NOTE (EVENTS, g_print (" DefWindowProcW"));
return DefWindowProc (hwnd, message, wparam, lparam);
}
}