mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-11-23 11:53:02 +00:00
restructuring
This commit is contained in:
parent
f9b2395e20
commit
721770373f
4 changed files with 18 additions and 20 deletions
|
@ -1,13 +1,11 @@
|
|||
#pragma once
|
||||
#include <stdbool.h>
|
||||
#include "misc/helpers.h"
|
||||
#include "window.h"
|
||||
#include "image.h"
|
||||
|
||||
#define MENUBAR_LAYER 0x19
|
||||
|
||||
extern void SLSCaptureWindowsContentsToRectWithOptions(uint32_t cid, uint64_t* wid, bool meh, CGRect bounds, uint32_t flags, CGImageRef* image);
|
||||
extern int SLSGetScreenRectForWindow(uint32_t cid, uint32_t wid, CGRect* out);
|
||||
|
||||
struct alias {
|
||||
bool permission;
|
||||
|
||||
|
|
|
@ -73,8 +73,6 @@ void bar_order_item_windows(struct bar* bar, int mode) {
|
|||
}
|
||||
|
||||
void bar_draw(struct bar* bar) {
|
||||
// SLSRemoveAllTrackingAreas(g_connection, bar->window.id);
|
||||
|
||||
if (bar->needs_update) {
|
||||
draw_rect(bar->window.context,
|
||||
bar->window.frame,
|
||||
|
|
29
src/window.c
29
src/window.c
|
@ -1,6 +1,4 @@
|
|||
#include "window.h"
|
||||
#include "alias.h"
|
||||
#include "bar_manager.h"
|
||||
|
||||
static CFTypeRef window_create_region(struct window *window, CGRect frame) {
|
||||
window->frame = (CGRect) {{0, 0},{frame.size.width, frame.size.height}};
|
||||
|
@ -28,18 +26,19 @@ void window_create(struct window* window, CGRect frame) {
|
|||
SLSClearWindowTags(g_connection, window->id, &clear_tags, 64);
|
||||
SLSSetWindowOpacity(g_connection, window->id, 0);
|
||||
|
||||
// const void* keys[] = { CFSTR("CGWindowContextShouldUseCA") };
|
||||
// const void* values[] = { kCFBooleanTrue };
|
||||
// CFDictionaryRef dict = CFDictionaryCreate(NULL, keys, values, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
|
||||
// CGContextRef context = SLWindowContextCreate(g_connection, window->id, dict);
|
||||
window->context = SLWindowContextCreate(g_connection, window->id, 0);
|
||||
// CFRelease(dict);
|
||||
const void* keys[] = { CFSTR("CGWindowContextShouldUseCA") };
|
||||
const void* values[] = { kCFBooleanTrue };
|
||||
CFDictionaryRef dict = CFDictionaryCreate(NULL,
|
||||
keys,
|
||||
values,
|
||||
1,
|
||||
&kCFTypeDictionaryKeyCallBacks,
|
||||
&kCFTypeDictionaryValueCallBacks);
|
||||
|
||||
window->context = SLWindowContextCreate(g_connection, window->id, dict);
|
||||
CFRelease(dict);
|
||||
|
||||
CGContextSetInterpolationQuality(window->context, kCGInterpolationNone);
|
||||
// CGLayerRef layer = CGLayerCreateWithContext(context, window->frame.size, 0);
|
||||
|
||||
// window->context = CGLayerGetContext(layer);
|
||||
|
||||
|
||||
// SLSAddSurface(g_connection, window->id, &window->surface_id);
|
||||
// SLSSetSurfaceBounds(g_connection, window->id, window->surface_id, window->frame);
|
||||
|
@ -74,9 +73,9 @@ void window_resize(struct window* window, CGRect frame) {
|
|||
window->origin.y,
|
||||
frame_region );
|
||||
|
||||
// SLSClearActivationRegion(g_connection, window->id);
|
||||
// SLSAddActivationRegion(g_connection, window->id, frame_region);
|
||||
// SLSRemoveAllTrackingAreas(g_connection, window->id);
|
||||
SLSClearActivationRegion(g_connection, window->id);
|
||||
SLSAddActivationRegion(g_connection, window->id, frame_region);
|
||||
SLSRemoveAllTrackingAreas(g_connection, window->id);
|
||||
|
||||
CFRelease(frame_region);
|
||||
}
|
||||
|
|
|
@ -25,6 +25,9 @@ extern CGError SLSAddWindowToWindowOrderingGroup(int cid, uint32_t parent_wid, u
|
|||
extern CGError SLSRemoveFromOrderingGroup(int cid, uint32_t wid);
|
||||
extern int SLSSpaceGetType(int cid, uint64_t sid);
|
||||
|
||||
extern void SLSCaptureWindowsContentsToRectWithOptions(uint32_t cid, uint64_t* wid, bool meh, CGRect bounds, uint32_t flags, CGImageRef* image);
|
||||
extern int SLSGetScreenRectForWindow(uint32_t cid, uint32_t wid, CGRect* out);
|
||||
|
||||
extern CGError SLSAddSurface(int cid, uint32_t wid, uint32_t* outSID);
|
||||
extern CGError SLSRemoveSurface(int cid, uint32_t wid, uint32_t sid);
|
||||
extern CGError SLSBindSurface(int cid, uint32_t wid, uint32_t sid, int x, int y, CGContextRef ctx);
|
||||
|
|
Loading…
Reference in a new issue